version: '3.9'

services:
  vaultwarden:
    image: vaultwarden/server:latest
    ports:
      - "8088:80"
    environment:
      # Simple configuration matching the working setup
      - SIGNUPS_ALLOWED=true
      - WEBSOCKET_ENABLED=true
      - WEBSOCKET_PORT=80
      - DOMAIN=https://vaultwarden.pressmess.duckdns.org
      - WEB_VAULT_ENABLED=true
      - ROCKET_PROFILE=release
      - ROCKET_ADDRESS=0.0.0.0
      - ROCKET_PORT=80
      - IP_HEADER=X-Real-IP
      - TRUSTED_PROXIES=192.168.50.0/24
    volumes:
      - vaultwarden_data:/data
    networks:
      - caddy-public
    deploy:
      placement:
        constraints:
          - "node.labels.role==db"
      replicas: 1

volumes:
  vaultwarden_data:
    driver: local

networks:
  caddy-public:
    external: true
