Browse files

Remove db container, comments to use standard image

  • Loading branch information...
1 parent ce1253b commit 5ff615041427592aa4cf02751db7cac658fd05fc Gerry Gleason committed Jun 30, 2015
Showing with 18 additions and 53 deletions.
  1. +18 −5 docker/README
  2. +0 −9 docker/db/Dockerfile
  3. +0 −30 docker/db/init
  4. +0 −9 docker/db/template_uuen.sql
@@ -1,16 +1,20 @@
In this directory are docker resources to run the wagn app.
-db: Describes the database image, it will be moved and registered on its own, for now tag this image:
- docker tag <imageid> db_image
-wagn: Dockerized wagn application, for now this is a development setup, production later. Includes:
+Dockerized wagn application, for now this is a development setup, production later. Includes:
passenger, ruby 2.2.0 and nginx (phusion/passenger-ruby22)
These commands should result in two locally running development containers:
-docker run -p 5432 -d --name=wagn_db db_image wagn28_devPw wagn
-docker run -p 80 -p 443 -d --link=wagn_db:db --name=wagnapp wagn_image /sbin/my_init
+# you can use a database run from the standard postgres container like this:
+docker pull postges
+docker run --name wagn_db --env POSTGRES_PASSWORD=cds94_devPw --env POSTGRES_USER=cds -d postgres
+docker pull gerry/wagn:latest
+# then run wagn:
+docker run -p 80 -p 443 -d --link=wagn_db:db --name=wagnapp gerry/wagn /sbin/my_init
+# and seed it:
docker exec -ti wagnapp su - app sh -c 'cd wagnapp; wagn seed -d'
The database password above is in the image, to use a different one, replace the password when running the
@@ -24,3 +28,12 @@ wget
The container uses runit, so status/restart nginx with sv command:
docker exec -ti wagnapp sv restart nginx
+Postgres client in the container:
+docker exec -ti wagn_db su - postgres sh -c 'psql'
+Save an image with the seeded database:
+docker commit wagn_db
+docker tag <image tag output above> wagn_db_seeded
+export/import data commands
@@ -1,9 +0,0 @@
-FROM jpetazzo/pgsql
-MAINTAINER Gerry Gleason (
-ADD init /init
-# /init will run this and remove it when initializing
-ADD template_uuen.sql /tmp/script/
-ENTRYPOINT ["/init"]
-CMD ["a_password"]
@@ -1,30 +0,0 @@
-# customize postgres startup here
-# Synopsis: /init secret [username]
-# or starting current state: /init
-if [ "$#" -ge 1 ]; then
-if [ "$#" -ge 2 ]; then
-elif [ "$#" -eq 1 ]; then
- DBUSER=root
-echo 'host all all md5' >> /etc/postgresql/9.1/main/pg_hba.conf
-# start the server (background it)
-su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf -c listen_addresses=*" &
-sleep 10 # make sure it is all the way up
-# run on db create and remove
-if [ -n "${SECRET}" -a -f ${UUE_SCRIPT} ]; then
- # create rails user
- echo "CREATE USER ${DBUSER} WITH CREATEDB SUPERUSER PASSWORD '${SECRET}'; create database ${DBUSER};" | su postgres sh -c psql 2>&1 | tee /tmp/createdbuser.out
- su postgres bash -c "psql < ${UUE_SCRIPT}"
- rm ${UUE_SCRIPT}
-wait # for postgres to stop, without this, the start-up command ends and stops the container.
@@ -1,9 +0,0 @@
-update pg_database set datallowconn = TRUE where datname = 'template0';
-\c template0
-update pg_database set datistemplate = FALSE where datname = 'template1';
-drop database template1;
-create database template1 with template = template0 encoding = 'UTF8';
-update pg_database set datistemplate = TRUE where datname = 'template1';
-\c template1
-update pg_database set datallowconn = FALSE where datname = 'template0';

0 comments on commit 5ff6150

Please sign in to comment.