diff --git a/.gitignore b/.gitignore index fd4f2b0..825fc67 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +npm-debug.log diff --git a/Makefile b/Makefile index 4aa78fb..8c3d259 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ link: heroku plugins:link "$(shell pwd)" unlink: - heroku plugins:uninstall heroku-docker + heroku plugins:uninstall heroku-container-tools patch: npm version patch diff --git a/readme.md b/README.md similarity index 64% rename from readme.md rename to README.md index 82e7c89..f17bbf3 100644 --- a/readme.md +++ b/README.md @@ -1,11 +1,11 @@ -# Heroku Docker CLI plugin +# Heroku Container Tools CLI plugin -Heroku Toolbelt plugin to help configure, test and release apps to Heroku using Docker and Docker Compose. +Heroku Toolbelt plugin to help configure, test and release apps to Heroku using local containers. ## Installation ``` -$ heroku plugins:install heroku-docker +$ heroku plugins:install heroku-container-tools ``` ## Use @@ -13,22 +13,22 @@ $ heroku plugins:install heroku-docker See the [Dev Center Documentation](https://devcenter.heroku.com/articles/introduction-local-development-with-docker) for details of use. ``` -$ heroku help docker -Usage: heroku docker +$ heroku help container +Usage: heroku container - Use Docker to build and deploy Heroku apps + Use containers to build and deploy Heroku apps Additional commands, type "heroku help COMMAND" for more details: - docker:init # create Dockerfile and docker-compose.yml - docker:release # create and release slug to app + container:init # create Dockerfile and docker-compose.yml + container:release # create and release slug to app ``` For help with a particular command: ``` -$ heroku help docker:init -Usage: heroku docker:init +$ heroku help container:init +Usage: heroku container:init -i, --image IMAGE # the Docker image from which to inherit -f, --force # overwrite existing Dockerfile and docker-compose.yml @@ -41,13 +41,13 @@ Usage: heroku docker:init Checkout the plugin source code and tell the Heroku CLI to use your local version of the plugin (instead of the default one distributed with NPM). ``` -$ git clone https://github.com/heroku/heroku-docker.git -$ cd heroku-docker +$ git clone https://github.com/heroku/heroku-container-tools.git +$ cd heroku-container-tools $ npm install $ heroku plugins:link . ``` ### Add-ons -The mapping from Heroku add-on specified in `app.json` to container configured in `docker-composer.yml` is tracked in `lib\addons.js`. +The mapping from Heroku add-on specified in `app.json` to container configured in `docker-compose.yml` is tracked in `lib\addons.js`. The mapping currently includes a limited subset of add-ons that we have tested. We welcome additions in the form of PRs. diff --git a/commands/login.js b/commands/login.js index 6ba581b..236e321 100644 --- a/commands/login.js +++ b/commands/login.js @@ -8,6 +8,7 @@ module.exports = function(topic) { return { topic: topic, command: 'login', + flags: [{ name: 'verbose', char: 'v', hasValue: false }], description: 'Logs in to the Heroku Docker registry', needsApp: false, needsAuth: true, @@ -21,14 +22,14 @@ function* login(context, heroku) { let password = context.auth.password; try { - let user = yield dockerLogin(registry, password); + let user = yield dockerLogin(registry, password, context.flags.verbose); } catch (err) { cli.error(`Error: docker login exited with ${ err }`); } } -function dockerLogin(registry, password) { +function dockerLogin(registry, password, verbose) { return new Promise((resolve, reject) => { let args = [ 'login', @@ -37,6 +38,9 @@ function dockerLogin(registry, password) { `--password=${ password }`, registry ]; + if (verbose) { + console.log(['> docker'].concat(args).join(' ')); + } child.spawn('docker', args, { stdio: 'inherit' }) .on('exit', (code, signal) => { if (signal || code) reject(signal || code); diff --git a/commands/push.js b/commands/push.js index edd5f5a..e816541 100644 --- a/commands/push.js +++ b/commands/push.js @@ -12,6 +12,7 @@ module.exports = function(topic) { needsApp: true, needsAuth: true, args: [{ name: 'process', optional: true }], + flags: [{ name: 'verbose', char: 'v', hasValue: false }], run: cli.command(co.wrap(push)) }; }; @@ -23,7 +24,7 @@ function* push(context, heroku) { let resource = `${ registry }/${ context.app }/${ proc }`; try { - let build = yield buildImage(resource, context.cwd); + let build = yield buildImage(resource, context.cwd, context.flags.verbose); } catch (err) { cli.error(`Error: docker build exited with ${ err }`); @@ -31,7 +32,7 @@ function* push(context, heroku) { } try { - let push = yield pushImage(resource); + let push = yield pushImage(resource, context.flags.verbose); } catch (err) { cli.error(`Error: docker push exited with ${ err }`); @@ -39,7 +40,7 @@ function* push(context, heroku) { } } -function buildImage(resource, cwd) { +function buildImage(resource, cwd, verbose) { return new Promise((resolve, reject) => { let args = [ 'build', @@ -47,6 +48,9 @@ function buildImage(resource, cwd) { resource, cwd ]; + if (verbose) { + console.log(['> docker'].concat(args).join(' ')); + } child.spawn('docker', args, { stdio: 'inherit' }) .on('exit', (code, signal) => { if (signal || code) reject(signal || code); @@ -55,12 +59,15 @@ function buildImage(resource, cwd) { }); } -function pushImage(resource) { +function pushImage(resource, verbose) { return new Promise((resolve, reject) => { let args = [ 'push', resource ]; + if (verbose) { + console.log(['> docker'].concat(args).join(' ')); + } child.spawn('docker', args, { stdio: 'inherit' }) .on('exit', (code, signal) => { if (signal || code) reject(signal || code); diff --git a/commands/release.js b/commands/release.js index 4d4b20e..bfa0add 100644 --- a/commands/release.js +++ b/commands/release.js @@ -139,7 +139,7 @@ function release(context) { } function createRemoteSlug(slug) { - var lang = `heroku-docker (${ slug.name || 'unknown'})`; + var lang = `heroku-container-tools (${ slug.name || 'unknown'})`; cli.log(`creating remote slug...`); cli.log(`language-pack: ${ lang }`); cli.log('remote process types:', modifiedProc); @@ -190,7 +190,7 @@ function release(context) { method: 'POST', path: `${ app.path }/releases`, headers: { - 'Heroku-Deploy-Type': 'heroku-docker' + 'Heroku-Deploy-Type': 'heroku-container-tools' }, body: { slug: id diff --git a/contributing.md b/contributing.md index 1d6c53a..955424b 100644 --- a/contributing.md +++ b/contributing.md @@ -1,8 +1,8 @@ # Contributing You want to add new language support? Awesome! -Figured out a way to seamlessly integrate with docker-compose and addons? Even better! -We're in the very early stages of exploring the possibilities of Docker + Heroku, +Figured out a way to seamlessly integrate with heroku-container-tools and addons? Even better! +We're in the very early stages of exploring the possibilities of 3rd party containers on Heroku, so all ideas are welcome. The simplest way to get started is to clone the repo and symlink it to your @@ -16,7 +16,7 @@ When you'd like to go back to using the official release: ``` make unlink -heroku plugins:install heroku-docker +heroku plugins:install heroku-container-tools ``` While developing, you can run the basic test suite: @@ -65,7 +65,7 @@ The best way to start is by checking out the ## Documentation Once you've got a working platform, be sure to document how to use it -with at least one example. One of the coolest parts about this Docker +with at least one example. One of the coolest parts about this container workflow is how easy it is to get started quickly. Since all dependencies are self-contained, you should be able to create a hello-world type example that doesn't require the user to install anything new. diff --git a/index.js b/index.js index a8a0ab0..d87e018 100644 --- a/index.js +++ b/index.js @@ -3,9 +3,9 @@ var pkg = require('./package.json'); module.exports = { commands: [ require('./commands/index')(pkg), - require('./commands/init')(pkg.topic), - require('./commands/release')(pkg.topic), require('./commands/login')(pkg.topic), - require('./commands/push')(pkg.topic) + require('./commands/push')(pkg.topic), + require('./commands/init')(pkg.topic), + require('./commands/release')(pkg.topic) ] }; diff --git a/package.json b/package.json index a2eb828..6a6c16b 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,16 @@ { - "name": "heroku-docker", - "version": "2.0.0", - "topic": "docker", - "description": "Use Docker to build and deploy Heroku apps", + "name": "heroku-container-tools", + "version": "4.0.0", + "topic": "container", + "description": "Use containers to build and deploy Heroku apps", "main": "index.js", - "repository": "https://github.com/heroku/heroku-docker", + "repository": "https://github.com/heroku/heroku-container-tools", "scripts": { "test": "mocha", "depcheck": "depcheck || true" }, "keywords": [ "heroku", - "docker", "cli", "heroku-plugin" ],