simplify postgres installs

This commit is contained in:
Ed Chalstrey 2022-02-11 15:16:34 +00:00
parent b96e2399cd
commit 1f417ecb7d

View File

@ -2,22 +2,15 @@
apt-get update -y apt-get update -y
apt-get upgrade -y apt-get upgrade -y
service postgresql start
apt-get install -y postgresql-contrib libpq-dev postgis apt-get install -y postgresql-contrib libpq-dev postgis
apt-get install -y postgresql-13-postgis-3 apt-get install -y postgresql-13-postgis-3
apt-get install -y gdal-bin libspatialindex-dev libgeos-dev libproj-dev apt-get install -y gdal-bin libspatialindex-dev libgeos-dev libproj-dev
apt-get install -y python3 python3-pip python3-dev python3-venv apt-get install -y python3 python3-pip python3-dev python3-venv
sed -i "s/#\?listen_address.*/listen_addresses '*'/" /etc/postgresql/13/main/postgresql.conf
echo "host all all all md5" | tee --append /etc/postgresql/13/main/pg_hba.conf > /dev/null
service postgresql restart
psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_user WHERE usename = 'dockeruser';" | grep -q 1 || psql -d colouringlondon -U dockeruser -c "CREATE ROLE dockeruser SUPERUSER LOGIN PASSWORD 'postgres';" psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_user WHERE usename = 'dockeruser';" | grep -q 1 || psql -d colouringlondon -U dockeruser -c "CREATE ROLE dockeruser SUPERUSER LOGIN PASSWORD 'postgres';"
psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_database WHERE datname = 'colouringlondon';" | grep -q 1 || -u postgres createdb -E UTF8 -T template0 --locale=en_US.utf8 -O dockeruser colouringlondon psql -d colouringlondon -U dockeruser -c "SELECT 1 FROM pg_database WHERE datname = 'colouringlondon';" | grep -q 1 || -u postgres createdb -E UTF8 -T template0 --locale=en_US.utf8 -O dockeruser colouringlondon
# psql -d colouringlondon -U dockeruser -h localhost
psql -d colouringlondon -c "create extension postgis;" psql -d colouringlondon -c "create extension postgis;"
psql -d colouringlondon -c "create extension pgcrypto;" psql -d colouringlondon -c "create extension pgcrypto;"
psql -d colouringlondon -c "create extension pg_trgm;" psql -d colouringlondon -c "create extension pg_trgm;"