From 99bb365b499602d27e2fa81ba4e1b685e7c6bcc5 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Thu, 3 Dec 2015 23:29:14 +0900 Subject: [PATCH 1/5] Fixed #129 according to the @friism's comment --- commands/init.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/commands/init.js b/commands/init.js index 01b7bf8..1204992 100644 --- a/commands/init.js +++ b/commands/init.js @@ -140,9 +140,21 @@ function createDockerCompose(procfile, addons, mountDir) { } function addonToService(addon) { - return { - image: ADDONS[addon].image - }; + var service = {} + + // fallback for backward compatibility + if ((typeof ADDONS[addon].image) === 'string') { + service.image = ADDONS[addon].image; + } else { + service.image = ADDONS[addon].image.name; + + // All the other properties except `image` are optional. + if ('env' in ADDONS[addon].image) { + service.environment = ADDONS[addon].image.env; + } + } + + return service; } } From f797ee932d0b804eda46349881c97bd72417f85d Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Thu, 3 Dec 2015 23:35:33 +0900 Subject: [PATCH 2/5] Added support for `cleardb` again, fixing #130 --- lib/addons.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/addons.js b/lib/addons.js index ec1951e..6ce0c72 100644 --- a/lib/addons.js +++ b/lib/addons.js @@ -18,5 +18,15 @@ module.exports = { 'memcachedcloud': { image: 'memcached', env: { 'MEMCACHEDCLOUD_SERVERS': 'memcachedcloud:11211' } + }, + 'cleardb': { + image: { + name: 'mysql', + env: { + 'MYSQL_DATABASE': 'cleardb', + 'MYSQL_ALLOW_EMPTY_PASSWORD': 'yes' + } + }, + env: { 'CLEARDB_DATABASE_URL': 'mysql://root:@cleardb:3306/cleardb' } } }; From ad04a6a754c1a9681e423a3316b9d62bb36661b3 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Thu, 3 Dec 2015 23:37:08 +0900 Subject: [PATCH 3/5] Added support for `GrapheneDB` addon --- lib/addons.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/addons.js b/lib/addons.js index 6ce0c72..6028d45 100644 --- a/lib/addons.js +++ b/lib/addons.js @@ -28,5 +28,12 @@ module.exports = { } }, env: { 'CLEARDB_DATABASE_URL': 'mysql://root:@cleardb:3306/cleardb' } + }, + 'graphenedb': { + image: { + name: 'neo4j', + env: { 'NEO4J_AUTH': 'none' } + }, + env: { 'GRAPHENEDB_URL': 'http://graphenedb:7474/db/data' } } }; From 36ee3dfaddddc9cafea59eb8fa718892021eff21 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Thu, 3 Dec 2015 23:38:41 +0900 Subject: [PATCH 4/5] Fixed incorrect path for addon mappings in README --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 751728e..82e7c89 100644 --- a/readme.md +++ b/readme.md @@ -49,5 +49,5 @@ $ 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\app.json`. +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 currently includes a limited subset of add-ons that we have tested. We welcome additions in the form of PRs. From 627d7d43e8886e37525f5bf68e8f249e82f32da6 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Thu, 3 Dec 2015 23:50:38 +0900 Subject: [PATCH 5/5] Added a missing trailing semicolon (minor) --- commands/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/init.js b/commands/init.js index 1204992..fd287e1 100644 --- a/commands/init.js +++ b/commands/init.js @@ -140,7 +140,7 @@ function createDockerCompose(procfile, addons, mountDir) { } function addonToService(addon) { - var service = {} + var service = {}; // fallback for backward compatibility if ((typeof ADDONS[addon].image) === 'string') {