SlideShare a Scribd company logo
1 of 57
Infrastructure as Code
Aybüke Özdemir
@aybuke_ozdemir
Halil Kaya
@halilkaya
Kısa bir örnekle kod tabanlı altyapının önemi
Yeni bir projeye başlıyoruz
Biz Ruby on Rails’ı seçtik
> gem install rails
> gem install rails
Fetching: i18n-0.7.0.gem (100%)
Fetching: json-1.8.3.gem (100%)
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
creating Makefile
make
sh: 1: make: not found
Tabii ki önce make’i kurmamız gerek!
> sudo apt-get install make
...
Success!
> gem install rails
> gem install rails
Fetching: nokogiri-1.6.7.2.gem (100%)
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0.rc2
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Hmm. Stackoverflow’a baksak iyi olacak sanki...
> sudo apt-get install zlib1g-dev
...
Success!
> gem install rails
> gem install rails
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0.rc2
checking for gzdopen() in -lz... yes
checking for iconv... yes
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux-
gnu/ports/libxml2/2.9.2... OK
*** extconf.rb failed ***
Stackoverflow’da 2 saat geçirdikten sonra...
> gem install rails
> gem install rails
...
Success!
> rails new my-project
> cd my-project
> rails start
> rails new my-project
> cd my-project
> rails start
/source/my-project/bin/spring:11:in `<top (required)>`:
undefined method `path_separator` for Gem:Module
(NoMethodError)
from bin/rails:3:in `load`
from bin/rails:3:in `<main>`
… uzunca bir süre sonra
bir şekilde proje çalışır!
Production
> bundle update rails
> bundle update rails
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0.rc2
checking for gzdopen() in -lz... yes
checking for iconv... yes
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux-
gnu/ports/libxml2/2.9.2... OK
*** extconf.rb failed ***
Aslında problem Rails ya da Django değil.
Problem sunucuyu elle yapılandırmakta!
Configuration
Management
IAC
Provisioning
Configuration
Management
nginx
conf
- tek tek elle?
- tek tek elle?
- script?
- tek tek elle?
- script?
- scp veya rsync?
- tek tek elle?
- script?
- scp veya rsync?
- tmux cluster ssh?
- tek tek elle?
- script?
- scp veya rsync?
- tmux cluster ssh?
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
“production” başlığı altındaki makinalar
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
“deployment” kullanıcısı ile
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
sudo yetkisi ile
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
“nginx” paketini kur
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
önceden hazırlanmış nginx
yapılandırma dosyasını ilgili
yere kopyala
- hosts: production
remote_user: deployment
become: true
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Copy nginx conf file
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
- name: Reload nginx
service:
name: nginx
state: reloaded
nginx servisini reload et
Provisioning
cloud
LoadBalancer
Instance Group
Network
Firewall
Disks & Images
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1”
zone = “europe-west1-d”
boot_disk {
initialize_params {
image = “debian-cloud/debian-8”
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [
“${google_compute_instance.prod-1.self_link}”,
]
}
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1”
zone = “europe-west1-d”
boot_disk {
initialize_params {
image = “debian-cloud/debian-8”
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [
“${google_compute_instance.prod-1.self_link}”,
]
}
- resource tipi
- resource ismi
- GCE’deki instance ismi
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1” GCE’deki makine tipi
zone = “europe-west1-d”
boot_disk {
initialize_params {
image = “debian-cloud/debian-8”
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [
“${google_compute_instance.prod-1.self_link}”,
]
}
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1”
zone = “europe-west1-d” makinenin açılacağı datacenter bölgesi
boot_disk {
initialize_params {
image = “debian-cloud/debian-8”
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [
“${google_compute_instance.prod-1.self_link}”,
]
}
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1”
zone = “europe-west1-d”
boot_disk {
initialize_params {
image = “debian-cloud/debian-8” debian 8 imajıyla boot diski oluştur
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [
“${google_compute_instance.prod-1.self_link}”,
]
}
resource “google_compute_instance” “prod-1” {
name = “prod-1”
machine_type = “n1-standard-1”
zone = “europe-west1-d”
boot_disk {
initialize_params {
image = “debian-cloud/debian-8”
}
}
}
resource “google_compute_instance_group” “prod” {
name = “prod”
zone = “europe-west1-d”
instances = [ oluşturduğun makineyi
“${google_compute_instance.prod-1.self_link}”, bu instance group’a
] koy
}
> terraform plan
> terraform apply
Faydalar
- tekrar kullanılabilirlik
- otomasyon
- version control
- gözden geçirme
- döküman
- başka bir cloud sistemine geçiş kolaylığı
Olası Sorunlar
- state dosyası!
- araç kullanırken elle yapılandırma!
- hala tam anlamıyla olgunlaşmış değil!
- uygulama yöntemindeki muhtemel sosyal sorunlar!
- var olan bir projeyi IAC’a taşıma(!)
Chef Puppet Ansible SaltStack CloudFormation Terraform
Code Open Source Open Source Open Source Open
Source
Closed Source Open Source
Cloud All All All All AWS Only All
Type Config Mngt Config Mngt Config Mngt Config Mngt Provisioning Provisioning
Infrastructure Mutable Mutable Mutable Mutable Immutable Immutable
Language Procedural Declarative Procedural Declarative Declarative Declarative
Architecture Client/Server Client/Server Client-Only Client/Server Client-Only Client-Only
Kaynaklar
- Infrastructure as code: running microservices on
AWS using Docker, Terraform and ECS
- Why we use Terraform and not Chef, Puppet,
Ansible, SaltStack, or CloudFormation
- https://www.ybrikman.com/writing/2016/03/31/i
nfrastructure-as-code-microservices-aws-docker-
terraform-ecs/

More Related Content

What's hot

Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點William Yeh
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしHiroshi SHIBATA
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the scoreRafael Dohms
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Chu-Siang Lai
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultBram Vogelaar
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)Soshi Nemoto
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Puppet
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsBen Hall
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environmentsApptension
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 

What's hot (20)

Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなし
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the score
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environments
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 

Similar to Infrastructure as Code (IaC

Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformniyof97
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725miguel dominguez
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725MortazaJohari
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Yevgeniy Brikman
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and LingvokotLingvokot
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016Susan Potter
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureHabeeb Rahman
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
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.
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012rivierarb
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment TacticsIan Barber
 
[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
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 

Similar to Infrastructure as Code (IaC (20)

Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
RunX ELCE 2020
RunX ELCE 2020RunX ELCE 2020
RunX ELCE 2020
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
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
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
[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
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 

Recently uploaded

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

Infrastructure as Code (IaC

  • 1. Infrastructure as Code Aybüke Özdemir @aybuke_ozdemir Halil Kaya @halilkaya
  • 2. Kısa bir örnekle kod tabanlı altyapının önemi
  • 3. Yeni bir projeye başlıyoruz
  • 4. Biz Ruby on Rails’ı seçtik
  • 6. > gem install rails Fetching: i18n-0.7.0.gem (100%) Fetching: json-1.8.3.gem (100%) Building native extensions. This could take a while… ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb creating Makefile make sh: 1: make: not found
  • 7. Tabii ki önce make’i kurmamız gerek!
  • 8. > sudo apt-get install make ... Success!
  • 10. > gem install rails Fetching: nokogiri-1.6.7.2.gem (100%) Building native extensions. This could take a while… ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. Using mini_portile version 2.0.0.rc2 checking for gzdopen() in -lz... no zlib is missing; necessary for building libxml2 *** extconf.rb failed ***
  • 11. Hmm. Stackoverflow’a baksak iyi olacak sanki...
  • 12. > sudo apt-get install zlib1g-dev ... Success!
  • 13. > gem install rails
  • 14. > gem install rails Building native extensions. This could take a while… ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. Using mini_portile version 2.0.0.rc2 checking for gzdopen() in -lz... yes checking for iconv... yes Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux- gnu/ports/libxml2/2.9.2... OK *** extconf.rb failed ***
  • 15.
  • 16. Stackoverflow’da 2 saat geçirdikten sonra...
  • 17. > gem install rails
  • 18. > gem install rails ... Success!
  • 19. > rails new my-project > cd my-project > rails start
  • 20. > rails new my-project > cd my-project > rails start /source/my-project/bin/spring:11:in `<top (required)>`: undefined method `path_separator` for Gem:Module (NoMethodError) from bin/rails:3:in `load` from bin/rails:3:in `<main>`
  • 21.
  • 22. … uzunca bir süre sonra bir şekilde proje çalışır!
  • 24.
  • 26. > bundle update rails Building native extensions. This could take a while… ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. Using mini_portile version 2.0.0.rc2 checking for gzdopen() in -lz... yes checking for iconv... yes Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux- gnu/ports/libxml2/2.9.2... OK *** extconf.rb failed ***
  • 27.
  • 28. Aslında problem Rails ya da Django değil. Problem sunucuyu elle yapılandırmakta!
  • 32. - tek tek elle?
  • 33. - tek tek elle? - script?
  • 34. - tek tek elle? - script? - scp veya rsync?
  • 35. - tek tek elle? - script? - scp veya rsync? - tmux cluster ssh?
  • 36. - tek tek elle? - script? - scp veya rsync? - tmux cluster ssh?
  • 37. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded
  • 38. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded “production” başlığı altındaki makinalar
  • 39. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded “deployment” kullanıcısı ile
  • 40. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded sudo yetkisi ile
  • 41. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded “nginx” paketini kur
  • 42. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded önceden hazırlanmış nginx yapılandırma dosyasını ilgili yere kopyala
  • 43. - hosts: production remote_user: deployment become: true tasks: - name: Install nginx apt: name: nginx state: present - name: Copy nginx conf file template: src: nginx.conf.j2 dest: /etc/nginx/nginx.conf - name: Reload nginx service: name: nginx state: reloaded nginx servisini reload et
  • 46. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” zone = “europe-west1-d” boot_disk { initialize_params { image = “debian-cloud/debian-8” } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ “${google_compute_instance.prod-1.self_link}”, ] }
  • 47. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” zone = “europe-west1-d” boot_disk { initialize_params { image = “debian-cloud/debian-8” } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ “${google_compute_instance.prod-1.self_link}”, ] } - resource tipi - resource ismi - GCE’deki instance ismi
  • 48. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” GCE’deki makine tipi zone = “europe-west1-d” boot_disk { initialize_params { image = “debian-cloud/debian-8” } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ “${google_compute_instance.prod-1.self_link}”, ] }
  • 49. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” zone = “europe-west1-d” makinenin açılacağı datacenter bölgesi boot_disk { initialize_params { image = “debian-cloud/debian-8” } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ “${google_compute_instance.prod-1.self_link}”, ] }
  • 50. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” zone = “europe-west1-d” boot_disk { initialize_params { image = “debian-cloud/debian-8” debian 8 imajıyla boot diski oluştur } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ “${google_compute_instance.prod-1.self_link}”, ] }
  • 51. resource “google_compute_instance” “prod-1” { name = “prod-1” machine_type = “n1-standard-1” zone = “europe-west1-d” boot_disk { initialize_params { image = “debian-cloud/debian-8” } } } resource “google_compute_instance_group” “prod” { name = “prod” zone = “europe-west1-d” instances = [ oluşturduğun makineyi “${google_compute_instance.prod-1.self_link}”, bu instance group’a ] koy }
  • 52. > terraform plan > terraform apply
  • 53. Faydalar - tekrar kullanılabilirlik - otomasyon - version control - gözden geçirme - döküman - başka bir cloud sistemine geçiş kolaylığı
  • 54. Olası Sorunlar - state dosyası! - araç kullanırken elle yapılandırma! - hala tam anlamıyla olgunlaşmış değil! - uygulama yöntemindeki muhtemel sosyal sorunlar! - var olan bir projeyi IAC’a taşıma(!)
  • 55. Chef Puppet Ansible SaltStack CloudFormation Terraform Code Open Source Open Source Open Source Open Source Closed Source Open Source Cloud All All All All AWS Only All Type Config Mngt Config Mngt Config Mngt Config Mngt Provisioning Provisioning Infrastructure Mutable Mutable Mutable Mutable Immutable Immutable Language Procedural Declarative Procedural Declarative Declarative Declarative Architecture Client/Server Client/Server Client-Only Client/Server Client-Only Client-Only
  • 56.
  • 57. Kaynaklar - Infrastructure as code: running microservices on AWS using Docker, Terraform and ECS - Why we use Terraform and not Chef, Puppet, Ansible, SaltStack, or CloudFormation - https://www.ybrikman.com/writing/2016/03/31/i nfrastructure-as-code-microservices-aws-docker- terraform-ecs/