From f7e3b7350e1d83ac288ef7b745ef96bbfa389355 Mon Sep 17 00:00:00 2001 From: adrian Date: Tue, 2 Sep 2025 11:03:52 +0200 Subject: [PATCH] feat: add docker-compose.yaml to set up postgres --- protocol-testing/docker-compose.yaml | 17 +++++++++++++++++ protocol-testing/postgres.Dockerfile | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 protocol-testing/docker-compose.yaml create mode 100644 protocol-testing/postgres.Dockerfile diff --git a/protocol-testing/docker-compose.yaml b/protocol-testing/docker-compose.yaml new file mode 100644 index 0000000..0a3c3c5 --- /dev/null +++ b/protocol-testing/docker-compose.yaml @@ -0,0 +1,17 @@ +version: "3.1" +services: + db: + build: + context: . + dockerfile: postgres.Dockerfile + restart: "always" + environment: + POSTGRESQL_PASSWORD: mypassword + POSTGRESQL_DATABASE: tycho_indexer_0 + POSTGRESQL_USERNAME: postgres + POSTGRESQL_SHARED_PRELOAD_LIBRARIES: pg_cron + ports: + - "5431:5432" + shm_size: "1gb" +volumes: + postgres_data: diff --git a/protocol-testing/postgres.Dockerfile b/protocol-testing/postgres.Dockerfile new file mode 100644 index 0000000..c9301d6 --- /dev/null +++ b/protocol-testing/postgres.Dockerfile @@ -0,0 +1,18 @@ +# This Dockerfile creates a custom postgres image used for CI and local deployment. +# This is required because we use some postgres extensions that aren't in the generic +# Postgres image such as pg_partman or pg_cron. + +# As an image with pg_partman already exist, we start from this one and add pg_cron +# and possibly other extensions on top of that. +FROM ghcr.io/dbsystel/postgresql-partman:15-5 +ARG PGCRON_VERSION="1.6.2" +USER root +RUN cd /tmp \ + && wget "https://github.com/citusdata/pg_cron/archive/refs/tags/v${PGCRON_VERSION}.tar.gz" \ + && tar zxf v${PGCRON_VERSION}.tar.gz \ + && cd pg_cron-${PGCRON_VERSION} \ + && make \ + && make install \ + && cd .. && rm -r pg_cron-${PGCRON_VERSION} v${PGCRON_VERSION}.tar.gz +RUN echo "cron.database_name = 'tycho_indexer_0'" >> /opt/bitnami/postgresql/conf/postgresql.conf +USER 1001 \ No newline at end of file