diff --git a/README.md b/README.md index a4cc32e..f17bbf3 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-compose.yml` is tracked in `lib\app.json`. +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/init.js b/commands/init.js index 01b7bf8..fd287e1 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; } } diff --git a/lib/addons.js b/lib/addons.js index ec1951e..6028d45 100644 --- a/lib/addons.js +++ b/lib/addons.js @@ -18,5 +18,22 @@ 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' } + }, + 'graphenedb': { + image: { + name: 'neo4j', + env: { 'NEO4J_AUTH': 'none' } + }, + env: { 'GRAPHENEDB_URL': 'http://graphenedb:7474/db/data' } } };