From 06ab86b5553d6f0afe341c22199a82c43dee5b09 Mon Sep 17 00:00:00 2001 From: Gabriel Csapo Date: Mon, 14 Aug 2017 23:39:40 -0700 Subject: [PATCH] gets status from container - be able to get container status by querying the container on the get call (add to decorator function) is now visible when running (deploy ls) as a status column --- CHANGELOG.md | 3 ++- TODO.md | 9 +++++++-- bin/deploy-list.js | 1 + lib/models/deployment.js | 11 +++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a66123..f5a0668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # UNRELEASED -- adds the ability to delete deployment and its assets +- adds the ability to delete deployment and its assets +- be able to get container status by querying the container on the get call (add to decorator function) is now visible when running (deploy ls) as a status column # 0.2.0 (08/14/2017) diff --git a/TODO.md b/TODO.md index 1952a95..7a2e560 100644 --- a/TODO.md +++ b/TODO.md @@ -1,12 +1,17 @@ +## Completed + - [x] be able to persist data - [x] Once there is a way to store metadata, have an in memory store of a proxy routing to deal with subrouting application. - [x] be able retrieve logs - [x] deal with shutting down - [x] deal with cleaning up old images - [x] store most recent tars and metadata somewhere to make sure when the service starts back up it will start those sub services also +- [x] be able to get container status by querying the container on the get call (add to decorator function) +- [x] be able to remove an instance and its data (purge) + +## Backlog + - [ ] have a pull command that retrieves the contents of a deployed instance -- [ ] be able to get container status by querying the container on the get call (add to decorator function) - [ ] add timing metrics to cli calls (maybe add just overall function call tracing) - [ ] add lamba functionality - [ ] add web gui -- [ ] be able to remove an instance and its data (purge) diff --git a/bin/deploy-list.js b/bin/deploy-list.js index e698ffe..7797b88 100644 --- a/bin/deploy-list.js +++ b/bin/deploy-list.js @@ -56,6 +56,7 @@ Async.waterfall([ table.cell('url', url); table.cell('age', moment(r.updated_at).fromNow()); table.cell('requests', r.requests); + table.cell('status', r.status); table.newRow(); }); table.sort('age|asc'); diff --git a/lib/models/deployment.js b/lib/models/deployment.js index f757a96..d13aabb 100644 --- a/lib/models/deployment.js +++ b/lib/models/deployment.js @@ -270,6 +270,17 @@ module.exports.decorate = decorate = function decorate(deployment) { ddeployment.requests = 0; callback(); }); + }, + function(callback) { + const container = docker.getContainer(deployment.id); + container.inspect((err, info) => { + if(err) { + ddeployment.status = 'error'; + } else { + ddeployment.status = info.State.Status; + } + callback(); + }); } ], (error) => { if(error) return reject(error);