СHRISTMAS
WHEEL OF FORTUNE

Tap the button and win a guaranteed prize right now!

By registering, you are signing up to receiving e-mails.
DF
January 29 2023
Updated June 7 2023

Installing Concourse CI

Debian Linux Ubuntu

Preamble

Concourse CI – modern, scalable system for high performance and performance with composable declarative syntax. Compared to experiments for setting up a continuous experiment, the Concourse team has made every effort to simplify the management of the continuous experiment pipeline.

In our tutorial, we'll look through installing Concourse CI on Ubuntu/Debian/CentOS server, which will be pre-installed and configured. Let's set up a PostgreSQL database to use as a backend.

Preparation for installation

Before installing Concourse CI, it is necessery to deploy a Debian/Ubuntu/CentOS server and configure it. You can do this using our instruction.

Installing and configuring PostgreSQL

Pevious to downloading and installing Concourse CI, it is necessery to update indexes of packages and install PostgreSQL. To do that, follow that code:

apt update
apt install postgresql postgresq-contrib

Next to installing PostgreSQL, we have to create a user in the concourse database. User creation must be done as postgres.

sudo -u postgres createuser concourse

Concourse connects to a atc database. It is necessery to create an atc database and assign ownership rights to the  concourse user.

sudo -u postgres createdb --owner=concourse atc

Next to installation and creation database process, we can download and install Concourse CI.

Download and install Concourse CI

You are aible to use file from official site of Concourse or from GitHub. In our case, we consider downloading from GitHub. It is neccesery to download server.

curl -LO "url_for_concourse_linux.tgz"
tar -xzf concourse*.tgz

After that, we need to download the fly client to your home directory and unzip it:

curl -LO "ufl_for_fly"
tar -xzf fly*.tgz

After that, we have to define the rights to run files on the unpacked files and move all files to the directory - /usr/local/bin

chmod +x concourse* fly*
mv concourse* /usr/local/bin/
mv fly* /usr/local/bin/

Let's make sure that our versions of concourse and fly are relevant using command:

concourse --version
fly --version

As a result, we get versions 7.9.0.

Service configurationConcourse CI

After all, it is necessery to create concourse directory in /etc/:

mkdir -p /etc/concourse

Moving on we have to create encryption keys to access the service and set up the configuration for Concourse.

Go to the /etc/concourse directory and generate the keys:

sudo ssh-keygen -t rsa -q -N '' -f /etc/concourse/tsa_host_key
sudo ssh-keygen -t rsa -q -N '' -f /etc/concourse/worker_key
sudo ssh-keygen -t rsa -q -N '' -f /etc/concourse/session_signing_key

Check what is inside the folder via:

ls -l

As a result, we are going to get a list of generated keys:

-rw------- 1 spcsteam spcsteam 1823 Jan  4 12:18 session_signing_key
-rw-r--r-- 1 spcsteam spcsteam 393 Jan  4 12:18 session_signing_key.pub
-rw------- 1 spcsteam spcsteam 1823 Jan  4 12:18 tsa_host_key
-rw-r--r-- 1 spcsteam spcsteam 393 Jan  4 12:18 tsa_host_key.pub
-rw------- 1 spcsteam spcsteam 1823 Jan  4 12:18 worker_key
-rw-r--r-- 1 spcsteam spcsteam  393 Jan  4 12:18 worker_key.pub

We are going to make a copy of the worker_key.pub key in order to distribute this key to employees for authorization.

cp /etc/concourse/worker_key.pub /etc/concourse/authorized_worker_keys

We are going to create a configuration file to launch the WEB UI of the Concourse service.

vim /etc/concourse/web_environment

In the file, specify the paths for using the keys and the path to the file to start PostgreSQL. And also specify the login, password, server address and port.

CONCOURSE_SESSION_SIGNING_KEY=/etc/concourse/session_signing_key
CONCOURSE_TSA_HOST_KEY=/etc/concourse/tsa_host_key
CONCOURSE_TSA_AUTHORIZED_KEYS=/etc/concourse/authorized_worker_keys
CONCOURSE_POSTGRES_SOCKET=/var/run/postgresql
CONCOURSE_BASIC_AUTH_USERNAME=serverspace
CONCOURSE_BASIC_AUTH_PASSWORD=p@ssw0rd
CONCOURSE_EXTERNAL_URL=http://server_IP:8080

Let's save the file and exit it.

We are going to create a configuration file for the Concourse backend. Specify the path to the key, local address and port:

vim /etc/concourse/worker_environment
CONCOURSE_WORK_DIR=/var/lib/concourse
CONCOURSE_TSA_WORKER_PRIVATE_KEY=/etc/concourse/worker_key
CONCOURSE_TSA_PUBLIC_KEY=/etc/concourse/tsa_host_key.pub
CONCOURSE_TSA_HOST=127.0.0.1:2222

Services are started from the /etc/systemd/system/ directory, for this reason two files must be created to start the web and worker services.

vim /etc/systemd/system/concourse-worker.service
[Unit]
Description=Concourse CI worker process
After=concourse-web.service

[Service]
User=root
Restart=on-failure
EnvironmentFile=/etc/concourse/worker_environment
ExecStart=/usr/local/bin/concourse worker

[Install]
WantedBy=multi-user.target

This file specifies the user from whom the service is started, the path to the configuration file and the path to the worker file to be launched from the /etc/concourse directory.

Now let's create a file to start the WEB UI service in the /etc/systemd/system directory:

vim /etc/systemd/system/concourse-web.service
[Unit]
Description=Concourse CI web process (ATC and TSA)
After=postgresql.service

[Service]
User=concourse
Restart=on-failure
EnvironmentFile=/etc/concourse/web_environment
ExecStart=/usr/local/bin/concourse web

[Install]
WantedBy=multi-user.target

Let's add port 8080 to the ufw rules to get access from another host and start the services:

ufw allow 8080
service start concourse-web.service
service start concourse-worker.service

We are going to add autoloading to the concourse-web and concourse-worker services so that they start automatically when the server starts:

systemctl enable concourse-web concourse-worker

Access to Web-interface

On the command line, run the following command:

fly -t tutorial login -c http://127.0.0.1:8080 -u serverspace -p p@ssw0rd

As a result, we are going to get:

logging in to team 'main'
target saved

Let's check the active component using the command:

fly -t tutorial workers
#Result
name          containers  platform  tags  team  state    version  age
01fb36b82106  0           linux     none  none  running  2.4      1d

The Web interface is checked through a web browser. Enter the server address and port in the address bar.

Concourse CI web interface

Conclusion

As a result, we can say that the following actions were considered:

  • Downloading source files from GitHub;
  • Setting up Concourse and Fly;
  • Setting configuration files;
  • Set up files to start the worker and web services;
  • Create a worker;
  • Login to the web interface.
Vote:
5 out of 5
Аverage rating : 5
Rated by: 4
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.