GoCD team is going to opensource their Chef cookbooks soon that used to manage their build infrastructure. Before the cookbooks are available for public, I have taken few of them and create a private GitHub repository and used it to setup GoCD server and agent with AWS OpsWorks.
* This is a non-SSL GoCD Server setup. For SSL (Apache fronted) configuration, it will be on my next post.
** I will update this post when GoCD team makes their cookbooks available for public
Before we create a new stack, we need to define two new security groups in order for Go agent to communicate with Go server through the internal network.
After the two security groups are created, go to OpsWorks and create a new Chef 12 stack
After the stack is created, let’s create a new layer called “GoCD Server”
In the “General Settings” of GoCD Server layer, we will provide few attributes in JSON that will be used by the GoCD cookbooks to configure the GoCD server
Then add three recipes, “yum-pgdg::default”, “yum-gocd::default” and “go-server-wrapper::default”
Under “Security”, we will add three security groups to the GoCD Server layer, “AWS-OpsWorks-Default-Server”, “AWS-OpsWorks-GoCD-Server” and “AWS-OpsWorks-Web-Server”
After GoCD Server Layer is ready, we can add a new instance called “gocd-server”
Wait for the new instance to be ready.
Find the Public DNS of this GoCD Server instance
Open your browser and go to that URL, you GoCD Server is ready.
Let’s enable Go agent auto registration on the Go Server.
To setup GoCD agent, we will define a new layer called “GoCD Linux Dev Agent”
In the “General Settings” of GoCD Linux Dev Agent layer, we will provide few attributes in JSON that will be used by the GoCD cookbooks to configure the GoCD Linux Dev Agent.
Then add three recipes, “yum-repoforge::default”, “yum-gocd::default” and “go-agent::default”
Apply the two Security Groups “AWS-OpsWorks-Default-Server” and “AWS-OpsWorks-GoCD-Agent” to this layer.
Add a new instance in this layer and start the instance
When this instance is ready, you will see the agent automatically register on Go Server.