adds postgresql support

This commit is contained in:
Sameer Naik
2017-01-16 10:24:51 +05:30
parent 7b43392e64
commit d2785a275b
2 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
version: '2'
services:
postgresql:
image: bitnami/postgresql:latest
environment:
- POSTGRESQL_DATABASE=my_app_development
myapp:
tty: true # Enables debugging capabilities when attached to this container.
image: bitnami/express:latest
environment:
- PORT=3000
- DATABASE_URL=postgres://postgres@postgresql/my_app_development
depends_on:
- postgresql
ports:
- 3000:3000
volumes:
- .:/app

View File

@@ -19,7 +19,7 @@ dependencies_up_to_date() {
}
database_tier_exists() {
[ -n "$(getent hosts mongodb mariadb)" ]
[ -n "$(getent hosts mongodb mariadb postgresql)" ]
}
__wait_for_db() {
@@ -50,6 +50,10 @@ wait_for_db() {
if getent hosts mariadb >/dev/null; then
__wait_for_db mariadb 3306
fi
if getent hosts postgresql >/dev/null; then
__wait_for_db postgresql 5432
fi
}
add_database_support() {
@@ -60,6 +64,10 @@ add_database_support() {
if getent hosts mariadb >/dev/null && ! npm ls mysql >/dev/null; then
npm install --save mysql
fi
if getent hosts postgresql >/dev/null && ! npm ls pg pg-hstore >/dev/null; then
npm install --save pg pg-hstore
fi
}
log () {