version: "0.5"

processes:

  SSH:
    command: "/usr/sbin/sshd -D $SSHD_OPTS"
    availability:
      restart: "always"
    log_location: "/var/log/sshd.log"

  JupyterLab:
    command: "/root/miniconda3/bin/jupyter lab  --ServerApp.token=\"$PASSWORD\" --notebook-dir='/'"
    availability:
      restart: "always"    
    log_location: "/var/log/jupyterlab.log"

  VSCode:
    command: "/usr/bin/code-server --auth password --bind-addr 0.0.0.0:9080  --locale=\"zh-cn\""
    availability:
      restart: "always"
    log_location: "/var/log/codeserv.log"

  WebOSDenied:
    working_dir: "/opt/webos/api/rootPath/"
    command: "jq '.denied = \"$WEB_OS_DENIED\"' start_config.json > tmp.json && mv tmp.json start_config.json"

  WebOSPass:
    working_dir: "/opt/webos/api/rootPath/"
    command: "jq -n '{username: \"root\", password: \"$PASSWORD\"}' > systemPwd.json "

  WebOS:
    working_dir: "/opt/webos/api"
    command: "java -Dfile.encoding=UTF-8 --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED -javaagent:webos.jar -XX:+UseG1GC -Xms128m -jar webos.jar"
    log_location: "/var/log/webos.log"
    availability:
      restart: "always" 
    depends_on:
      WebOSDenied:
        condition: process_completed_successfully    
      WebOSPass:
        condition: process_completed_successfully      

  CronRootStoage:
    command: "bash /etc/waas-script/cron-root-stoage.sh"
    availability:
      restart: "always"
      backoff_seconds: 30
      max_restarts: 0
    log_location: "/var/log/cron-storage.log"

  XVFB:
    command: "/usr/bin/Xvfb :1 -screen 0 1280x800x24"
    availability:
      restart: "always"
    log_location: "/var/log/xfvb.log"
  
  X11VNC:
    command: "/usr/bin/x11vnc -display :1 -passwd 123456 -forever -shared"
    availability:
      restart: "always"
    log_location: "/var/log/x11vnc.log"
  
  StartXfce4:
    command: "/usr/bin/startxfce4"
    availability:
      restart: "always"
    log_location: "/var/log/startxfce4.log"

  NoVNC:
    command: "/opt/websockify/run 0.0.0.0:9081 localhost:5900 --web=/opt/noVNC"
    availability:
      restart: "always"
    log_location: "/var/log/novnc.log"
