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 purge -yq postgresql*
|
2022-11-24 13:36:56 +03:00
|
|
|
sudo apt install curl ca-certificates gnupg
|
|
|
|
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
|
|
|
|
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
2021-04-14 17:19:49 +03:00
|
|
|
sudo apt-get update -qq
|
|
|
|
|
2020-12-12 16:50:07 +03:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Install PostgreSQL
|
2020-11-16 12:14:38 +03:00
|
|
|
run: |
|
2022-05-10 16:52:15 +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}
|
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
|