Skip to content

Instantly share code, notes, and snippets.

@lmars
Created March 14, 2015 16:37
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lmars/8be1952a8d03f8a31b17 to your computer and use it in GitHub Desktop.
Save lmars/8be1952a8d03f8a31b17 to your computer and use it in GitHub Desktop.
Flynn MongoDB
# create a mongo app
flynn create --remote "" mongo
# create a release using the latest (at the time of writing) Docker MongoDB image
flynn -a mongo release add -f config.json "https://registry.hub.docker.com?name=mongo&id=216d9a0e82646f77b31b78eeb0e26db5500930bbd6085d5d5c3844ec27c0ca50"
# scale the server to one process. This may time out initially as the server pulls the image, but watch "flynn -a mongo ps" and it should come up.
flynn -a mongo scale server=1
# mongo should now be running in the cluster at mongo.discoverd:27017
flynn -a mongo run mongo --host mongo.discoverd --port 27017
> db.hostInfo().ok
1
# note that the container does not have a data volume, so restarting the container will get a new data directory. This will be fixed when we have a MongoDB appliance within Flynn.
{
"processes": {
"server": {
"cmd": ["mongod"],
"ports": [{
"port": 27017,
"proto": "tcp",
"service": {
"name": "mongo",
"create": true,
"check": { "type": "tcp" }
}
}]
}
}
}
@aeneasr
Copy link

aeneasr commented Jun 5, 2015

To run mongodb < 3.0 change

"cmd": ["mongod"],

to

"cmd": ["sh", "-c", "mkdir /data/db && mongod"],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment