Skip to main content

Configuring Digital Ocean droplets and installing Gitlab Runners for Docker Deployments

updated at: Feb 23, 2021

SSH into the droplet.

Start with installing Gitlab Runner on the Droplet: https://docs.gitlab.com/runner/install/linux-manually.html

You can have several runners running on a same droplet. To register a new Gitlab runner run:

sudo gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token T-wMLiwt5WhQRUQbrWm8\
--executor shell \
--description [enter name here]

the registration token T-wMLiwt5WhQRUQbrWm8 is from our gitlatb powr repo.

You will need to tag new runner on https://gitlab.com/powr/powr/settings/ci_cd#js-runners-settings

docker-production tag is for production and docker-alpha-staging for alpha and staging

Install docker: https://docs.docker.com/engine/install/ubuntu/

Add gitlab-runner user to docker group: sudo usermod -aG docker gitlab-runner

Verify that gitlab-runner has access to Docker: sudo -u gitlab-runner -H docker info

Install NodeJS and NPM: curl -sL https://deb.nodesource.com/setup_8.x | sudo bash - sudo apt install nodejs -y

Install NodeJS an NPM V2: curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt install nodejs -y

And Heroku CLI npm install -g [email protected] For the assets checker npm i -g folder-hash

Install AWS cli

The command that you need to run is:

apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

See doc for more details: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

FYI: also Gitlab needs AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION env variables. But they are already added, so you dont have to worry there.

List of Droplets. Each droplet has 2 runners: one for production, one for staging/alpha. ssh [email protected] ssh [email protected]

We will need to clean the old docker images periodically by SSH-ing into the droplet and running docker image prune -f npm install -g [email protected] For the assets checker npm i -g folder-hash

Install AWS cli

The command that you need to run is:

apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

See doc for more details: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

FYI: also Gitlab needs AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION env variables. But they are already added, so you dont have to worry there.

List of Droplets. Each droplet has 2 runners: one for production, one for staging/alpha. ssh [email protected] ssh [email protected]

We will need to clean the old docker images periodically by SSH-ing into the droplet and running docker image prune -f