Newer
Older
The template will provision several resources (including your instances) to the Scaleway cloud provider using Terraform and Gitlab CI.
After provisioning, configuration of the instances and deployment of the services (Atrium and TTYD) will be done using Cloud-init and bash scripts.
> All your information must be stored in Gitlab and passed as variable to Terraform.
The whole project is managed by Gitlab using the Gitlab CI.
Launching the pipeline will start the deployment of your infrastructure in 3 steps.
**Plan :**
Terraform will perform a "fake deployment" and initialize everything he needs before deploying.
After performing, you will be able to see the plan of the future creation/modification/destruction in the log of the pipeline.
If the modification could lead to break changes and errors, you must not launch the next step of the pipeline.
**Creation :**
Terraform will be applying the exact changes you reviewed in the Plan step.
**Destruction :**
Terraform will destroy the resources he managed to create (or manually imported one).
**On The Forge (Gitlab)**, you must have or ask for the right to fork the repository.
**Scaleway** needs you to have credentials to use their services. You must go to [Scaleway API key page](https://console.scaleway.com/iam/api-keys)
and create one for your project. Please make sure to add a description starting with `Terraform - <your description>`.
**The Certificate Authority (CA)** Let's Encrypt needs an email. He will use it to send a notification before the certificate expires to proceed with
the renewal.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
### Step 1 : Getting your own repository
Fork the project from [this repository](https://forge.grandlyon.com/systemes-dinformation/alpha/pocs/scaleway-instances-template)
### Step 2 : Setting up the variables with credentials and others information
Go to the `Settings` menu, `CI/CD` and look for the `Variables` submenu.
Once it's done, you will need to create the variable bellow :
- **ENVIRONMENT** : Environment of the deployment, contained in domains, subdomains and resources name convention.
- **TF_VAR_INSTANCES_COUNT** : Number of instances to create.
- **TF_VAR_LETSENCRYPT_EMAIL** : Lets encrypt mail for renewal.
- **TF_VAR_PROJECT_DOMAIN** : External domain from Scaleway. (Example : <xxx>.alpha.grandlyon.com)
- **TF_VAR_SCW_ACCESS_KEY** : Scaleway Access Key.
- **TF_VAR_SCW_PROJECT_ID** : Project ID from your Scaleway project.
- **TF_VAR_SCW_SECRET_KEY** : Scaleway Secret Key.
- **TF_VAR_USER_PASSWORD** : User password for accessing services and instances.
### Step 3 : Every is set up, deployment is coming !
Go the `CI/CD` menu and `Pipelines`.
From now, you will need to click on `Run pipeline` with your selected branch.
Since you added variables before, you don't need to put any in this step, click `Run Pipeline` again.
**Checking logs :** You can click on every step to check logs in case of errors or not.
**Check plan :** I recommend to always check the plan when you're trying things to do not perform destruction
on production infrastructure.
Once plan is done and ok, click the `Apply button` to deploy the infrastructure. Please be sure to click the `Destroy
button` to destroy the infrastructure when you don't need it anymore.
### Step 4 : Accessing your services
After deployment, each resource can be accessed though HTTPS, URL depends of the variable you defined before :
- **TTYD :** https://terminal-<INSTANCE_COUNT>.<ENVIRONMENT>-<INSTANCE_COUNT>.<PROJECT_DOMAIN/
- **Atrium :** https://<ENVIRONMENT>-<INSTANCE_COUNT>.<PROJECT_DOMAIN>/
- https://terminal-1.rust-1.daag.alpha.grandlyon.com/
- https://rust-1.daag.alpha.grandlyon.com/