Skip to content

Commit

Permalink
rebuild will now kill instead of stop
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed May 9, 2024
1 parent 96821f1 commit 8132b26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

* Added `buildkit` as an alias for `buildx` in `l337` service `image` key
* Changed `download-x` to prefer `ipv4` [#165](https://github.com/lando/core/pull/165)
* Changed `rebuild` to `kill` instead of `stop`
* Improved error handling on `download-x` [#165](https://github.com/lando/core/pull/165)

## v3.21.0-beta.18 - [April 29, 2024](https://github.com/lando/core/releases/tag/v3.21.0-beta.18)
Expand Down
7 changes: 4 additions & 3 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ module.exports = class App {
*/
.then(() => this.events.emit('pre-rebuild'))
// Stop app.
.then(() => this.stop())
.then(() => this.stop(true))
// Uninstall app
.then(() => this.uninstall())
// Repull/build components.
Expand Down Expand Up @@ -526,9 +526,10 @@ module.exports = class App {
* @alias app.stop
* @fires pre_stop
* @fires post_stop
* @param {Boolean} kill - Kill instead of stop
* @return {Promise} A Promise.
*/
stop() {
stop(kill = false) {
// Stop it!
this.log.info('stopping app...');
return initAndReport(this, 'stop')
Expand All @@ -543,7 +544,7 @@ module.exports = class App {
.then(() => this.events.emit('pre-stop'))

// Stop components.
.then(() => this.engine.stop(this))
.then(() => this.engine.stop({...this, kill}))

/**
* Event that runs after an app stop.
Expand Down
7 changes: 6 additions & 1 deletion lib/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ exports.build = (compose, project, opts = {}) => {
*/
exports.getId = (compose, project, opts = {}) => buildShell('ps', project, compose, opts);

/*
* Run docker compose kill
*/
exports.kill = (compose, project, opts = {}) => buildShell('kill', project, compose, opts);

/*
* Run docker compose logs
*/
Expand Down Expand Up @@ -124,6 +129,6 @@ exports.run = (compose, project, opts = {}) => buildShell('exec', project, compo
exports.start = (compose, project, opts = {}) => buildShell('up', project, compose, opts);

/*
* Run docker compose kill
* Run docker compose stop
*/
exports.stop = (compose, project, opts = {}) => buildShell('stop', project, compose, opts);
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ exports.start = (data, compose) => retryEach(data, datum => compose('start', dat
* Helper to route to stop command
*/
exports.stop = (data, compose, docker) => retryEach(data, datum => {
return (datum.compose) ? compose('stop', datum) : docker.stop(getContainerId(datum));
return (datum.compose) ? compose(data.kill ? 'kill' : 'stop', datum) : docker.stop(getContainerId(datum));
});

0 comments on commit 8132b26

Please sign in to comment.