Skip to main content

Setting up and connect Gitlab Runner

In Avada SasS, we need to configure a self-hosted runner instead of pay as you go shared runner for the sake of fixed cost in operating. Your team may need to configure your own Gitlab runner instance to run your own app CI/CD jobs.

In the future, many tasks may requires CI/CD, not just deploying your app to Serverless platform, but also running testing automation scripts, etc.

Prepare your Compute Engine instance

It is recommended to create a Compute engine instance with this configuration to save time running CI/CD jobs with Avada SasS

Install docker

On your Ubuntu instance, you will need to install Docker first. Please follow this official guide

Set up Docker's apt repository.

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install the Docker packages.

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Install gitlab runner

For Linux (Debian/Ubuntu/Mint), you can install Gitlab Runner here: https://docs.gitlab.com/runner/install/linux-repository.html

Start Docker Daemon

sudo service docker start

Register your Gitlab runner

You go to your runners management page on Gitlab, you will find the guide for registering a runner here, with the command like:

sudo gitlab-runner register \
--url "https://gitlab.com/" \
--registration-token "$RUNNER_TOKEN" \
--executor "docker" \
--docker-image node:16 \

Verify your runner connection

sudo gitlab-runner verify

Voila

If the verification works, the instance will soon take the jobs on your Gitlab account.