Refactor Docker Compose for PostgreSQL and Redis services
This commit is contained in:
@@ -16,6 +16,8 @@ services:
|
||||
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
|
||||
volumes:
|
||||
- "./database:/var/lib/postgresql/data"
|
||||
- "./database/pg_hba.conf:/etc/postgresql/pg_hba.conf" # Correct location
|
||||
command: ["postgres", "-c", "hba_file=/etc/postgresql/pg_hba.conf"] # ✅ Tell PostgreSQL where to find it
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
@@ -128,8 +130,8 @@ services:
|
||||
phoenix-redis:
|
||||
image: 'bitnami/redis:latest'
|
||||
container_name: redis
|
||||
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
|
||||
user: root
|
||||
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb --dir /bitnami/redis/data
|
||||
user: 1001:1001 # Non-root user in Bitnami images The /bitnami/redis/data directory inside the container is already owned by 1001, avoiding permission issues.
|
||||
networks:
|
||||
- backend
|
||||
restart: always
|
||||
@@ -139,13 +141,22 @@ services:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 5s
|
||||
retries: 10 # Increase retries if Redis takes a while to start
|
||||
timeout: 5s # Increase timeout if needed
|
||||
volumes:
|
||||
- "./redis/data:/bitnami/redis/data"
|
||||
- /opt/phx/redis/tmp:/opt/bitnami/redis/tmp # ✅ Fix permission issue
|
||||
- /opt/phx/redis/logs:/opt/bitnami/redis/logs # ✅ Fix logs permission issue
|
||||
- ./redis.conf:/opt/bitnami/redis/etc/redis.conf # ✅ Use a writable redis.conf
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
node_exporter:
|
||||
image: quay.io/prometheus/node-exporter:latest
|
||||
container_name: node_exporter
|
||||
network_mode: host
|
||||
pid: host
|
||||
networks:
|
||||
- metrics
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9100:9100"
|
||||
@@ -162,7 +173,6 @@ services:
|
||||
container_name: https_portal
|
||||
image: "steveltn/https-portal:1.21"
|
||||
restart: unless-stopped
|
||||
user: "root"
|
||||
networks:
|
||||
- frontend # [ PgAdmin, Phoenix-App ]
|
||||
- external # [ Outside of the World]
|
||||
@@ -181,25 +191,50 @@ services:
|
||||
volumes:
|
||||
- ./https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
|
||||
- ./https_portal/log:/var/log/nginx # nginx logs
|
||||
- ./https_portal/config/custom_nginx.conf:/opt/custom_nginx.conf:ro # ✅ Mount file in a safe path
|
||||
depends_on:
|
||||
- phoenix-app
|
||||
- phoenix-system
|
||||
- pgadmin
|
||||
- phoenix-redis
|
||||
- postgres
|
||||
|
||||
fail2ban:
|
||||
image: crazymax/fail2ban:latest
|
||||
container_name: fail2ban
|
||||
network_mode: 'host'
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
volumes:
|
||||
- ./fail2ban/data:/data
|
||||
- ./fail2ban/jail.d:/etc/fail2ban/jail.d
|
||||
- /var/log:/var/log:ro
|
||||
restart: always
|
||||
networks:
|
||||
backend:
|
||||
driver: bridge
|
||||
external: false
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.19.0.0/16
|
||||
|
||||
frontend:
|
||||
driver: bridge
|
||||
external: false
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
|
||||
external:
|
||||
driver: bridge
|
||||
external: true
|
||||
external: false
|
||||
|
||||
metrics:
|
||||
driver: bridge
|
||||
external: false
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.22.0.0/16
|
||||
|
||||
volumes:
|
||||
pgadmin: null
|
||||
|
||||
Reference in New Issue
Block a user