SlideShare a Scribd company logo
1 of 27
Download to read offline
Delivering Go.CD
with Terraform and Docker
http://www.google.com/about/datacenters/gallery/#/all/2
About me
Jorrit Salverda
Principle something at Travix
I automate...
● builds
● deployments
● infrastructure
What is Go.CD?
resource "google_compute_instance" "gocd_demo_agent" {
name = "gocd-demo-agent"
machine_type = "n1-standard-2"
zone = "${var.google_region}"
disk {
image = "container-vm"
auto_delete = "true"
}
And Terraform?
Containers...
● bundle dependencies
● allow content-agnostic manipulation
● deploy very fast
● run anywhere
Why Docker?
Live demo
What’s next?
● Monitoring
● Ship logs
● Volume plugins
● Shrink container image
● Run on Kubernetes
● Windows agents for .net builds
Thanks
jsalverda@travix.com
@jorritsalverda
Docker images
● travix/gocd-server
● travix/gocd-haproxy
● travix/gocd-agent
Appendix
Terraform - variables
variable "google_project" {
default = "google-project-name"
}
variable "google_region" {
default = "europe-west1-b"
}
Terraform - providers
provider "google" {
account_file = "${file("google-service-account-key.json")}"
project = "${var.google_project}"
region = "${var.google_region}"
}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}
Terraform - persistent disks
resource "google_compute_disk" "gocd_demo_server_persistent_data" {
name = "gocd-demo-server-persistent-data"
zone = "${var.google_region}"
type = "pd-ssd"
size = "200"
}
Terraform - compute instances
resource "google_compute_instance" "gocd_demo_server" {
name = "gocd-demo-server"
machine_type = "n1-standard-2"
zone = "${var.google_region}"
disk { image = "container-vm" }
...
Terraform - compute instances
...
network_interface {
network = "private-dev"
access_config { // Ephemeral IP }
}
metadata {
startup-script = "${file("bootstrap/gocd-demo-server-startup.sh")}"
google-container-manifest = "${file("bootstrap/gocd-demo-server-containers.yml")}"
}
}
Terraform - outputs
output "output_google_compute_instance_gocd_demo_server_internal_ip_address" {
value = "${google_compute_instance.gocd_demo_server.network_interface.0.address}"
}
output "output_google_compute_instance_gocd_demo_server_external_ip_address" {
value = "${google_compute_instance.gocd_demo_server.network_interface.0.access_config.
0.nat_ip}"
}
Dockerfile travix/gocd-server
FROM travix/base-debian-git-jre7:latest
MAINTAINER Travix
# build time environment variables
ENV GO_VERSION=15.2.0-2248 
USER_NAME=go 
USER_ID=999 
GROUP_NAME=go 
GROUP_ID=999
Dockerfile travix/gocd-server
# install go server
RUN groupadd -r -g $GROUP_ID $GROUP_NAME 
&& useradd -r -g $GROUP_NAME -u $USER_ID -d /var/go $USER_NAME 
&& curl -fSL "http://download.go.cd/gocd-deb/go-server-$GO_VERSION.deb" 
-o go-server.deb 
&& dpkg -i go-server.deb 
&& rm -rf go-server.db 
&& sed -i -e "s/DAEMON=Y/DAEMON=N/" /etc/default/go-server
Dockerfile travix/gocd-server
# runtime environment variables
ENV SERVER_MEM=512m 
SERVER_MAX_MEM=1024m 
SERVER_MIN_PERM_GEN=128m 
SERVER_MAX_PERM_GEN=256m 
AGENT_KEY=""
# expose ports
EXPOSE 8153 8154
Dockerfile travix/gocd-server
# define default command
CMD groupmod -g ${GROUP_ID} ${GROUP_NAME}; 
usermod -g ${GROUP_ID} -u ${USER_ID} ${USER_NAME}; 
chown -R ${USER_NAME}:${GROUP_NAME} /var/lib/go-server /var/log/go-server /etc/go; 
(/bin/su - ${USER_NAME} -c "/usr/share/go-server/server.sh &"); 
until curl -s -o /dev/null 'http://localhost:8153'; 
do sleep 1; 
done; 
/bin/su - ${USER_NAME} -c "exec tail -F /var/log/go-server/*"
Startup script
#! /bin/bash
# create users for mounting local directories as container volumes
sudo groupadd -r -g 999 go
sudo useradd -r -g go -u 999 go
sudo groupadd -r -g 998 haproxy
sudo useradd -r -g haproxy -u 998 haproxy
# mount local ssd
sudo mkdir -p /mnt/gocd-server-local-ssd
sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/disk/by-id/google-
local-ssd-0 /mnt/gocd-server-local-ssd
sudo resize2fs /dev/disk/by-id/google-local-ssd-0
Kubelet manifest - container
version: v1
kind: Pod
metadata:
name: gocd-server
spec:
containers:
- name: gocd-server
image: travix/gocd-server:latest
imagePullPolicy: Always
Kubelet manifest - volumes
volumeMounts:
- mountPath: /var/lib/go-server/db/h2db
name: gocd-server-db
- mountPath: /etc/go
name: gocd-server-config
volumes:
- name: gocd-server-db
hostPath:
Path: /mnt/gocd-server-persistent-disk/db
- name: gocd-server-config
hostPath:
Path: /mnt/gocd-server-persistent-disk/config
Kubelet manifest - ports
ports:
- name: server-http
containerPort: 8153
hostPort: 8153
protocol: TCP
- name: server-https
containerPort: 8154
hostPort: 8154
protocol: TCP
Kubelet manifest - environment vars
env:
- name: "AGENT_KEY"
value: "secret-key-for-autoregistration"
- name: "SERVER_MEM"
value: "4096m"
- name: "SERVER_MAX_MEM"
value: "4096m"
- name: "SERVER_MIN_PERM_GEN"
value: "1024m"
- name: "SERVER_MAX_PERM_GEN"
value: "1024m"

More Related Content

What's hot

2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java DevelopersNGINX, Inc.
 
Kubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of KubernetesKubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of KubernetesMike Splain
 
Consuming Cinder from Docker
Consuming Cinder from DockerConsuming Cinder from Docker
Consuming Cinder from DockerJohn Griffith
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices Nebulaworks
 
Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Sadique Puthen
 
Supercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSupercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSamantha Quiñones
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoKan Ouivirach, Ph.D.
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
Docker 101 @KACST Saudi HPC 2016
Docker 101  @KACST Saudi HPC 2016Docker 101  @KACST Saudi HPC 2016
Docker 101 @KACST Saudi HPC 2016Walid Shaari
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015Giovanni Toraldo
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Docker, Inc.
 
Terraform 101: What's infrastructure as code?
Terraform 101: What's infrastructure as code?Terraform 101: What's infrastructure as code?
Terraform 101: What's infrastructure as code?GDX Wu
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerKidong Lee
 
Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)bridgetkromhout
 
Docker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityDocker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityLudovic Piot
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016Chris Tankersley
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsSalman Baset
 

What's hot (20)

2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
 
Kubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of KubernetesKubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of Kubernetes
 
Consuming Cinder from Docker
Consuming Cinder from DockerConsuming Cinder from Docker
Consuming Cinder from Docker
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
 
Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28
 
Supercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSupercharging Content Delivery with Varnish
Supercharging Content Delivery with Varnish
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Docker 101 @KACST Saudi HPC 2016
Docker 101  @KACST Saudi HPC 2016Docker 101  @KACST Saudi HPC 2016
Docker 101 @KACST Saudi HPC 2016
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane
 
Terraform 101: What's infrastructure as code?
Terraform 101: What's infrastructure as code?Terraform 101: What's infrastructure as code?
Terraform 101: What's infrastructure as code?
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)
 
Docker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityDocker meetup - PaaS interoperability
Docker meetup - PaaS interoperability
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container Platforms
 

Viewers also liked

Go.cd - the tool that Jenkins ain't
Go.cd - the tool that Jenkins ain'tGo.cd - the tool that Jenkins ain't
Go.cd - the tool that Jenkins ain'tFredrik Wendt
 
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...Stefan Teixeira
 
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amor
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amorMeetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amor
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amorStefan Teixeira
 
Web Service Creation in HTML5
Web Service Creation in HTML5Web Service Creation in HTML5
Web Service Creation in HTML5Tero A. Laiho
 
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...Publicis Sapient Engineering
 
Integrating Puppet with Cloud Infrastructures-Remco Overdijk
Integrating Puppet with Cloud Infrastructures-Remco OverdijkIntegrating Puppet with Cloud Infrastructures-Remco Overdijk
Integrating Puppet with Cloud Infrastructures-Remco OverdijkMaxServ
 
Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningUchit Vyas ☁
 
Terraform and cloud.ca
Terraform and cloud.caTerraform and cloud.ca
Terraform and cloud.caCloudOps2005
 
Infrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to TerraformInfrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to TerraformAlexander Popov
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-TannerDevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-TannerDEVCON
 
Terraform Introduction
Terraform IntroductionTerraform Introduction
Terraform Introductionsoniasnowfrog
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Martin Schütte
 
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...devopsdaysaustin
 
Rediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred TshidimbaRediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred TshidimbaDEVCON
 

Viewers also liked (20)

Go.cd - the tool that Jenkins ain't
Go.cd - the tool that Jenkins ain'tGo.cd - the tool that Jenkins ain't
Go.cd - the tool that Jenkins ain't
 
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...
Agile Testers Conference 2016 - GoCD + Docker + Docker Compose: uma história ...
 
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amor
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amorMeetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amor
Meetup DevOps Carioca - GoCD + Docker + Docker Compose: uma história de amor
 
Web Service Creation in HTML5
Web Service Creation in HTML5Web Service Creation in HTML5
Web Service Creation in HTML5
 
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...
XebiCon'16 : Wescale - GoCD démystifié Aurélien Maury, Directeur Technique et...
 
Integrating Puppet with Cloud Infrastructures-Remco Overdijk
Integrating Puppet with Cloud Infrastructures-Remco OverdijkIntegrating Puppet with Cloud Infrastructures-Remco Overdijk
Integrating Puppet with Cloud Infrastructures-Remco Overdijk
 
Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure Provisioning
 
Terraform
TerraformTerraform
Terraform
 
Terraform and cloud.ca
Terraform and cloud.caTerraform and cloud.ca
Terraform and cloud.ca
 
Infrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to TerraformInfrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to Terraform
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-TannerDevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
 
Terraform at Scale
Terraform at ScaleTerraform at Scale
Terraform at Scale
 
Terraform Introduction
Terraform IntroductionTerraform Introduction
Terraform Introduction
 
Etcd terraform by Alex Somesan
Etcd terraform by Alex SomesanEtcd terraform by Alex Somesan
Etcd terraform by Alex Somesan
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)
 
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
 
Refactoring terraform
Refactoring terraformRefactoring terraform
Refactoring terraform
 
Rediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred TshidimbaRediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred Tshidimba
 

Similar to Delivering Go.CD with Terraform and Docker

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and PracticeBo-Yi Wu
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Otto Kekäläinen
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOpsandersjanmyr
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Bo-Yi Wu
 
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @WayraDeis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @WayraLeo Lorieri
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Ortus Solutions, Corp
 
Docker slides
Docker slidesDocker slides
Docker slidesAyla Khan
 
New Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersNew Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersJeff Anderson
 
The Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptThe Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptDocker, Inc.
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 

Similar to Delivering Go.CD with Terraform and Docker (20)

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOps
 
Docker linuxday 2015
Docker linuxday 2015Docker linuxday 2015
Docker linuxday 2015
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @WayraDeis, a PaaS built with Docker,  Docker Meetup Sao Paulo #3 @Wayra
Deis, a PaaS built with Docker, Docker Meetup Sao Paulo #3 @Wayra
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Docker as development environment
Docker as development environmentDocker as development environment
Docker as development environment
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Docker slides
Docker slidesDocker slides
Docker slides
 
New Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersNew Docker Features for Orchestration and Containers
New Docker Features for Orchestration and Containers
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
The Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptThe Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build Script
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Geode on Docker
Geode on DockerGeode on Docker
Geode on Docker
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Delivering Go.CD with Terraform and Docker

  • 1. Delivering Go.CD with Terraform and Docker http://www.google.com/about/datacenters/gallery/#/all/2
  • 2. About me Jorrit Salverda Principle something at Travix I automate... ● builds ● deployments ● infrastructure
  • 3.
  • 5. resource "google_compute_instance" "gocd_demo_agent" { name = "gocd-demo-agent" machine_type = "n1-standard-2" zone = "${var.google_region}" disk { image = "container-vm" auto_delete = "true" } And Terraform?
  • 6. Containers... ● bundle dependencies ● allow content-agnostic manipulation ● deploy very fast ● run anywhere Why Docker?
  • 8. What’s next? ● Monitoring ● Ship logs ● Volume plugins ● Shrink container image ● Run on Kubernetes ● Windows agents for .net builds
  • 9.
  • 10.
  • 13. Terraform - variables variable "google_project" { default = "google-project-name" } variable "google_region" { default = "europe-west1-b" }
  • 14. Terraform - providers provider "google" { account_file = "${file("google-service-account-key.json")}" project = "${var.google_project}" region = "${var.google_region}" } provider "aws" { access_key = "${var.aws_access_key}" secret_key = "${var.aws_secret_key}" region = "${var.aws_region}" }
  • 15. Terraform - persistent disks resource "google_compute_disk" "gocd_demo_server_persistent_data" { name = "gocd-demo-server-persistent-data" zone = "${var.google_region}" type = "pd-ssd" size = "200" }
  • 16. Terraform - compute instances resource "google_compute_instance" "gocd_demo_server" { name = "gocd-demo-server" machine_type = "n1-standard-2" zone = "${var.google_region}" disk { image = "container-vm" } ...
  • 17. Terraform - compute instances ... network_interface { network = "private-dev" access_config { // Ephemeral IP } } metadata { startup-script = "${file("bootstrap/gocd-demo-server-startup.sh")}" google-container-manifest = "${file("bootstrap/gocd-demo-server-containers.yml")}" } }
  • 18. Terraform - outputs output "output_google_compute_instance_gocd_demo_server_internal_ip_address" { value = "${google_compute_instance.gocd_demo_server.network_interface.0.address}" } output "output_google_compute_instance_gocd_demo_server_external_ip_address" { value = "${google_compute_instance.gocd_demo_server.network_interface.0.access_config. 0.nat_ip}" }
  • 19. Dockerfile travix/gocd-server FROM travix/base-debian-git-jre7:latest MAINTAINER Travix # build time environment variables ENV GO_VERSION=15.2.0-2248 USER_NAME=go USER_ID=999 GROUP_NAME=go GROUP_ID=999
  • 20. Dockerfile travix/gocd-server # install go server RUN groupadd -r -g $GROUP_ID $GROUP_NAME && useradd -r -g $GROUP_NAME -u $USER_ID -d /var/go $USER_NAME && curl -fSL "http://download.go.cd/gocd-deb/go-server-$GO_VERSION.deb" -o go-server.deb && dpkg -i go-server.deb && rm -rf go-server.db && sed -i -e "s/DAEMON=Y/DAEMON=N/" /etc/default/go-server
  • 21. Dockerfile travix/gocd-server # runtime environment variables ENV SERVER_MEM=512m SERVER_MAX_MEM=1024m SERVER_MIN_PERM_GEN=128m SERVER_MAX_PERM_GEN=256m AGENT_KEY="" # expose ports EXPOSE 8153 8154
  • 22. Dockerfile travix/gocd-server # define default command CMD groupmod -g ${GROUP_ID} ${GROUP_NAME}; usermod -g ${GROUP_ID} -u ${USER_ID} ${USER_NAME}; chown -R ${USER_NAME}:${GROUP_NAME} /var/lib/go-server /var/log/go-server /etc/go; (/bin/su - ${USER_NAME} -c "/usr/share/go-server/server.sh &"); until curl -s -o /dev/null 'http://localhost:8153'; do sleep 1; done; /bin/su - ${USER_NAME} -c "exec tail -F /var/log/go-server/*"
  • 23. Startup script #! /bin/bash # create users for mounting local directories as container volumes sudo groupadd -r -g 999 go sudo useradd -r -g go -u 999 go sudo groupadd -r -g 998 haproxy sudo useradd -r -g haproxy -u 998 haproxy # mount local ssd sudo mkdir -p /mnt/gocd-server-local-ssd sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/disk/by-id/google- local-ssd-0 /mnt/gocd-server-local-ssd sudo resize2fs /dev/disk/by-id/google-local-ssd-0
  • 24. Kubelet manifest - container version: v1 kind: Pod metadata: name: gocd-server spec: containers: - name: gocd-server image: travix/gocd-server:latest imagePullPolicy: Always
  • 25. Kubelet manifest - volumes volumeMounts: - mountPath: /var/lib/go-server/db/h2db name: gocd-server-db - mountPath: /etc/go name: gocd-server-config volumes: - name: gocd-server-db hostPath: Path: /mnt/gocd-server-persistent-disk/db - name: gocd-server-config hostPath: Path: /mnt/gocd-server-persistent-disk/config
  • 26. Kubelet manifest - ports ports: - name: server-http containerPort: 8153 hostPort: 8153 protocol: TCP - name: server-https containerPort: 8154 hostPort: 8154 protocol: TCP
  • 27. Kubelet manifest - environment vars env: - name: "AGENT_KEY" value: "secret-key-for-autoregistration" - name: "SERVER_MEM" value: "4096m" - name: "SERVER_MAX_MEM" value: "4096m" - name: "SERVER_MIN_PERM_GEN" value: "1024m" - name: "SERVER_MAX_PERM_GEN" value: "1024m"