1 name: 'Setup Postgresql and Postgis'
5 description: 'Version of PostgreSQL to install'
8 description: 'Version of Postgis to install'
15 - name: Remove existing PostgreSQL
17 sudo apt-get update -qq
18 sudo apt-get purge -yq postgresql*
21 - name: Install PostgreSQL
23 sudo apt-get install -y -qq --no-install-suggests --no-install-recommends postgresql-client-${PGVER} postgresql-${PGVER}-postgis-${POSTGISVER} postgresql-${PGVER}-postgis-${POSTGISVER}-scripts postgresql-contrib-${PGVER} postgresql-${PGVER} postgresql-server-dev-${PGVER}
26 PGVER: ${{ inputs.postgresql-version }}
27 POSTGISVER: ${{ inputs.postgis-version }}
29 - name: Adapt postgresql configuration
31 echo 'fsync = off' | sudo tee /etc/postgresql/${PGVER}/main/conf.d/local.conf
32 echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
33 echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
34 echo 'shared_buffers = 1GB' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
35 echo 'port = 5432' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
38 PGVER: ${{ inputs.postgresql-version }}
40 - name: Setup database
42 sudo systemctl restart postgresql
43 sudo -u postgres createuser -S www-data
44 sudo -u postgres createuser -s runner