Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Automating infrastructure with ruby - Tiago Macedo
Search
Daniel Lopes
October 11, 2013
Programming
0
680
Automating infrastructure with ruby - Tiago Macedo
Slide deck used by Tiago Macedo on Coimbra.rb (organized by
http://whitesmith.co
)
Daniel Lopes
October 11, 2013
Tweet
Share
More Decks by Daniel Lopes
See All by Daniel Lopes
RubyMotion - Ruby for iOS
danielflopes
0
690
Calabash
danielflopes
0
610
Other Decks in Programming
See All in Programming
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
260
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
820
Systèmes distribués, pour le meilleur et pour le pire - BreizhCamp 2025 - Conférence
slecache
0
120
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
550
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
21
4k
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
220
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
420
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
220
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
150
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
130
AIともっと楽するE2Eテスト
myohei
6
2.6k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
GraphQLとの向き合い方2022年版
quramy
49
14k
BBQ
matthewcrist
89
9.7k
How to Ace a Technical Interview
jacobian
278
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Side Projects
sachag
455
42k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
6
300
Why Our Code Smells
bkeepers
PRO
336
57k
Transcript
Automating Infrastructure with Ruby
DevOps
• Repeatability • Automation • Agility • Scalability • Reassurance
• Disaster Recovery Infrastructure as Code Test-Driven Infrastructure with Chef By Stephen Nelson-Smith
Configuration Management
Puppet package { 'apache2': provider=>'apt', ensure=>'installed' } service { 'apache2':
ensure=>'running' }
Chef package 'apache2' service 'apache2' do action [ :enable, :start
] end
Chef %w(mysql-server apache2).each do |s| package s service s do
action [ :enable, :start ] end end
Chef ruby_block "add users to passwords file" do block do
require 'webrick/httpauth/htpasswd' passwd = WEBrick::HTTPAuth::Htpasswd.new(nginx[:pass_file]) nginx[:users].each do |u| passwd.set_passwd( 'Auth', u['username'], u['password'] ) end passwd.flush end end
Chef name "varnish" description "Varnish caching proxy for Solr" run_list
'varnish' default_attributes( :varnish => { :malloc => '3G', :backend => { :nodes => Configuration::Server.all.select { |s| s.solr_slave? && s.production? }.map{|s| s.name}, :port => 30002 } } )
Chef { "run_list" : [ "role[staging_server]" ], "database_config" : {
"staging" : { "database" : "staging", "adapter" : "mysql2", "reconnect" : "true", "host" : "localhost", "username" : "staging", "encoding" : "utf8" } } }
Chef server "lisbon", :staging_server do natted! attributes( :database_config => {
:staging => { :adapter => "mysql2", :database => "staging", :encoding => "utf8", :reconnect => "true", :username => "staging", :host => "localhost" } } ) end
Chef package 'haproxy' template '/etc/haproxy/haproxy.cfg' do variables :port => 80
owner 'haproxy' end service 'haproxy' do action [:start] end
Chef package 'nginx' template '/etc/nginx/nginx.cfg' do variables :port => 80
owner 'nginx' end service 'nginx' do action [:start] end
Chef file '/home/user/scripts/remove_some_file' do content “rm some_random_file“ end file '/home/user/scripts/remove_some_file'
do action :delete end
• VMs • OpenVZ • Docker Immutable Infrastructure / Deployments
Vagrant
Capistrano config/deploy/vagrant.rb ssh_options[:port] = 2222 server 'localhost', :web, :app cap
vagrant deploy
fog
Bootstrapping Fog::Compute.new(credentials).servers.create( flavor_id: flavor_id, image_id: image_id, name: name, public_key_path: ssh_key_path
)
Load Balancers elb = Fog::AWS::ELB.new(credentials) listener = {'Protocol' => 'HTTP',
'LoadBalancerPort' => 80, 'InstancePort' => 80, 'InstanceProtocol' => 'HTTP'} elb.create_load_balancer('us-east-1a', 'my-elb',[listener]) ids = Fog::Compute.new(credentials).servers.map {|s| s.id} elb.register_instances_with_load_balancer(ids, 'my-elb')
DNS dns = Fog::DNS.new(credentials) zone = dns.zones.get('mydomain.com') zone.records.create( :name =>
'foo.mydomain.com', :value => '127.0.0.1', :type => 'A')