In this tutorial you will learn how to create a CI/CD pipeline that deploys to the Fuga Object Store using GitLab and GitLab runners. GitLab comes with built-in Continuous Integration, Continuous Deployment, and Continuous Delivery support to build, test, and deploy your application.
When a commit is made, a CI/CD pipeline will be started. GitLab will notify the runner that a new job is available. This runner will run all the tests defined for the project and will (re)deploy the application when the tests are successful. The flow looks like this:

Requirements
- Followed the Fuga Getting Started guide.
Creating a new security group
To access GitLab by a browser outside of our local network, we need to open the ports 80 (HTTP) and 443 (HTTPS). This chapter will explain how to open these ports.
On your Fuga Dashboard go to
Compute
->Access and Security
.Click on
+ Security group
to create a new security group.Enter a name for the security group, for example
webservers
.Click on
Create Security group
to save the new group.Click on the
Manage Rules
button from the newly created security group.Click on
+ Add Rule
in the top right corner of the screen.From the
Rule
drop-down list selectHTTP
and clickAdd
.Repeat steps 6 and 7 for
HTTPS
.
Creating a Fuga Object Store container
This chapter will explain how to create a Fuga Object Store container which will be used for the deployment.
Log in to your Fuga Cloud dashboard.
Click on
Containers
and create a new container using the orange+ Container
button.Give it a fitting name and check the
Public
checkbox, so that we can access it without authentication later on. Please note that making your container Public allows everyone to access your files, you should change this after the tutorial.Click on the
+ Create
button to add the container.
Installing GitLab on a Fuga instance
In this part of the tutorial installing GitLab and setting up the root account will be covered. In this tutorial we will use the Enterprise Editon (ce) of GitLab.
However there is also an opensource version of GitLab, the Community Edition (ce). If you want to use that version instead, change the commands with ce
in them to ee
. For example apt install gitlab-ce
to apt install gitlab-ee
.
Fire up an instance on Fuga that has enough performance for your needs. For this tutorial we will use a c1.medium with 2 cores and 4GB of RAM. Take a look at the GitLab Requirements. Ubuntu 18.04 is used in this tutorial.
Click on
Compute
->Instances
.In the row of the GitLab instance, click on the down arrow right of the
Create Snapshot
button and click onEdit Security groups
Our new security group should be on the left side of the popup under
All Security Groups
.Click on the
+
button and the security group should move to the right.Click
Save
to save the changes we made to our security.Log on into your instance using the following example command in your Terminal:
ssh ubuntu@FLOATING_IP
For other examples of SSH follow the Getting Started guide (5⁄5).
Start by updating your repositories by using the command:
sudo apt update
Install required packages for GitLab with the following command:
sudo apt install -y curl openssh-server ca-certificates
Add the GitLab repository:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Now it’s time to install GitLab, make sure to change the EXTERNAL_URL to your domain or the floating IP from your instance. This would for example be:
http://gitlab.example.com
or if using an IP:http://185.XX.XX.XX
.sudo EXTERNAL_URL="http://gitlab.example.com" apt install gitlab-ce
When GitLab is done installing, browse to the EXTERNAL_URL with your browser and setup your account. For example
http://gitlab.example.com
. The username of the first account, is calledroot
.
Installing a GitLab Runner that uses Docker
After installing GitLab on an instance, the next step is installing and registering a GitLab runner to GitLab. This chapter will cover the installation and registration of a GitLab runner.
Fire up another instance on Fuga that has enough performance for your GitLab runner. For the GitLab runner we will use a c1.small with Ubuntu 18.04.
Log on into your GitLab runner instance using the following example command:
ssh ubuntu@FLOATING_IP
For other examples of connecting with SSH see Getting Started guide (5⁄5)
Start by updating your repositories by using the command:
sudo apt update
Install Docker with the following command:
sudo apt install docker.io
Add the GitLab Runner repository:
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
Now install the GitLab runner package:
sudo apt install gitlab-runner
Go to your GitLab URL with your browser and login with
root
and your chosen password.Click on
Configure GitLab
.Go to Overview -> Runners in the left menu bar. Keep this page open because we need the URL and registration token in the following steps.
Start the registration of the GitLab runner in the GitLab runner instance:
sudo gitlab-runner register
When asked for your GitLab URL, enter the URL of your GitLab. For example
http://gitlab.example.com
orhttp://185.xx.xx.xx
.When asked for a GitLab-ci token, enter the token on the page of step 9.
When asked for a description of your GitLab runner, enter a fitting description.
When asked for tags for your GitLab runner, enter tags that you deem fitting.
When asked to lock your GitLab runner, keep it default; true.
When asked for an Executor for your GitLab runner enter
docker
.When asked for a default Docker image, enter
nginx
. You can choose anything you like but for this tutorial the nginx image is used.The runner should have been registered successfully. Check your GitLab runners on your GitLab dashboard and it should look like this:

Fuga Object Store tokens
To connect to your Fuga Object Store access and secret tokens are required. If you already have these you can skip this chapter.
To list and create API keys for the Object Store we need the Fuga Openstack CLI. If you haven’t installed it yet checkout our tutorial.
After following the tutorial for your operating system it’s time to list the credentials. We need the credentials to access our Object Store container in later steps.
To list all the credentials, enter the command:
openstack ec2 credentials list
- If the list of credentials is empty, a new pair of credentials can be generated with:
openstack ec2 credentials create
- Either copy the Access and Secret key to clipboard or save them temporarily
Setting up CI/CD
It’s now time to setup the CI/CD pipeline within GitLab. The tokens of the previous chapter will be used here.
To create a new project on your GitLab, click the plus icon located on the top of the screen next to the search bar and click
New project
.Give it a name and click on
Create project
.Open the new project and go to Settings -> CI/CD, which is located in the left menu bar.
Expand the Secret variables menu and enter your access key as
ACCESS_TOKEN
and your secret key asSECRET_TOKEN
. The values for these keys should be the tokens from theFuga Object Store tokens
chapter. It should look like the picture below:Click on
Save variables
.Now it’s time to add an SSH key to your GitLab root account, so we can actually push and pull to our GitLab. In the top right corner of the screen click on your profile picture with the down arrow and select
Settings
.Go to
SSH Keys
in the left menu bar.Copy the contents of your id_rsa.pub and enter a fitting title:
cat .ssh/id_rsa.pub
Click
Add key
.Clone your new project to your system using the git link located on the project page:
git clone git@gitlab.example.com:root/your-project.git
Open your new git folder inside your terminal:
cd your-project
Create a new file that will contain our CI/CD settings:
touch .gitlab-ci.yml
Open the file in your favorite text editor and copy paste the following code inside:
image: nginx stages: - test - deploy test: stage: test script: - echo "This is the test stage." deploy: stage: deploy script: - apt update - apt install -y s3cmd - s3cmd --quiet --no-check-certificate --access_key "$ACCESS_TOKEN" --secret_key "$SECRET_TOKEN" --host object.api.fuga.io --host-bucket object.api.fuga.io/%\(bucket\) --signature-v2 --exclude ".git/*" put -r ./ s3://YOUR_CONTAINER
Make sure to replace
YOUR_CONTAINER
with the name of your container made in the ‘Creating a Fuga Object Store container’ chapter. The last command will upload all the files from your git repository to your Fuga Object Store container.Save the file and we’re now ready to test our CI/CD pipeline.
Testing the CI/CD pipeline
We will now test the CI/CD pipeline by creating a basic HTML file. If the pipeline works correctly we will see a live update.
Next to your
.gitlab-ci.yml
file, create a new file calledindex.html
:touch index.html
Open
index.html
with your favorite text editor and paste in the follow example HTML:<html> <head> <title>CI/CD test</title> </head> <body> <h1>Hello, CI/CD!</h1> </body> </html>
Add the
.gitlab-ci.yml
andindex.html
to your git staged changes:git add .
Create a new git commit with these changes:
git commit -m "Initial commit with .gitlab-ci and test html page."
Push the changes to the GitLab:
git push
Go to your GitLab project and in the left menu bar click on
CI/CD
.A list of pipelines should appear like below:
There should be two green check marks marking both of our CI/CD stages as successful.
Open a new tab in your webbrowser and go to
http://object.api.fuga.io/swift/v1/YOUR_CONTAINER/index.html
. Make to replaceYOUR_CONTAINER
with the name of your own container.The HTML that you committed to your Gitlab should be displaying now.
You now have a working GitLab CI/CD base to improve further on! Don’t forget to change your container to private again if you don’t want to give everyone access to your files.