GOCD is a software delivery automation tool. It let’s you create pipelines to manage and visualize your software deliveries. It’s a tool provided by Thoughtworks to help you do continuous delivery. It’s similar in function to Jenkins.
I’ve been using GOCD in production for the past two years. It’s very simple to understand and to begin using. In this article I’ll be showing how I installed GOCD on Ubuntu.
Features of GOCD include
- Parallel and sequential executin
- Easily configures dependencies using fan-in/fan-out
- Anchors every pipeline instance to a changeset
- Makes it easy to pass once-built binaries (known as artifacts) between stages of pipelines
- I used an Ubuntu 16.04 Vagrant Box on VirtualBox
- Java Run Time Environment (JRE 8)
The official installation instructions list all pre-requisites. See link at end of document
Install JRE 8
vagrant@vagrant:~$ sudo apt-get update
Use Ubuntu’s compiled JRE. You could install the JDK instead which contains the JRE by default. But we only need the JRE
vagrant@vagrant:~$ sudo apt-get install default-jre
You may have several versions of Java installed, use this command to specify that JRE8 should be used by default
vagrant@vagrant:~$ sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1091 auto mode 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode 2 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1091 manual mode Press <enter> to keep the current choice[*], or type selection number: 1
You can see this link for reference on installing Java: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
Run the following to install GOCD
$ echo "deb https://download.gocd.io /" | sudo tee /etc/apt/sources.list.d/gocd.list $ curl https://download.gocd.io/GOCD-GPG-KEY.asc | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install go-server
Now you can start the GOCD server
$ sudo /etc/init.d/go-server start [Wed Mar 8 02:09:05 UTC 2017] using default settings from /etc/default/go-server Started Go Server on http://vagrant:8153/go
- In case of an error starting GOCD, view the logs at /var/log/go-server/go-server.out.log
- As you can see once the server starts it tells you the URL to access it. Since we’running on a vagrant box you’ll have to make this port available as shown on the next step below
- My installation failed originally because I tried using Ubuntu4
- Then my installation failed because I hadn’t installed JRE8
- Then my installation failed because I needed to set JRE8 as the default.
- After fixing these issues my installation worked
Location of files:
/var/lib/go-server #contains the binaries and database /etc/go #contains the pipeline configuration files /var/log/go-server #contains the server logs /usr/share/go-server #contains the start script /etc/default/go-server #contains all the environment variables with default values. These variable values can be changed as per requirement.
Connecting to GOCD
Enable port mapping on your Vagrant box (guest machine) to allow access to port 8153 on it to the host machine (in my case my windows system). Simply add the “config.vm.network” line to your Vagrantfile as shown below.
Vagrant.configure("2") do |config| config.vm.box = "bento/ubuntu-16.04" config.vm.network "forwarded_port", guest: 8153, host: 8153 end
Then you need to reload your vagrantbox
> vagrant reload
Now I was able to restart up GOCD paste the URL into Chrome and view GOCD.
$ sudo apt-get install go-agent Installation of GoCD Agent completed. Now please edit /etc/default/go-agent and set GO_SERVER_URL to the url address of your GoCD Server (https://example.com:8154/go). To ensure full end-to-end transport security between the agent and server see https://docs.gocd.io/current/installation/ssl_tls/end_to_end_transport_security.html Once that is done start the GoCD Agent with '/etc/init.d/go-agent start'
Make sure the agen’ts config file is using ‘localhost’
vagrant@vagrant:~$ sudo vim /etc/default/go-agent
Start the agent
vagrant@vagrant:~$ sudo /etc/init.d/go-agent start [Wed Mar 8 09:26:08 UTC 2017] using default settings from /etc/default/go-agent Started Go Agent.
Now register the agent with the server
Official installation instructions: