From 7c259a0fa6878d0d17d930b290ebfd6a1b008de0 Mon Sep 17 00:00:00 2001
From: Nathan Rodet <nrodet@grandlyon.com>
Date: Thu, 22 Dec 2022 15:13:04 +0100
Subject: [PATCH] Added configuration

---
 server-scripts/cloud-init.yml | 12 ++++++------
 terraform/main.tf             |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/server-scripts/cloud-init.yml b/server-scripts/cloud-init.yml
index 37a5dc2..57b96d3 100644
--- a/server-scripts/cloud-init.yml
+++ b/server-scripts/cloud-init.yml
@@ -17,18 +17,18 @@ write_files:
       letsencrypt_email: %atrium_letsencrypt_email%
       apps: # optional : applications served by atrium
         - id: 1
-          name: Code
+          name: Code %atrium_count_index%
           icon: web_asset
           color: 4292030255
           is_proxy: true
-          host: "code-%atrium_count_index%"
+          host: code-%atrium_count_index%
           target: %atrium_private_ip%:8080
         - id: 2
-          name: Desktop
+          name: Desktop %atrium_count_index%
           icon: web_asset
           color: 4292030255
           is_proxy: true
-          host: "desktop-%atrium_count_index%"
+          host: desktop-%atrium_count_index%
           target: %atrium_private_ip%:8081
     path: /root/atrium.yaml
 # Code-server config file
@@ -52,14 +52,14 @@ runcmd:
   - '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"
+  - "cp -f /root/atrium.yaml /root/app/atrium.yaml && rm /root/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"
 # 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"
+  - "cp -f /root/config.yaml /root/.config/code-server/config.yaml && rm /root/config.yaml"
 # Run Code Server
   - "systemctl enable --now code-server@$USER"
 # Run Webtop Container
diff --git a/terraform/main.tf b/terraform/main.tf
index d8e8229..6356f82 100644
--- a/terraform/main.tf
+++ b/terraform/main.tf
@@ -85,7 +85,7 @@ resource "scaleway_instance_server" "user_instance_server" {
   user_data = {
     atrium_private_ip = scaleway_instance_ip.public_ip[count.index].address
     atrium_count_index = count.index
-    atrium_hostname = scaleway_domain_record.host_subdomain_record[count.index].name
+    atrium_hostname = scaleway_domain_record.subdomain_record[count.index].name
     atrium_letsencrypt_email = var.LETSENCRYPT_EMAIL
     user_password = var.USER_PASSWORD
     cloud-init = file("../server-scripts/cloud-init.yml")
-- 
GitLab