ADD postgres.template.yml /pups/postgres.yml
RUN LANG=en_US.UTF-8 /pups/bin/pups /pups/postgres.yml
+# add dev databases
+ADD postgres_dev.template.yml /pups/postgres_dev.yml
+RUN /pups/bin/pups /pups/postgres_dev.yml
+
# move default postgres_data out of the way
RUN mv /shared/postgres_data /shared/postgres_data_orig
chown -R postgres:postgres /shared/postgres_data
chmod 700 /shared/postgres_data
cp -R /shared/postgres_data_orig/* /shared/postgres_data
+ chown -R postgres:postgres /shared/postgres_data
+ chmod 700 /shared/postgres_data
fi
--- /dev/null
+run:
+ - exec:
+ background: true
+ # use fast shutdown for pg
+ stop_signal: INT
+ cmd: HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main
+
+ - exec:
+ background: true
+ cmd: exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
+
+ # give db a few secs to start up
+ - exec: "sleep 5"
+
+ - exec: su postgres -c 'createdb discourse_development' || true
+ - exec: su postgres -c 'psql discourse_development -c "grant all privileges on database discourse_development to discourse;"' || true
+ - exec: su postgres -c 'psql discourse_development -c "alter schema public owner to discourse;"'
+ - exec: su postgres -c 'psql discourse_development -c "create extension if not exists hstore;"'
+ - exec: su postgres -c 'psql discourse_development -c "create extension if not exists pg_trgm;"'
+
+ - exec: su postgres -c 'createdb discourse_test' || true
+ - exec: su postgres -c 'psql discourse_test -c "grant all privileges on database discourse_test to discourse;"' || true
+ - exec: su postgres -c 'psql discourse_test -c "alter schema public owner to discourse;"'
+ - exec: su postgres -c 'psql discourse_test -c "create extension if not exists hstore;"'
+ - exec: su postgres -c 'psql discourse_test -c "create extension if not exists pg_trgm;"'
+ - exec: cd tmp && git clone https://github.com/discourse/discourse.git --depth=1 && cd /tmp/discourse && sudo -u discourse bundle install
+ - exec: chown -R discourse /tmp/discourse
+ - exec: cd /tmp/discourse && sudo -u discourse bundle exec rake db:migrate
+ - exec: rm -fr /tmp/discourse