services: postgres: image: postgres:17.5-alpine3.21 hostname: postgres networks: - postgres_net - traefik_traefik_proxy # or set shared memory limit when deploy via swarm stack deploy: mode: replicated replicas: 1 restart_policy: condition: on-failure labels: # Custom labels - "com.xbazzi.stack=postgresql" - "com.xbazzi.critical=true" placement: constraints: - node.hostname == db1 volumes: - /var/lib/postgresql/data:/var/lib/postgresql/data # - type: tmpfs # target: /dev/shm # tmpfs: # size: 134217728 # 128*2^20 bytes = 128Mb environment: POSTGRES_PASSWORD: password adminer: image: adminer networks: - postgres_net - traefik_traefik_proxy deploy: mode: replicated replicas: 1 restart_policy: condition: on-failure labels: # Enable Service discovery for Traefik - "traefik.enable=true" # Define the nginx router rule - "traefik.http.routers.adminer.rule=Host(`adminer.lan.xbazzi.com`)" # Expose nginx on the HTTPS entrypoint - "traefik.http.routers.adminer.entrypoints=websecure" # Enable TLS - "traefik.http.routers.adminer.tls=true" # Expose the nginx port number to Traefik - "traefik.http.services.adminer.loadbalancer.server.port=8080" # Custom labels - "com.xbazzi.stack=adminer" - "com.xbazzi.critical=true" placement: constraints: - node.hostname == db1 networks: postgres_net: driver: overlay attachable: true traefik_traefik_proxy: external: true