Skip to content
Snippets Groups Projects
user avatar
Nathan Rodet authored
7714dbd3
History
user avatar 7714dbd3

Scaleway Instances Template - Quickstart

How does it work ?

The template will provision resources to the Scaleway cloud provider using Terraform and Gitlab CI. After provisioning, the configuration of the instances and the service deployment (Atrium and TTYD) will be done using Cloud-init and bash scripts.

How can I use it ?

Step 0 : Prerequisite

On The Forge (Gitlab), you must have or ask for the right to fork the repository.

Scaleway needs credentials to use their services. Create some for your project at Scaleway API key page Please make sure to add a description matching with Terraform - <your description>.

The Certificate Authority (CA) Let's Encrypt needs an email to send a notification before the certificate expires and proceed to the the renewal.

Step 1 : Getting your own repository

Fork the project from this repository

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, should match the project name.
  • TF_VAR_INSTANCE_COUNT : Number of instances to create.
  • TF_VAR_LETSENCRYPT_EMAIL : Lets encrypt mail for renewal.
  • TF_VAR_PROJECT_DOMAIN : External domain from Scaleway. Example : <PROJECT_DOMAIN>.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.
  • TF_VAR_INSTANCE_TYPE : A type of instance to deploy. (DEV-S...)
  • TF_VAR_VOLUME_DISK : A number of GB for the volume attached to the instance.

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 through HTTPS, URL depends on the variables you defined before :

  • TTYD : https://terminal-<INSTANCE_COUNT>.<ENVIRONMENT>-<INSTANCE_COUNT>.<PROJECT_DOMAIN>.com/
  • Atrium : https://<ENVIRONMENT>-<INSTANCE_COUNT>.<PROJECT_DOMAIN>.com/

Example :