]> git.openstreetmap.org Git - nominatim.git/blob - .github/actions/setup-postgresql/action.yml
Merge pull request #3652 from lonvia/update-variants
[nominatim.git] / .github / actions / setup-postgresql / action.yml
1 name: 'Setup Postgresql and Postgis'
2
3 inputs:
4     postgresql-version:
5         description: 'Version of PostgreSQL to install'
6         required: true
7
8 runs:
9     using: "composite"
10
11     steps:
12         - name: Remove existing PostgreSQL
13           run: |
14               sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
15               sudo apt-get purge -yq postgresql*
16               sudo apt-get update -qq
17
18           shell: bash
19
20         - name: Install PostgreSQL
21           run: |
22               sudo apt-get install -y -qq --no-install-suggests --no-install-recommends postgresql-client-${PGVER} postgresql-${PGVER}-postgis-3 postgresql-${PGVER}-postgis-3-scripts postgresql-contrib-${PGVER} postgresql-${PGVER}
23           shell: bash
24           env:
25               PGVER: ${{ inputs.postgresql-version }}
26
27         - name: Adapt postgresql configuration
28           run: |
29               echo 'fsync = off' | sudo tee /etc/postgresql/${PGVER}/main/conf.d/local.conf
30               echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
31               echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
32               echo 'shared_buffers = 1GB' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
33               echo 'port = 5432' | sudo tee -a /etc/postgresql/${PGVER}/main/conf.d/local.conf
34           shell: bash
35           env:
36               PGVER: ${{ inputs.postgresql-version }}
37
38         - name: Setup database
39           run: |
40               sudo systemctl restart postgresql
41               sudo -u postgres createuser -S www-data
42               sudo -u postgres createuser -s runner
43           shell: bash