Sunday, June 14, 2020

How To Setup Concourse-CI Server On Ubuntu 18.04 LTS

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Concourse CI is a modern, flexible continuous integration platform that allows developers to merge modified code into a shared repository multiple times. After each merge, automatic builds and tests are performed to detect problems in the code that helps the developers to find and resolve the errors quickly.

https://concourse.ci/  || https://github.com/concourse/concourse

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Testing Environment:

Ubuntu 18.04.LTS                     Hostname - www.example.com     - ip Address - 192.168.1.50

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

apt update ; apt install -y build-essential net-tools curl git software-properties-common postgresql postgresql-contrib

systemctl enable postgresql

cd /tmp

sudo -u postgres createuser concourse

sudo -u postgres createdb --owner=concourse atc

wget https://github.com/concourse/concourse/releases/download/v4.2.2/concourse_linux_amd64

wget https://github.com/concourse/concourse/releases/download/v4.2.2/fly_linux_amd64

chmod +x concourse_linux_amd64 fly_linux_amd64

mv concourse_linux_amd64 /usr/bin/concourse ; mv fly_linux_amd64 /usr/bin/fly


mkdir /etc/concourse

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

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

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

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


nano /etc/concourse/web_environment

CONCOURSE_ADD_LOCAL_USER=ruan:pass

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_HOST=127.0.0.1

CONCOURSE_POSTGRES_USER=concourse

CONCOURSE_POSTGRES_PASSWORD=concourse

CONCOURSE_POSTGRES_DATABASE=atc

CONCOURSE_MAIN_TEAM_LOCAL_USER=ruan

CONCOURSE_EXTERNAL_URL=http://192.168.1.50:8080


nano /etc/concourse/worker_environment

CONCOURSE_WORK_DIR=/var/lib/concourse

CONCOURSE_TSA_HOST=127.0.0.1:2222

CONCOURSE_TSA_PUBLIC_KEY=/etc/concourse/tsa_host_key.pub

CONCOURSE_TSA_WORKER_PRIVATE_KEY=/etc/concourse/worker_key


mkdir /var/lib/concourse ; adduser --system --group concourse

chown -R concourse:concourse /etc/concourse /var/lib/concourse ; chmod 600 /etc/concourse/*_environment


nano /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/bin/concourse web


[Install]

WantedBy=multi-user.target


nano /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/bin/concourse worker


[Install]

WantedBy=multi-user.target


cd /home/concourse/ ; sudo -u concourse psql atc

ALTER USER concourse WITH PASSWORD 'concourse';

\q


systemctl start concourse-web concourse-worker ; systemctl enable concourse-web concourse-worker postgresql

systemctl status concourse-web concourse-worker ; systemctl is-active concourse-worker concourse-web

netstat -tulpn

concourse -version ; fly -version

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1 comment:

  1. great video and code. would like to see an updated one for 2022. thanks anyway

    ReplyDelete