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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Daniel Lopes
October 11, 2013
Programming
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by Daniel Lopes
See All by Daniel Lopes
RubyMotion - Ruby for iOS
danielflopes
0
1k
Calabash
danielflopes
0
950
Other Decks in Programming
See All in Programming
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
390
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
5.5k
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
110
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
JavaDoc 再入門
nagise
1
370
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
270
Oxlintのカスタムルールの現況
syumai
6
1.1k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
410
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
240
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
110
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
140
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
400
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
180
GraphQLとの向き合い方2022年版
quramy
50
15k
HDC tutorial
michielstock
2
720
Unsuck your backbone
ammeep
672
58k
Deep Space Network (abreviated)
tonyrice
0
210
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Prompt Engineering for Job Search
mfonobong
0
350
Utilizing Notion as your number one productivity tool
mfonobong
4
320
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
350
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')