mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-24 21:09:47 +00:00
Update and improve debug and development tools
Add a debounce to the livepush invocations, execute on start and also add a wait on the supervisor CMD line for those rare occassions where the supervisor enters a restart loop. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
1597aeb895
commit
392c56b4d3
@ -72,4 +72,4 @@ HEALTHCHECK --interval=5m --start-period=1m --timeout=30s --retries=3 \
|
|||||||
|
|
||||||
RUN [ "cross-build-end" ]
|
RUN [ "cross-build-end" ]
|
||||||
|
|
||||||
CMD DEBUG=1 ./entry.sh
|
CMD DEBUG=1 ./entry.sh || while true; do echo 'Supervisor runtime exited - waiting for changes'; sleep 100; done;
|
||||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -6303,9 +6303,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"livepush": {
|
"livepush": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/livepush/-/livepush-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/livepush/-/livepush-1.2.4.tgz",
|
||||||
"integrity": "sha512-6BD16S8EtyVsNqI5PHI/MRiho1LhkYR9Gjy2AXWm3S/cssV0TlVJpyhz1nMWxCDGjbJAWjcYwbvSAeBua7RUhA==",
|
"integrity": "sha512-AKGlJ+QuelyDoOV0cbGfeskLf2RaYIcHnKogfircvTl9//BNDrGVhrcO6bN3kcVaJnYKnvXwXOtGOyrsl6wI9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bluebird": "^3.5.1",
|
"bluebird": "^3.5.1",
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
"json-mask": "^0.3.8",
|
"json-mask": "^0.3.8",
|
||||||
"knex": "~0.15.2",
|
"knex": "~0.15.2",
|
||||||
"lint-staged": "^8.1.0",
|
"lint-staged": "^8.1.0",
|
||||||
"livepush": "^1.2.1",
|
"livepush": "^1.2.4",
|
||||||
"lockfile": "^1.0.1",
|
"lockfile": "^1.0.1",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"log-timestamp": "^0.1.2",
|
"log-timestamp": "^0.1.2",
|
||||||
|
@ -50,9 +50,20 @@ function extractMessage(msgBuf) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let changedFiles = [];
|
||||||
|
let deletedFiles = [];
|
||||||
|
|
||||||
|
const performLivepush = _.debounce(async livepush => {
|
||||||
|
await livepush.performLivepush(changedFiles, deletedFiles);
|
||||||
|
changedFiles = [];
|
||||||
|
deletedFiles = [];
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
console.log('Starting up...');
|
||||||
// Get the supervisor container id
|
// Get the supervisor container id
|
||||||
const container = await docker.getContainer('resin_supervisor').inspect();
|
const container = await docker.getContainer('resin_supervisor').inspect();
|
||||||
|
console.log('Supervisor container id: ', container.Id);
|
||||||
const containerId = container.Id;
|
const containerId = container.Id;
|
||||||
const image = container.Image;
|
const image = container.Image;
|
||||||
|
|
||||||
@ -67,20 +78,22 @@ function extractMessage(msgBuf) {
|
|||||||
docker,
|
docker,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Debounce these calls
|
|
||||||
chokidar
|
chokidar
|
||||||
.watch('.', {
|
.watch('.', {
|
||||||
ignored: /((^|[\/\\])\..|node_modules.*)/,
|
ignored: /((^|[\/\\])\..|node_modules.*)/,
|
||||||
ignoreInitial: true,
|
ignoreInitial: false,
|
||||||
})
|
})
|
||||||
.on('add', path => {
|
.on('add', path => {
|
||||||
livepush.performLivepush([path], []);
|
changedFiles.push(path);
|
||||||
|
performLivepush(livepush);
|
||||||
})
|
})
|
||||||
.on('change', path => {
|
.on('change', path => {
|
||||||
livepush.performLivepush([path], []);
|
changedFiles.push(path);
|
||||||
|
performLivepush(livepush);
|
||||||
})
|
})
|
||||||
.on('unlink', path => {
|
.on('unlink', path => {
|
||||||
livepush.performLivepush([], [path]);
|
deletedFiles.push(path);
|
||||||
|
performLivepush(livepush);
|
||||||
});
|
});
|
||||||
|
|
||||||
livepush.on('commandExecute', ({ command }) => {
|
livepush.on('commandExecute', ({ command }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user