services:
  vaultwarden:
    container_name: vaultwarden
    image: vaultwarden/server:latest
    environment:
      - TZ=${TZ}
#      - ADMIN_TOKEN=${VAULTWARDEN_ADMIN_TOKEN}
      - DATABASE_URL=data/db.sqlite3
      - DISABLE_ADMIN_TOKEN=false
      - DOMAIN=https://bitwarden.akanealw.com
      - ENABLE_DB_WAL=true
      - INVITATIONS_ALLOWED=false
      - SHOW_PASSWORD_HINT=false
      - SIGNUPS_ALLOWED=false
      - SIGNUPS_VERIFY=false
      - SMTP_PORT=587
      - SMTP_SECURITY=starttls
    networks:
      - reverse-proxy
    ports:
      - 8089:80
    restart: always
    volumes:
      - ${DOCKER_CONFIGS}/data:/data
      - /etc/localtime:/etc/localtime:ro

  vaultwarden-backup:
    container_name: vaultwarden-backup
    image: bruceforce/vaultwarden-backup
    environment:
      - BACKUP_DIR=/data/backups
      - CRON_TIME=15 * * * *
      - TIMESTAMP=true
      - UID=${PUID}
      - GID=${PGID}
    networks:
      - reverse-proxy
    depends_on:
      - vaultwarden
    init: true
    restart: always
    volumes:
      - ${DOCKER_CONFIGS}/data:/data
      - /home/akanealw/backups/vaultwardenbackups:/data/backups

networks:
  reverse-proxy:
    name: reverse-proxy
    external: true
