SlideShare une entreprise Scribd logo
1  sur  23
Automated Server Configuration and Web Site Deployments with Chef and Capistrano NLIT Summit 2011 Nick Muerdter 06/15/2011
2 Photo from National Library NZ http://www.flickr.com/photos/nationallibrarynz_commons/5015573731
3 Bringing Order Photo from U.S. National Archives http://www.flickr.com/photos/usnationalarchives/4011449131
4 Party like it’s 2011! Image © Hanna-Barbera and Warner Bros. Entertainment Inc.
5 Photo by hey skinny http://www.flickr.com/photos/heyskinny/1464641723
6 ,[object Object]
Automates commands over SSH to multiple servers
Encapsulates deployment best practices
Ruby on Rails based, but easily does moreWhat Is Capistrano?
Getting Started With Capistrano 7 $sudo gem install capistranocapistrano-ext $cd my_project $capify . [add] writing './Capfile' [add] making directory './config' [add] writing './config/deploy.rb' [done] capified!
Sample config/deploy.rb 8 require"capistrano/ext/multistage" set :application, "my_project" # Supported: `accurev`, `bzr`, `cvs`, `darcs`, `git`, # `mercurial`, `perforce`, `subversion` or `none` set :scm, :subversion set :repository, "https://svn.nrel.gov/my_project/trunk" set :deploy_to, "/var/www/my_project"
Sample config/deploy/development.rb 9 # Set the servers for this stage. role :app, "dev.nrel.gov" role :web, "dev.nrel.gov" role :db,  "dev-db.nrel.gov" # Reduce the number of copies kept for the # development environment. set :keep_releases, 2
Sample config/deploy/staging.rb 10 # Set the servers for this stage. role :app, "staging.nrel.gov" role :web, "staging.nrel.gov" role :db,  "staging-db.nrel.gov"
Sample config/deploy/production.rb 11 # Set the servers for this stage. role :app, "nrel.gov" role :web, "nrel.gov" role :db,  "db.nrel.gov"
Running Capistrano 12 $ cap staging deploy   * executing `development'     triggering start callbacks for `deploy'   * executing `multistage:ensure'   * executing `deploy'     triggering before callbacks for `deploy'   * executing `deploy:try_setup'   * executing `deploy:setup'     triggering before callbacks for `deploy:setup'   * executing `deploy:gem_bundler:setup'   * executing "mkdir -p /srv/afdc/staging/common/my_project /srv/afdc/staging/common/my_project/releases /srv/afdc/staging/common/my_project/shared /srv/afdc/staging/common/my_project/shared/log"     servers: ["staging.nrel.gov"] Password:      [staging.nrel.gov] executing command     command finished in 795ms     triggering after callbacks for `deploy:setup'   * executing `deploy:shared_children_file_tasks:setup'   * executing "mkdir -p /srv/afdc/staging/common/my_project/shared/public/linkcheck &&  chmodg+w /srv/afdc/staging/common/my_project/shared/public/linkcheck"     servers: ["staging.nrel.gov"]     [staging.nrel.gov] executing command     command finished in 62ms   ...
[object Object]
What we’ve done:
Per-developer sandbox creation on development
Per-branch deployment on staging13 Where To Next? Photo from NationaalArchief http://www.flickr.com/photos/nationaalarchief/402623048
14 What Is Chef? ,[object Object]
Programmatically define:
System requirements
System configuration

Contenu connexe

Tendances

Salt conf 2014-installing-openstack-using-saltstack-v02
Salt conf 2014-installing-openstack-using-saltstack-v02Salt conf 2014-installing-openstack-using-saltstack-v02
Salt conf 2014-installing-openstack-using-saltstack-v02Yazz Atlas
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a ManifestPuppet
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeDamien Seguin
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsBenjamin Cane
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistranosagar junnarkar
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaJuan Diego Pereiro Arean
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefAntons Kranga
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with AnsibleAhmed AbouZaid
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Julian Dunn
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!tdc-globalcode
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.jsBo-Yi Wu
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to AnsibleDan Vaida
 

Tendances (20)

Salt conf 2014-installing-openstack-using-saltstack-v02
Salt conf 2014-installing-openstack-using-saltstack-v02Salt conf 2014-installing-openstack-using-saltstack-v02
Salt conf 2014-installing-openstack-using-saltstack-v02
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a Manifest
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistrano
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
 
Saltstack with Zabbix
Saltstack with ZabbixSaltstack with Zabbix
Saltstack with Zabbix
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Capistrano
CapistranoCapistrano
Capistrano
 
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.js
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
 

En vedette

Re-architecting the Government with Lua and Hadoop
Re-architecting the Government with Lua and HadoopRe-architecting the Government with Lua and Hadoop
Re-architecting the Government with Lua and Hadoopnickblah
 
api.data.gov Overview
api.data.gov Overviewapi.data.gov Overview
api.data.gov Overviewnickblah
 
API Days: Renewables & Alternative Fuels
API Days: Renewables & Alternative FuelsAPI Days: Renewables & Alternative Fuels
API Days: Renewables & Alternative Fuelsnickblah
 
InterLab: Mobile
InterLab: MobileInterLab: Mobile
InterLab: Mobilenickblah
 
RubyConf 2012: Custom Reverse Proxies
RubyConf 2012: Custom Reverse ProxiesRubyConf 2012: Custom Reverse Proxies
RubyConf 2012: Custom Reverse Proxiesnickblah
 
API Management in the Federal Government (D.C. Web API User Group)
API Management in the Federal Government (D.C. Web API User Group)API Management in the Federal Government (D.C. Web API User Group)
API Management in the Federal Government (D.C. Web API User Group)nickblah
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 

En vedette (8)

Re-architecting the Government with Lua and Hadoop
Re-architecting the Government with Lua and HadoopRe-architecting the Government with Lua and Hadoop
Re-architecting the Government with Lua and Hadoop
 
api.data.gov Overview
api.data.gov Overviewapi.data.gov Overview
api.data.gov Overview
 
API Days: Renewables & Alternative Fuels
API Days: Renewables & Alternative FuelsAPI Days: Renewables & Alternative Fuels
API Days: Renewables & Alternative Fuels
 
InterLab: Mobile
InterLab: MobileInterLab: Mobile
InterLab: Mobile
 
RubyConf 2012: Custom Reverse Proxies
RubyConf 2012: Custom Reverse ProxiesRubyConf 2012: Custom Reverse Proxies
RubyConf 2012: Custom Reverse Proxies
 
API Management in the Federal Government (D.C. Web API User Group)
API Management in the Federal Government (D.C. Web API User Group)API Management in the Federal Government (D.C. Web API User Group)
API Management in the Federal Government (D.C. Web API User Group)
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Similaire à Automated Server Configuration and Web Site Deployments with Chef and Capistrano

Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and MaintenanceJazkarta, Inc.
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixDiana Tkachenko
 
NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!Jeff Anderson
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by CapistranoTasawr Interactive
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoAlmir Mendes
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Dana Luther
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabSoftware Guru
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stackRootGate
 
Converting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - CascadiaConverting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - CascadiaDana Luther
 
[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
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment TacticsIan Barber
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with FirebaseMike Fowler
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
How to install squid proxy on server or how to install squid proxy on centos o
How to install squid proxy on server  or how to install squid proxy on centos oHow to install squid proxy on server  or how to install squid proxy on centos o
How to install squid proxy on server or how to install squid proxy on centos oProxiesforrent
 

Similaire à Automated Server Configuration and Web Site Deployments with Chef and Capistrano (20)

Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch Fix
 
NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Converting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - CascadiaConverting Your Dev Environment to a Docker Stack - Cascadia
Converting Your Dev Environment to a Docker Stack - Cascadia
 
[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
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with Firebase
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
How to install squid proxy on server or how to install squid proxy on centos o
How to install squid proxy on server  or how to install squid proxy on centos oHow to install squid proxy on server  or how to install squid proxy on centos o
How to install squid proxy on server or how to install squid proxy on centos o
 

Dernier

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Dernier (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Automated Server Configuration and Web Site Deployments with Chef and Capistrano

  • 1. Automated Server Configuration and Web Site Deployments with Chef and Capistrano NLIT Summit 2011 Nick Muerdter 06/15/2011
  • 2. 2 Photo from National Library NZ http://www.flickr.com/photos/nationallibrarynz_commons/5015573731
  • 3. 3 Bringing Order Photo from U.S. National Archives http://www.flickr.com/photos/usnationalarchives/4011449131
  • 4. 4 Party like it’s 2011! Image © Hanna-Barbera and Warner Bros. Entertainment Inc.
  • 5. 5 Photo by hey skinny http://www.flickr.com/photos/heyskinny/1464641723
  • 6.
  • 7. Automates commands over SSH to multiple servers
  • 9. Ruby on Rails based, but easily does moreWhat Is Capistrano?
  • 10. Getting Started With Capistrano 7 $sudo gem install capistranocapistrano-ext $cd my_project $capify . [add] writing './Capfile' [add] making directory './config' [add] writing './config/deploy.rb' [done] capified!
  • 11. Sample config/deploy.rb 8 require"capistrano/ext/multistage" set :application, "my_project" # Supported: `accurev`, `bzr`, `cvs`, `darcs`, `git`, # `mercurial`, `perforce`, `subversion` or `none` set :scm, :subversion set :repository, "https://svn.nrel.gov/my_project/trunk" set :deploy_to, "/var/www/my_project"
  • 12. Sample config/deploy/development.rb 9 # Set the servers for this stage. role :app, "dev.nrel.gov" role :web, "dev.nrel.gov" role :db, "dev-db.nrel.gov" # Reduce the number of copies kept for the # development environment. set :keep_releases, 2
  • 13. Sample config/deploy/staging.rb 10 # Set the servers for this stage. role :app, "staging.nrel.gov" role :web, "staging.nrel.gov" role :db, "staging-db.nrel.gov"
  • 14. Sample config/deploy/production.rb 11 # Set the servers for this stage. role :app, "nrel.gov" role :web, "nrel.gov" role :db, "db.nrel.gov"
  • 15. Running Capistrano 12 $ cap staging deploy * executing `development' triggering start callbacks for `deploy' * executing `multistage:ensure' * executing `deploy' triggering before callbacks for `deploy' * executing `deploy:try_setup' * executing `deploy:setup' triggering before callbacks for `deploy:setup' * executing `deploy:gem_bundler:setup' * executing "mkdir -p /srv/afdc/staging/common/my_project /srv/afdc/staging/common/my_project/releases /srv/afdc/staging/common/my_project/shared /srv/afdc/staging/common/my_project/shared/log" servers: ["staging.nrel.gov"] Password: [staging.nrel.gov] executing command command finished in 795ms triggering after callbacks for `deploy:setup' * executing `deploy:shared_children_file_tasks:setup' * executing "mkdir -p /srv/afdc/staging/common/my_project/shared/public/linkcheck && chmodg+w /srv/afdc/staging/common/my_project/shared/public/linkcheck" servers: ["staging.nrel.gov"] [staging.nrel.gov] executing command command finished in 62ms ...
  • 16.
  • 19. Per-branch deployment on staging13 Where To Next? Photo from NationaalArchief http://www.flickr.com/photos/nationaalarchief/402623048
  • 20.
  • 25. Easily setup similar servers.Image © Comedy Central
  • 26.
  • 29. Files
  • 31. Roles
  • 32. Nodes
  • 34. Chef Clients15 Chef Terminology Image © Iannucci'sPizzeria & Italian Restaurant
  • 35. package "apache2"do case node[:platform] when"centos", "redhat", "fedora", "suse" package_name"httpd" when"debian", "ubuntu" package_name"apache2" when"arch" package_name"apache" end action :install end service "apache2" template "#{node[:apache][:dir]}/envvars"do source "envvars.erb" group "root" owner "root" mode 0644 notifies :reload, "service[apache2]" end # ... 16 Sample Recipe
  • 36. name"ctts_base" description "A base role for ctts.nrel.gov servers." run_list([ "role[base]”, "role[apache]", "role[capistrano]", "role[passenger_apache]", "role[ruby]", "role[tomcat]", "recipe[apache2::mod_cgi]", "recipe[apache2::mod_include]", "recipe[apache2::mod_php5]", "recipe[apache2::mod_ssl]", "recipe[awstats]", ]) default_attributes({ :awstats=> { :log_file=>"/srv/afdc/ctts/eere/current/log/access.log-%YYYY-0%MM-0%DD-0", :domain=>"www.afdc.energy.gov", }, :php=> { :module_oci8=> { :version=>"1.4.4" }, }, }) 17 Sample Role
  • 37. 18
  • 38. $sudo chef-client Run List is [role[developer_development]] Run List expands to [sudo, chef-client::config, etc::environment, opsview::client, iptables, logrotate, screen, ack, vim, nano, zsh, capistrano, subversion, nginx::source, passenger::nginx, rvm::install, rubygems::client, bundler, java, tomcat, db_config, haproxy, jammit, postgresql::client, supervisor, opsview::check_haproxy, opsview::check_nginx, opsview::check_supervisorctl, opsview::server, opsview::apache, chef-server, docs_site::nginx] Starting Chef Run for devdev.nrel.gov Loading cookbooks [ack, apache2, apt, bluepill, build-essential, bundler, capistrano, chef-client, chef-server, couchdb, daemontools, db_config, docs_site, erlang, etc, gecode, git, haproxy, iptables, jammit, java, logrotate, mysql, nano, nginx, openssl, opsview, passenger, perl, php, postgresql, python, rsync, rsyslog, rubygems, runit, rvm, screen, subversion, sudo, supervisor, tomcat, ucspi-tcp, vim, xml, yum, zlib, zsh] Skipping opsview::client recipe because conflicting opsview::server recipe is enabled Could not find previously defined grants.sql resource Processing package[sudo] action upgrade (sudo::default line 20) Processing template[/var/cache/chef/sudoers] action create (sudo::default line 40) Processing template[/etc/sudoers] action create (sudo::default line 48) Processing directory[/var/run/chef] action create (chef-client::config line 30) Processing directory[/var/cache/chef] action create (chef-client::config line 30) Processing directory[/var/lib/chef] action create (chef-client::config line 30) Processing directory[/var/log/chef] action create (chef-client::config line 30) Processing template[/etc/chef/client.rb] action create (chef-client::config line 38) Processing ruby_block[reload_client_config] action nothing (chef-client::config line 47) Processing template[/etc/environment] action create (etc::environment line 10) Processing package[iptables] action install (iptables::default line 20) Processing execute[rebuild-iptables] action nothing (iptables::default line 22) Processing directory[/etc/iptables.d] action create (iptables::default line 27) Processing cookbook_file[/usr/sbin/rebuild-iptables] action create (iptables::default line 31) ... 19 Running Chef
  • 39. 20 Slow Going? Photo from State Library and Archives of Florida http://www.flickr.com/photos/floridamemory/3266993225
  • 40. 21 Payoff?Totally, dude. Photo by Calsidyrose http://www.flickr.com/photos/calsidyrose/3198309214
  • 41. Capistrano: https://github.com/capistrano/capistrano/wiki Chef: http://www.opscode.com/chef/ http://wiki.opscode.com/display/chef/Home Chef Cookbooks: http://community.opscode.com/cookbooks https://github.com/opscode/cookbooks 22 Resources & Support Photo from Musée McCord Museum http://www.flickr.com/photos/museemccordmuseum/5348751435
  • 42. 23 http://slideshare.net/NickBlah nick.muerdter@nrel.gov Photo by Eleaf http://www.flickr.com/photos/eleaf/2536358399

Notes de l'éditeur

  1. Single production serverDevelop on your live server.Cross fingers and hope you’re perfect.
  2. Separate servers and environments for development, staging, and production.Manually move things from one stage to the next.
  3. Maintaining separate servers can be burdensome.Script it! Things are then easily repeatable.Lots of tools and solutions out there. We’ve used Capistrano and Chef.
  4. Best practices:Deployments are (mostly) atomic: Deployment happens inside separate directory. Only made live at the last minute if all other deployment tasks have succeeded.Previous versions kept around, so rollbacks are quick.Deploy to multiple servers at the same timeLoad balanced application serversPerform tasks on the database server.Not just Ruby on RailsWe use it for lots of PHP applications.Can handle anything that can be automated through SSH.Flexible:Has a set of tasks it executes by default.Tasks can be overwritten or extended using before/after hooks.
  5. “capistrano-ext” gem: Useful extension to handle multiple server environments (eg, development, staging, production).“Capfile” required file.“config/deploy.rb” main configuration file.
  6. Lots of variables to control things: https://github.com/peritor/webistrano/wiki/configuration-parametersYou can define your own variables to do other things.
  7. Per-environment configuration.Define the servers to be used for this environment.Override variable defaults for this environment.
  8. Per-environment configuration.
  9. Per-environment configuration.
  10. Always just one command for an identical deployment.cap development deploycap production deploy
  11. Our website Apache configuration is part of application’s code base and deployment process.This allows dynamic deployments.cap development deploy SANDBOX=nmuerdterCompletely sets up a separate version of our code at a separate subdomain (eg, nmuerdter.dev.nrel.gov).Each developer doesn’t have to maintain a server, but their code and site is completely separate.cap staging deploy BRANCH=feature-aDeploy a different branch of our code to the staging server at a separate subdomain (eg, feature-a.staging.nrel.gov).Useful when multiple developers are working on different features of the same site, but each feature needs to be reviewed separately.
  12. Web site deployment only half of puzzle.Underlying servers need to be maintained.What software packages need to be installed? What configuration needs to be made? What about that magic file that needs to be in a certain place or everything breaks?Server changes required for development need to be remembered and applied to each sever when ready (development, staging, then production).Completely different servers often need to be setup similarly (for example, we setup Apache similarly between servers).Duplicate servers for load balancing purposes.
  13. Cookbooks: Encapsulates everything for a single piece of software (for example, Apache).Recipes: The script that defines the actions to perform to install and configure the software (for example, how to install Apache, what configuration files to install, and more). Written in Ruby.Attributes: Variables that can be set and customized (for example, what ports Apache should listen on).Files: Static files that should be installed onto the server.Templates: Like files, installed onto the server, but can contain attribute variables, so things can be customized depending on the server’s attributes (for example, the httpd.conf file).Roles: Define a series of cookbooks or other roles to run and attributes to set.Reusable, generic roles: “apache”Per-server roles: specific web server.Nodes: Any machine you’re dealing with.Server/Client modelChef Server: The master machine that hosts the chef server. Where cookbooks, roles, etc are stored.Chef Clients: Any machine you wish to configure using chef. The chef server machine itself is also a client.
  14. “package” defines the software package to install.Your recipe doesn’t have to be cross-platform, but a lot of the available cookbooks are.You give a package name, Chef handles the appropriate logic (yum for RedHat, apt-get for Debian).“service” defines the service that’s available.Again, Chef handles the cross-platform logic (init.d, etc).“template” installs a file onto the server after parsing “envvars.erb” with ruby. Allows for dynamic templates.“node” gives access to the attributes for the server being setup.
  15. The run list defines which other roles or recipes to run.You can nest roles.Some roles are generic “apache”Others we build for specific server types (eg, the web server responsible for a specific site).default_attributes defines or overrides variables for this specific role. Recipes use these variables to control logic or configuration. Self documenting: Now you know the exact requirements for your machines.
  16. Web interface available.I only like to use for browsing (not node configuration).I keep logic defined in role files, so changes are tracked in subversion.
  17. Updating a server, just a matter of running “chef-client”Fetches the run list for this specific machine from the chef server and runs recipes.Only performs actions if needed (eg, software packages only upgraded if needed, files only installed if they differ).I’ve glossed over initially bootstrapping client nodes and the chef server itself, but those directions can be found elsewhere.
  18. There is undoubtedly upfront overhead with this approach.
  19. However, the upfront overhead pays off in the long run.Maintenance is easier.CapistranoNew developer? One command sets up their separate sandbox on our development server.Deployments to staging and production are reliable. Always deploy via capistrano and any kinks get worked out early on in staging before going to production.ChefServer software updates? Never forget what you’ve done between your development and production servers.New server? Reuse existing cookbooks to speed up the process.Standardized process is followed.By scripting everything, the scripts become documentation for exactly how a server is configured and what is done during deployment.