Skip to content

Instantly share code, notes, and snippets.

@josephglanville
Forked from lmars/commands.txt
Last active August 28, 2015 21:18
Show Gist options
  • Save josephglanville/7b963de18f88882e75c4 to your computer and use it in GitHub Desktop.
Save josephglanville/7b963de18f88882e75c4 to your computer and use it in GitHub Desktop.
Flynn Dedicated Postgres
# create new app as your custom postgres provider
flynn create --remote "" custompg
# create a release using the latest postgresql image from /etc/flynn/bootstrap-manifest.json
flynn -a custompg release add -t docker -f config.json "https://dl.flynn.io/tuf?name=flynn/postgresql&id=30f08003a029c5d5958263bf923d0377c958b313d417ba49489ff9c5940a388b"
# modify the app deployment strategy to "postgres"
flynn -a controller pg psql <<< "UPDATE apps SET strategy = 'postgres' WHERE name = 'custompg';"
# scale postgres and web to 3 and 2 processes respectively
flynn -a custompg scale postgres=3 web=2
# add custompg as a new provider
flynn provider add custompg http://custompg-api.discoverd/databases
# you can now add resources from custompg to your applications
flynn resource add custompg
# Notes:
# When doing this in production you probably want to set the PGPASSWORD env var to something random
# If you want to create single node clusters you need to set SINGLETON = true
{
"env": {
"PGPASSWORD": "pgpass",
"FLYNN_POSTGRES": "custompg"
},
"processes": {
"postgres": {
"ports": [{ "port": 5432, "proto": "tcp" }],
"data": true,
"cmd": ["postgres"],
"service": "postgres",
"env": { "SINGLETON": "false" }
},
"web": {
"ports": [{ "port": 80, "proto": "tcp" }],
"cmd": ["api"]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment