Skip to content
Snippets Groups Projects
cloud-init.yml 2.97 KiB
Newer Older
  • Learn to ignore specific revisions
  • # System update
    
    package_update: true
    package_upgrade: true
    
    
    # Install Packages
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    packages:
      - curl
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - git
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    write_files:
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    # Atrium config file
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - content: |
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          hostname: %atrium_hostname%.daag.alpha.grandlyon.com
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          debug_mode: false
          letsencrypt_email: %atrium_letsencrypt_email%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          tls_mode: Auto
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          apps: # optional : applications served by atrium
            - id: 1
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              name: Code %atrium_count_index%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              icon: web_asset
              color: 4292030255
              is_proxy: true
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              host: code-%atrium_count_index%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              target: localhost:8080
    
    Nathan Rodet's avatar
    Nathan Rodet committed
            - id: 2
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              name: Desktop %atrium_count_index%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              icon: web_asset
              color: 4292030255
              is_proxy: true
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              host: desktop-%atrium_count_index%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
              target: localhost:8081
    
    Nathan Rodet's avatar
    Nathan Rodet committed
        path: /root/atrium.yaml
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    # Code-server config file
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - content: |
          bind-addr: 0.0.0.0:8080
          auth: password
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          password: %user_password%
    
    Nathan Rodet's avatar
    Nathan Rodet committed
          cert: false
        path: /root/config.yaml
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    # Install Rust
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
      - "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/scripts/rust.sh | bash"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    # Install Docker
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
      - "curl -fsSL https://get.docker.com -o get-docker.sh"
      - "sh get-docker.sh"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    # Install Atrium
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
      - "mkdir -p /root/atrium/data && mkdir -p /root/atrium/letsencrypt_cache"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - 'sed -i "s/%atrium_hostname%/$(scw-userdata atrium_hostname)/g" /root/atrium.yaml'
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - 'sed -i "s/%atrium_letsencrypt_email%/$(scw-userdata atrium_letsencrypt_email)/g" /root/atrium.yaml'
      - 'sed -i "s/%atrium_count_index%/$(scw-userdata atrium_count_index)/g" /root/atrium.yaml'
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - "mv /root/atrium.yaml /root/atrium/atrium.yaml"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - "chown -Rf 1000:1000 /root/atrium"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    # Run Atrium Container
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - "docker run -d --name atrium --restart unless-stopped --net=host -v /root/atrium/atrium.yaml:/app/atrium.yaml -v /root/atrium/letsencrypt_cache:/app/letsencrypt_cache -v /root/atrium/data:/app/data nicolaspernoud/atrium:latest"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    # Install And Run Code Server
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
      - "export HOME=/root"
      - "export USER=root"
    
      - "mkdir -p  /root/.config/code-server/"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - 'sed -i "s/%user_password%/$(scw-userdata user_password)/g" /root/config.yaml'
    
    Nathan Rodet's avatar
    Nathan Rodet committed
      - "mv /root/config.yaml /root/.config/code-server/config.yaml"
    
      - "curl -fsSL https://code-server.dev/install.sh | sh"
    
      - "sudo systemctl enable --now code-server@$USER"
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
    # Run Webtop Container
    
    Nathan Rodet's avatar
    Nathan Rodet committed
    #
    
      - "docker run -d --name=webtop --security-opt seccomp=unconfined -e PUID=0 -e PGID=0 -e TZ=Europe/Paris -e SUBFOLDER=/ -e KEYBOARD=fr-fr-azerty -e AUTO_LOGIN=false -p 8081:3000 -v /root/webtop:/config -v /var/run/docker.sock:/var/run/docker.sock --shm-size=8gb --cap-add=NET_ADMIN --privileged --restart unless-stopped --sysctl net.ipv6.conf.all.disable_ipv6=0 lscr.io/linuxserver/webtop:ubuntu-xfce"
      - 'echo "$(scw-userdata user_password)\n$(scw-userdata user_password)" | docker exec -i webtop passwd abc'
    #
    # Install Repository
    #
    
      - "git clone https://github.com/NathanRodet/rust-axum-demo /root/rust-axum-demo"