services:
  guacd:
    image: guacamole/guacd
    network_mode: host          # listens on localhost:4822
    restart: unless-stopped

  postgres:
    image: postgres:16
    network_mode: host          # listens on localhost:5432
    environment:
      POSTGRES_DB: guacamole_db
      POSTGRES_USER: guacamole
      POSTGRES_PASSWORD: CHANGE_ME
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    restart: unless-stopped

  guacamole:
    image: guacamole/guacamole
    network_mode: host          # serves on 0.0.0.0:8080/guacamole
    depends_on: [guacd, postgres]
    environment:
      GUACD_HOSTNAME: localhost
      GUACD_PORT: "4822"
      POSTGRESQL_HOSTNAME: localhost
      POSTGRESQL_PORT: "5432"
      POSTGRESQL_DATABASE: guacamole_db
      POSTGRESQL_USER: guacamole
      POSTGRESQL_PASSWORD: CHANGE_ME
    restart: unless-stopped