services:
  
  openssh-server:
    image: ghcr.io/linuxserver/openssh-server:latest
    container_name: appServer_TunnelHead
    hostname: appServerTunnel
    ports: 
      - "2255:2222" # Access to R-Tunnel from public Internet
      - "1883:1883" # Forwarded to Mosqitto
      - "9222:9222" # SSH to Informatikweb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Zurich
      - PASSWORD_ACCESS=false
      - USER_NAME=tunnel
      - SUDO_ACCESS=false
      - CUSTOM_CONT_INIT=true 
    volumes:
      - /home/chk/Documents/appServerTunnelHead/custom-cont-init.d:/custom-cont-init.d
      - /home/chk/Documents/appServerTunnelHead/config:/config
    networks:
      - appRobotNet
    restart: unless-stopped

  AppServerPortalUI:
    image: nginx:alpine
    container_name: appServer_PortalUI
    volumes:
      - /home/chk/Documents/appServerPortalUI/nginx.conf:/etc/nginx/conf.d/default.conf:ro
      - /home/chk/Documents/appServerPortalUI/public:/usr/share/nginx/html:ro
      # Let's Encrypt mounts
      - /home/chk/Documents/appServerPortalUI/letsencrypt/conf:/etc/letsencrypt:ro
      - /home/chk/Documents/appServerPortalUI/letsencrypt/www:/var/www/certbot:ro
      # PortForwarding-Script-etc
      - /home/chk/Documents/appServerPortalUI/forwarding.conf:/etc/nginx/forwarding.conf:ro
      - /home/chk/Documents/appServerPortalUI/connect-proxies.sh:/docker-entrypoint.d/40-connect-proxies.sh:ro
    ports:
      - "80:80"
      - "443:443"
    networks:
      - appRobotNet
    restart: unless-stopped
    command: ["nginx", "-g", "daemon off;"]
    
  appServer_LetsEncryptFetcher:
    image: certbot/certbot
    container_name: appServer_LetsEncryptFetcher
    volumes:
      - /home/chk/Documents/appServerPortalUI/letsencrypt/conf:/etc/letsencrypt
      - /home/chk/Documents/appServerPortalUI/letsencrypt/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do sleep 3600; done'"
    
  AppServerAuth:
    image: node:24-alpine
    container_name: AppServerAuth
    volumes:
      - /home/chk/Documents/appServerPortalUI/auth:/usr/src/app
    working_dir: /usr/src/app
    command: sh -c "npm install && node auth.js"
    ports:
      - "10300:3000"  # optional, für Tests
    networks:
      - default
      - appRobotNet
    restart: unless-stopped

  appServerGuacamole:
    image: abesnier/guacamole:latest
    container_name: appServer_guacamole
    ports:
      - "8088:8080"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - /home/chk/Documents/appServerGuacamole/config:/config/guacamole
      - /home/chk/Documents/appServerGuacamole/postgres:/config/postgres
    networks:
      - appRobotNet
    restart: unless-stopped
    


networks:
  default:
  appRobotNet:
