Infrastructure
As Code
Hello!
I am Tom Tsai (smalltown)
I am here because I want share
something with you
You can find me at:
smalltown@awsug.tw
Why Coding?
hipster?
Benefits!!
✖ Reproducible
✖ Save Your Valuable Time
✖ Avoid Human Error
✖ Not Out of Date Like Document
✖ ...
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
All Demo Sample Code
✖ https://goo.gl/wnU8M
n
Before Start...
✖ Meet Requirement
✖ Well documentation, high popularity
✖ CLI + Code/Configuration, avoid to
manage manually
✖ How to manage configuration
○ From CLI
○ Define in the configuration file
○ Define in the code
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Jenkins: Pipeline AS Code
✖ CI/CD Framework with Rich Plugins
Jenkins: Pipeline AS Code
✖ Use Job DSL & Pipeline Plugin
Transform General Job Into Code
Seed Job
Job A
DSL
Job B
DSL
Job A
Pipeline
Job B
Pipeline
+
+
Job A
Job B
Demo
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Terraform: Infrastructure AS Code
✖ Avoid to Manage Your Public Cloud
Resources Manually
Terraform: Infrastructure AS Code
✖ Define Public Cloud Resources with
Terraform Provider
resource "aws_s3_bucket" "b" {
bucket = "my_tf_test_bucket"
acl = "private"
tags { Name = "My bucket" }
}
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
CM: Provision AS Code
✖ Record Your Provision Procedure
with CM Tool, Not Document
Document:
- Easy Out of Date
- Hard to Maintain
CM: Provision AS Code
✖ Put CM Script Together With
Application Repository
App Repo/
├── CHANGELOG.md
├── Of Course Your Code
├── Provision Script
├── ...
└── README.md
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Packer: Image AS Code
✖ Handle All The Image Building Flow
Packer: Image AS Code
✖ Integrate With CM Tools
+
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Docker: Server AS code
✖ Build, Ship, Run Every Environment
✖ Immutable Infrastructure
Docker: Server AS code
✖ Build, Ship, Run Every Environment
✖ Immutable Infrastructure
1. Push tag to
trigger webhook
2. Execute Packer
to provision image
3. Get Provision
script from Ansible
4. Push Image to
docker Registry,
image tag equal to
git tag
Demo
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Kubernetes: Orchestration AS Code
✖ Automating Deployment, Scaling and
Management of Containerized
Applications
Kubernetes
Kubernetes: Orchestration AS Code
✖ Kubernetes Use YAML File to Define
How Container Lives in the Cluster
Demo
Outline
Terraform
Jenkins
Packer
Kubernetes
Docker
CM
ChatOps
Git
Public Cloud
Hubot: Chat As Code
✖ Hubot is a Robot Sidekick, Ami to
Improve Employee Efficiency
✖ Don’t be Interrupted Anymore
Hubot: Chat As Code
✖ Hubot Use CoffeeScript to Let Human
Interact With Service Easily
...
Demo
works like a charm !!
Thanks!
Any questions?
http://s.drx.tw/iac

COSCUP 2017 - infrastructure As Code