diff --git a/README.md b/README.md index b12a904a5cacdf034e57b5180a0893c77b3fc0a5..cba2e4796cca840b03693a6c20485ff8359b64a2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,33 @@ # Alpha Project Manager -An Infrastructure as Code manager to deploy lab infrastructure. Working with Atrium, Gitlab CI, Terraform, Cloud-init and Scaleway. +An Infrastructure as Code manager to deploy lab infrastructure and configure instances. Working with Atrium, Gitlab CI, Terraform, Cloud-init and Scaleway. ### How does it work ? +The FORGE (Gitlab) manage Terraform at any state, plan, creation, modification and destruction with the CI. The FORGE store and will provide the configuration information +such as credentials to Terraform only during the running state to improve security, then information are destroyed with the container of the Gitlab Agent. + +On run state, Terraform will create, modify and destroy infrastructure resources in Scaleway to match the configuration described in the configuration files. +After the resources provisionned with Terraform, Cloud-init will configure the instances by running bash scripts, creating files... And 3 services will be running for each instance : +- Atrium (Reverse proxy, TLS encryption and HTTPS to the others hosted services) +- Code-server +- Webtop + +After deployment, each resource can be accessed though HTTPS depending their count number : +- https://desktop-0.lab-0-devrust.daag.alpha.grandlyon.com/ +- https://code-0.lab-0-devrust.daag.alpha.grandlyon.com/ +- + +Resources deployed : + +| resource-type | plan | inbound port | +|----------------------------------|--------|--------------| +| scaleway_instance_ip | | | +| scaleway_domain_record | | | +| scaleway_domain_record | | | +| scaleway_instance_security_group | | 22, 443, 80 | +| scaleway_instance_server | DEV1-L | | + At first, Gitlab CI will run scripts to generate environment variables. They will be used in Terraform for configuration and securing credentials. diff --git a/instance-scripts/cloud-init.yml b/instance-scripts/cloud-init.yml index 03ead7bb3d71e8fab2a1204a386ba08c7360c895..c19e7b8e9f8d90cca87b5f261e44ad0e9971cfe0 100644 --- a/instance-scripts/cloud-init.yml +++ b/instance-scripts/cloud-init.yml @@ -7,6 +7,7 @@ package_upgrade: true # Install Packages packages: - curl + - git write_files: # @@ -43,10 +44,6 @@ write_files: cert: false path: /root/config.yaml -# -# Webtop docker compose file -# - runcmd: # # Install Rust @@ -86,3 +83,4 @@ runcmd: # 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 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" + - 'echo -e "$(scw-userdata user_password)\n$(scw-userdata user_password)" | docker exec -i webtop passwd abc' \ No newline at end of file diff --git a/instance-scripts/confs/atrium.yaml b/instance-scripts/confs/atrium.yaml new file mode 100644 index 0000000000000000000000000000000000000000..56c601f19834015ecac6c53e177e9ceb93d87e45 --- /dev/null +++ b/instance-scripts/confs/atrium.yaml @@ -0,0 +1,20 @@ +# The content of this file is recreated by cloud init. +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% + icon: web_asset + color: 4292030255 + is_proxy: true + host: code-%atrium_count_index% + target: localhost:8080 + - id: 2 + name: Desktop %atrium_count_index% + icon: web_asset + color: 4292030255 + is_proxy: true + host: desktop-%atrium_count_index% + target: localhost:8081 \ No newline at end of file diff --git a/instance-scripts/confs/config.yaml b/instance-scripts/confs/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f212ef59ce13e4a0428648bb1c1722762124bc20 --- /dev/null +++ b/instance-scripts/confs/config.yaml @@ -0,0 +1,5 @@ +# The content of this file is recreated by cloud init. +bind-addr: 0.0.0.0:8080 +auth: password +password: %user_password% +cert: false \ No newline at end of file