Installing Concourse on nixOS Latest
Concourse is an open-source continuous integration and delivery system that utilizes a pipeline-based workflow to automate the building, testing, and deploying of software applications. In this tutorial, we will discuss the steps to install Concourse on nixOS Latest.
Prerequisites
- A nixOS Latest instance.
Installation
Open a terminal window.
Update your system by running the following command:
sudo nix-channel --update
sudo nixos-rebuild switch
- Install Concourse by running the following command:
sudo nix-env -i concourse
- Create a Concourse initialization file (
concourse-web.service) in the/etc/systemd/systemdirectory by running the following command:
sudo nano /etc/systemd/system/concourse-web.service
- In the file, paste the following code block:
[Unit]
Description=Concourse web server
[Service]
User=concourse
Group=concourse
Restart=on-failure
ExecStart=/bin/bash -c "/run/current-system/sw/bin/concourse web \
--basic-auth-username=myuser \
--basic-auth-password=mypassword \
--session-signing-key=/etc/concourse/session_signing_key \
--tsa-host-key=/etc/concourse/worker_key \
--tsa-authorized-keys=/etc/concourse/authorized_worker_keys \
--tsa-external-url=http://ci.example.com:8080 \
--postgres-data-source=postgres://myuser:mypassword@localhost:5432/atc \
--add-local-user=myuser:mypassword \
2>&1 | tee /var/log/concourse/web.log"
[Install]
WantedBy=multi-user.target
This code creates a Concourse web service that listens on http://ci.example.com:8080 and authenticates users myuser and mypassword.
- Create a Concourse worker initialization file (
concourse-worker.service) in the/etc/systemd/systemdirectory by running the following command:
sudo nano /etc/systemd/system/concourse-worker.service
- In the file, paste the following code block:
[Unit]
Description=Concourse worker
[Service]
User=concourse
Group=concourse
Restart=on-failure
ExecStart=/bin/bash -c "/run/current-system/sw/bin/concourse worker \
--work-dir=/var/lib/concourse/worker \
--tsa-host=127.0.0.1 \
--tsa-public-key=/etc/concourse/worker_key.pub \
--tsa-worker-private-key=/etc/concourse/worker_key \
--baggageclaim-driver=aufs \
--privileged \
2>&1 | tee /var/log/concourse/worker.log"
[Install]
WantedBy=multi-user.target
- Change ownership of the
/var/lib/concoursedirectory and its subdirectories to theconcourseuser by running the following command:
sudo chown concourse:concourse -R /var/lib/concourse
- Start and enable the Concourse web and worker services by running the following command:
sudo systemctl start concourse-web.service
sudo systemctl start concourse-worker.service
sudo systemctl enable concourse-web.service
sudo systemctl enable concourse-worker.service
- Verify that Concourse is working by opening a web browser and navigating to the URL http://ci.example.com:8080. You should see the Concourse user interface.
Congratulations! You have successfully installed Concourse on nixOS Latest.