I want to increase max_connections in github action Postgres service. Official document doesn't mention how to do so. Is there some clever hacks?
I tried this SO answers, which don't seem to work in github action environment.
I want to increase max_connections in github action Postgres service. Official document doesn't mention how to do so. Is there some clever hacks?
I tried this SO answers, which don't seem to work in github action environment.
There is a straightforward way to do it, but you can achieve it by installing the pg client and configuration the container when the service starts. The exact steps are documented in this blog post.
The relevant code:
steps:
- name: Install postgresql-client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: Connect to PostgreSQL with CLI
run: psql -c 'SELECT VERSION();'
- name: Show PostgreSQL config file
run: psql -c 'SHOW config_file;'
- name: Alter max connections
run: |
docker exec -i postgres bash << EOF
sed -i -e 's/max_connections = 100/max_connections = 1000/' /var/lib/postgresql/data/postgresql.conf
sed -i -e 's/shared_buffers = 128MB/shared_buffers = 2GB/' /var/lib/postgresql/data/postgresql.conf
EOF
docker restart --time 0 postgres
sleep 5
- name: Show max connections
run: psql -c 'SHOW max_connections;'
As there isn't an option to set a custom command for Docker services, this remains the most straightforward way of doing it.
max_connectionsin github action postgres service?