Using Postgres 9.4 on Ubuntu 14.04 Image


#1

How do I go about using Postgres 9.4 in our 14.04 build container?

Thanks,
Olja


#2

Adding the following to the pre sections seems to work:
- sudo service postgresql stop && sudo apt-get remove -y postgresql-9.5 && sudo apt-get install -y postgresql-9.4 postgresql-contrib-9.4
- sudo service postgresql stop 9.6
- sudo sed -i “s/port = …/port = 5432/g” /etc/postgresql/9.4/main/postgresql.conf
- sudo cp -v /etc/postgresql/9.{6,5}/main/pg_hba.conf && sudo service postgresql restart 9.4
- sudo su - postgres -c “echo “create user ubuntu with password ‘ubuntu’;” | psql”
- sudo su - postgres -c “echo “create database ubuntu;” | psql”
- sudo su - postgres -c “echo “create database circle_test;” | psql”
- sudo su - postgres -c “echo “grant all privileges on database ubuntu to ubuntu;” | psql”
- sudo su - postgres -c “echo “grant all privileges on circle_test ubuntu to ubuntu;” | psql”

It adds about 30 seconds to an otherwise long build. Are there more efficient ways of doing the above?

Thanks!


#3