diff --git a/server-scripts/cloud-init.yml b/server-scripts/cloud-init.yml index 51f0556304ed7ae8cc46de7b96eb224e8f0bd84e..af4d43ef9a5411e2f2ff8434b32dbae3772d279c 100644 --- a/server-scripts/cloud-init.yml +++ b/server-scripts/cloud-init.yml @@ -7,14 +7,14 @@ package_upgrade: true # Install Packages packages: - curl - - git write_files: # Atrium config file - content: | - hostname: %atrium_hostname% + hostname: %atrium_hostname%.daag.alpha.grandlyon.com debug_mode: false letsencrypt_email: %atrium_letsencrypt_email% + tls_mode: Auto apps: # optional : applications served by atrium - id: 1 name: Code %atrium_count_index% @@ -40,28 +40,42 @@ write_files: path: /root/config.yaml runcmd: +# # Install Rust +# - "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" - "source \"$HOME/.cargo/env\"" +# # Install Docker +# - "curl -fsSL https://get.docker.com -o get-docker.sh" - "sh get-docker.sh" +# # Install Atrium - - "mkdir -p /root/app/data && mkdir -p /root/app/letsencrypt_cache" - - 'chown -Rf 1000:1000 root/data root/letsencrypt_cache' +# + - "mkdir -p /root/atrium/data && mkdir -p /root/atrium/letsencrypt_cache" + - "chown -Rf 1000:1000 /root/atrium" - 'sed -i "s/%atrium_hostname%/$(scw-userdata atrium_hostname)/g" /root/atrium.yaml' - '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' - 'sed -i "s/%atrium_private_ip%/$(scw-userdata atrium_private_ip)/g" /root/atrium.yaml' - - "cp -f /root/atrium.yaml /root/app/atrium.yaml && rm /root/atrium.yaml" + - "mv /root/atrium.yaml /root/atrium/atrium.yaml" +# # Run Atrium Container - - "docker run -d --name atrium --net=host -v /root/app/atrium.yaml:/app/atrium.yaml -v /root/app/data/GeoLite2-City.mmdb:/app/GeoLite2-City.mmdb -v /root/app/data/letsencrypt_cache:/app/letsencrypt_cache -v /root/app/data:/app/data nicolaspernoud/atrium:latest" +# + - "docker run -d --name atrium --restart unless-stopped --net=host -v /root/atrium/atrium.yaml:/app/atrium.yaml -v /root/atrium/data/letsencrypt_cache:/app/letsencrypt_cache -v /root/atrium/data:/app/data nicolaspernoud/atrium:latest" +# # Install Code Server +# - "curl -fsSL https://code-server.dev/install.sh | sh" - "mkdir -p /root/.config/code-server/" - 'sed -i "s/%user_password%/$(scw-userdata user_password)/g" /root/config.yaml' - - "cp -f /root/config.yaml /root/.config/code-server/config.yaml && rm /root/config.yaml" + - "mv /root/config.yaml /root/.config/code-server/config.yaml" +# # Run Code Server +# - "systemctl enable --now code-server@$USER" +# # Run Webtop Container - - "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 80:3000 -v /root/webtop_data/:/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" \ No newline at end of file +# + - "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_data/:/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" \ No newline at end of file diff --git a/terraform/main.tf b/terraform/main.tf index 6356f826122e2809e37014423674d832b0f2c6fa..53c69b72498bb63b6fb9da7574a60ad735ecaba0 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -23,7 +23,7 @@ resource "scaleway_instance_ip" "public_ip" { resource "scaleway_domain_record" "subdomain_record" { count = var.INSTANCES_COUNT dns_zone = "daag.alpha.grandlyon.com" - name = "lab-${count.index}-daag-${var.ENVIRONMENT}" + name = "lab-${count.index}-${var.ENVIRONMENT}" type = "A" data = scaleway_instance_ip.public_ip[count.index].address ttl = 3600 @@ -32,7 +32,7 @@ resource "scaleway_domain_record" "subdomain_record" { resource "scaleway_domain_record" "host_subdomain_record" { count = var.INSTANCES_COUNT dns_zone = "daag.alpha.grandlyon.com" - name = "*.lab-${count.index}-daag-${var.ENVIRONMENT}" + name = "*.lab-${count.index}-${var.ENVIRONMENT}" type = "A" data = scaleway_instance_ip.public_ip[count.index].address ttl = 3600 @@ -44,7 +44,7 @@ resource "scaleway_domain_record" "host_subdomain_record" { resource "scaleway_instance_security_group" "www" { project_id = var.SCW_PROJECT_ID - name = "security-group-lab-daag-${var.ENVIRONMENT}" + name = "security-group-lab-${var.ENVIRONMENT}" inbound_default_policy = "drop" outbound_default_policy = "accept" @@ -76,7 +76,7 @@ resource "scaleway_instance_security_group" "www" { resource "scaleway_instance_server" "user_instance_server" { count = var.INSTANCES_COUNT project_id = var.SCW_PROJECT_ID - name = "instance-${count.index}-lab-daag-${var.ENVIRONMENT}" + name = "instance-${count.index}-lab-${var.ENVIRONMENT}" type = "DEV1-L" image = "ubuntu_jammy" ip_id = scaleway_instance_ip.public_ip[count.index].id