From 4153fc8f89b0f0c67fdfa16239dc78b75b964271 Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 14 Dec 2023 22:03:53 +0100 Subject: [PATCH] feat: postgres central db --- .../custom/nginx/conf.d/pgadmin.conf | 16 ++++++++++++ .../custom/pgadmin/Dockerfile | 3 +++ .../custom/pgadmin/servers.json | 13 ++++++++++ .../docker-compose.database.yml | 26 +++++++++++++++++++ .../apoc/docker-compose.d/docker-compose.yml | 2 +- 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 servers/apoc/docker-compose.d/custom/nginx/conf.d/pgadmin.conf create mode 100644 servers/apoc/docker-compose.d/custom/pgadmin/Dockerfile create mode 100644 servers/apoc/docker-compose.d/custom/pgadmin/servers.json create mode 100644 servers/apoc/docker-compose.d/docker-compose.database.yml diff --git a/servers/apoc/docker-compose.d/custom/nginx/conf.d/pgadmin.conf b/servers/apoc/docker-compose.d/custom/nginx/conf.d/pgadmin.conf new file mode 100644 index 0000000..3ad3d47 --- /dev/null +++ b/servers/apoc/docker-compose.d/custom/nginx/conf.d/pgadmin.conf @@ -0,0 +1,16 @@ +server { + listen 80; + server_name pg.ixvd.net; + + # SSL is managed by certbot, no need for a ssl listen; it will be generated automagically! + + # default html page + location / { + proxy_pass http://pgadmin; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/servers/apoc/docker-compose.d/custom/pgadmin/Dockerfile b/servers/apoc/docker-compose.d/custom/pgadmin/Dockerfile new file mode 100644 index 0000000..c022846 --- /dev/null +++ b/servers/apoc/docker-compose.d/custom/pgadmin/Dockerfile @@ -0,0 +1,3 @@ +FROM dpage/pgadmin4 + +COPY servers.json /pgadmin4/servers.json \ No newline at end of file diff --git a/servers/apoc/docker-compose.d/custom/pgadmin/servers.json b/servers/apoc/docker-compose.d/custom/pgadmin/servers.json new file mode 100644 index 0000000..36d6e5d --- /dev/null +++ b/servers/apoc/docker-compose.d/custom/pgadmin/servers.json @@ -0,0 +1,13 @@ +{ + "Servers": { + "1": { + "Name": "IXVD Central Database", + "Group": "IXVD Databases", + "Port": 5432, + "Username": "postgres", + "Host": "postgres", + "SSLMode": "prefer", + "MaintenanceDB": "postgres" + } + } + } \ No newline at end of file diff --git a/servers/apoc/docker-compose.d/docker-compose.database.yml b/servers/apoc/docker-compose.d/docker-compose.database.yml new file mode 100644 index 0000000..5fa8a50 --- /dev/null +++ b/servers/apoc/docker-compose.d/docker-compose.database.yml @@ -0,0 +1,26 @@ +version: '2.2' + +services: + postgres: + image: postgres:15 + container_name: postgres + restart: always + ports: + - "5432:5432" + env_file: + - /etc/ixvd/secrets/env/postgres.env + volumes: + - /srv/postgres/data:/var/lib/postgresql/data + networks: + - internal + + pgadmin: + build: custom/pgadmin + volumes: + - /srv/pgadmin/data:/var/lib/pgadmin + env_file: + - /etc/ixvd/secrets/env/pgadmin.env + networks: + - proxy + - internal + diff --git a/servers/apoc/docker-compose.d/docker-compose.yml b/servers/apoc/docker-compose.d/docker-compose.yml index 1c6d8ce..fbc73c5 100644 --- a/servers/apoc/docker-compose.d/docker-compose.yml +++ b/servers/apoc/docker-compose.d/docker-compose.yml @@ -7,7 +7,7 @@ services: build: custom/nginx environment: CERTBOT_EMAIL: "webmaster@ixvd.net" - CERTBOT_DOMAINS: "apoc.ixvd.net,mail.ixvd.net,git.ixvd.net,my.ixvd.net,ci.ixvd.net,baikal.ixvd.net" + CERTBOT_DOMAINS: "apoc.ixvd.net,mail.ixvd.net,git.ixvd.net,my.ixvd.net,ci.ixvd.net,baikal.ixvd.net,pg.ixvd.net" volumes: - /srv/certbot/data:/etc/letsencrypt - /srv/certbot/other/www:/var/www/certbot