Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Added support for ClearDB and GrapheneDB addons #137

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
18 changes: 15 additions & 3 deletions commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
17 changes: 17 additions & 0 deletions lib/addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
};