2020-10-28 13:10:14 +03:00
|
|
|
name: 'Setup Postgresql and Postgis'
|
|
|
|
|
2020-12-12 16:50:07 +03:00
|
|
|
inputs:
|
|
|
|
postgresql-version:
|
|
|
|
description: 'Version of PostgreSQL to install'
|
|
|
|
required: true
|
|
|
|
postgis-version:
|
|
|
|
description: 'Version of Postgis to install'
|
|
|
|
required: true
|
|
|
|
|
2020-10-28 13:10:14 +03:00
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
|
|
|
|
steps:
|
2020-12-12 16:50:07 +03:00
|
|
|
- name: Remove existing PostgreSQL
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get purge -yq postgresql*
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Install PostgreSQL
|
2020-11-16 12:14:38 +03:00
|
|
|
run: |
|
2020-12-12 16:50:07 +03:00
|
|
|
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}
|
2020-10-28 13:10:14 +03:00
|
|
|
shell: bash
|
2020-12-12 16:50:07 +03:00
|
|
|
env:
|
|
|
|
PGVER: ${{ inputs.postgresql-version }}
|
|
|
|
POSTGISVER: ${{ inputs.postgis-version }}
|
2020-10-28 13:10:14 +03:00
|
|
|
|
|
|
|
- name: Adapt postgresql configuration
|
|
|
|
run: |
|
2020-12-12 16:50:07 +03:00
|
|
|
echo 'fsync = off' | sudo tee /etc/postgresql/${PGVER}/main/conf.d/local.conf
|
|
|
|
echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
|
|
|
|
echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
|
|
|
|
echo 'shared_buffers = 1GB' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
|
|
|
|
echo 'port = 5432' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
|
2020-10-28 13:10:14 +03:00
|
|
|
shell: bash
|
2020-12-12 16:50:07 +03:00
|
|
|
env:
|
|
|
|
PGVER: ${{ inputs.postgresql-version }}
|
2020-10-28 13:10:14 +03:00
|
|
|
|
|
|
|
- name: Setup database
|
|
|
|
run: |
|
2020-12-12 16:50:07 +03:00
|
|
|
sudo systemctl restart postgresql
|
2020-10-28 13:10:14 +03:00
|
|
|
sudo -u postgres createuser -S www-data
|
|
|
|
sudo -u postgres createuser -s runner
|
|
|
|
shell: bash
|