Alexecus Portfolio Site
How automation using continuous integration helped on the creation of this site. From server creation and provisioning, up to deployment.
The goal of this project is to allow automated management of servers and deployment by only managing one single user interface. The entire server setup is controlled by code, and is being processed by Gitlab CI. This allows zero manual steps and all steps can either be self executing or executed by a click of a button.
What has been automated:
The main technologies used for automation are as follows:
The entires stack will be managed by these 2 repositories which contains:
Terraform is a tool that allows you to define the infrastructure setup by code. Terraform comes built with modules that can manage a Digitalocean-based infrastructure.
Terraform was used to do these setups
Terraform can create and destroy server instances, it can do this since it tracks the state of the server. The deal with Terraform is that it produces a state file, and since we are using Gitlab CI as our Terraform host, all pipelines must refer to a single state file. To fix this problem, Terraform Remote State was used, and it is configured to use Digitalocean Spaces to store the state files.
After creating the server instances, we need to provision it. This will install the tools and services needed to run a website. Ansible was the provisioner of choice.
Ansible was used to do these setups
With the server up and running, the next step is to create a package that would be deployed to the server. The package will contain the actual site together with the asset compiled and dependencies resolved.
These steps are usually provided by the application meant to be deployed, and consists of the following steps:
Build step will create the package from scratch. It will run composer install followed by yarn install and yarn dist. The resulting package will be compressed into a tar file and uploaded to Gitlab's artifactory.
This will deploy to the environment of choice. It will establish a secure SSH session to the server using an SSH key configured in the Gitlab's environment variables settings.