Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/postgres parameterisation #89

Merged
merged 2 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ data
docker-compose.override.yml
tagpack-repos*.config

postgres-conf.sql

# Temporary and binary files
*~
*.py[cod]
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,26 @@ Fetch and show concepts of a specific remote/local taxonomy (referenced by key:
- [Docker][docker], see e.g. https://docs.docker.com/engine/install/
- Docker Compose: https://docs.docker.com/compose/install/

Setup and start a PostgreSQL instance. First, copy `docker/env.template`
First, copy `docker/env.template`
to `.env` and fill the fields `POSTGRES_PASSWORD` and `POSTGRES_PASSWORD_TAGSTORE`.

Run

cp docker/postgres-conf.sql.template postgres-conf.sql

and modify the configuration parameters to your requirements. If no special config is needed an emtpy file is also valid.

touch postgres-conf.sql

Start a PostgreSQL instance using Docker Compose:

docker-compose up -d

This will automatically create the database schema as defined
in `src/tagpack/db/tagstore_schema.sql`.



#### Option 2: Use an existing PostgreSQL database

Create the schema and tables in a PostgreSQL instance of your choice
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
volumes:
- "$LOCAL_DATA_DIR:/var/lib/postgresql/data"
- ./src/tagpack/db/tagstore_schema.sql:/tmp/schema.sql
- ./postgres-conf.sql:/tmp/postgres-conf.sql
- ./docker/init.sh:/docker-entrypoint-initdb.d/init.sh
ports:
- 5432:5432
Expand Down
3 changes: 3 additions & 0 deletions docker/init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# apply custom settings
psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -f /tmp/postgres-conf.sql

# create schema
psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -f /tmp/schema.sql
# create user
Expand Down
3 changes: 3 additions & 0 deletions docker/postgres-conf.sql.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- ALTER SYSTEM SET shared_buffers = '2GB';
-- ALTER SYSTEM SET wal_buffers = '16MB';
-- ALTER SYSTEM SET max_parallel_workers = 20;