SlideShare uma empresa Scribd logo
1 de 19
1




Moonshine
190 Proof Deployment



Jarin Udom, Robot Mode LLC
http://robotmo.de
2




Introduction
3




Deployment Sucks!
    Install Ubuntu

    Update packages

    Configure SSH

    Configure iptables

    Build and install Apache, MySQL/Postgres, Ruby Enterprise Edition,
    RubyGems, Passenger, ImageMagick, PostFix, Cron, logrotate, NTP, Rails, gems, git, etc. etc.…

    Finally deploy!
4




What Moonshine does
    Update packages

    Configure SSH

    Configure iptables

    Build and install Apache, MySQL/Postgres, Ruby Enterprise Edition,
    RubyGems, Passenger, ImageMagick, PostFix, cron, logrotate, NTP, Rails, gems, git, etc. etc.…

    Deploy!

    Manage!

    …and more!
5




What Moonshine is built on

    Made by Rails Machine

    Puppet

    ShadowPuppet (extracted from Moonshine)

    Capistrano
6




Moonshine Plugins
    ar_mailer

    Local and Amazon S3 backups

    god

    iptables

    memcached

    sphinx

    ssh

    Wordpress (?!)
7




Getting Started
8




What you need


    A server running Ubuntu 8.10

    A user on the server who can sudo and
    access your Git repository

    A beer (optional)
9




Install Plugins
    script/plugin install git://github.com/railsmachine/moonshine.git

    script/plugin install git://github.com/railsmachine/moonshine_ssh.git

    script/plugin install git://github.com/railsmachine/
    moonshine_iptables.git

    Install any other Moonshine plugins you want

    script/generate moonshine

      Generates config/moonshine.yml and app/manifests/
10




Gems

     Make sure all of your gems are declared in environment.rb

     rake moonshine:gems

       Generates gems.yml

       You need to do this any time you add/remove/change the gems
11




Edit moonshine.yml
:ruby: ree
:application: ultranetweb
:user: rails
:time_zone: UTC
:deploy_to: /srv/ultranetweb
:domain: ultranetweb.com
:domain_aliases:
  - www.ultranetweb.com
  - assets1.ultranetweb.com

# The entries in shared_children are created in #{application}/shared
:shared_children:
- system
- log
- pids
- config

:repository: git@github.com:robotmode/ultranetweb.git
12




Edit moonshine.yml
:local_config:
 - config/database.yml

:ssh
   :port: 9022
   :allow_users:
     - jarin
     - rails

:apt_gems:
 :paperclip:
   - imagemagick

:passenger:
  :max_pool_size: 3
  :use_global_queue: true
:mysql:
  :innodb_buffer_pool_size: 128M
13




Edit application_manifest.rb
  Located in app/manifests/

# Installs Rails, Apache, Passenger, the database from database.yml, Postfix,
# Cron, logrotate and NTP.
recipe :default_stack

plugin :ssh
recipe :ssh

plugin :iptables
recipe :iptables
14




Edit application_manifest.rb
  Located in app/manifests/
def application_packages
 send_weekly_emails = "/usr/bin/rake -f #{configuration[:deploy_to]}/
current/Rakefile mailer:send_weekly_emails RAILS_ENV=#{ENV['RAILS_ENV']}"

 cron 'notifications:send_weekly_emails',
    :command => send_weekly_emails,
    :user => configuration[:user],
    :minute => 0,
    :hour => 3,
    :weekday => 1

 # Only run the following on the 'staging' stage using capistrano-ext.
 on_stage 'staging' do
  file '/etc/motd', :ensure => :file, :content => "!!! STAGING SERVER !!!"
 end
end
15




Capify and go!
     capify .

 config/deploy.rb:
     server "ultranetweb.com", :app, :web, :db, :primary =>
     true
 Add to git
     git add . && git commit -am "added moonshine" && git
     push
 Bootstrap!
     cap
     deploy:setup
 Deploy!
     cap
     deploy
16




Now, cap deploy will…
 Verify your system config on each deploy

 Run migrations

 Install gems

     …and their system dependencies!

 Pull down submodules

 Keep your system configuration in
 version control!
17




But what about other servers?

      You can have per-server manifests for your app servers, database
      servers, memcache, etc.

     set :moonshine_manifest, 'memcached_manifest'

      By default, Moonshine sets your database auto-increment to 10 to
      allow for easier database sharding later

      Check the Moonshine Google Group for more info
18




Resources

     Source/wiki: http://github.com/railsmachine/moonshine

     Docs: http://railsmachine.github.com/moonshine/

     Mailing list: http://groups.google.com/group/railsmachine-
     moonshine

     Slides will be up at http://jarinheit.com in the next couple of days
19




Questions?

Mais conteúdo relacionado

Mais procurados

Gitlab installation
Gitlab installationGitlab installation
Gitlab installation
Raiful Hasan
 
Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
Takehiko Amano
 

Mais procurados (20)

Fun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker imagesFun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker images
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in Production
 
Keep Your Servers in GitHub
Keep Your Servers in GitHubKeep Your Servers in GitHub
Keep Your Servers in GitHub
 
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGIEuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
How to contribute Apache CloudStack
How to contribute Apache CloudStackHow to contribute Apache CloudStack
How to contribute Apache CloudStack
 
Git, gitHub, Azure and Visual Studio
Git, gitHub, Azure and Visual StudioGit, gitHub, Azure and Visual Studio
Git, gitHub, Azure and Visual Studio
 
Deploy node.js app with capistrano
Deploy node.js app with capistranoDeploy node.js app with capistrano
Deploy node.js app with capistrano
 
Develop - Project Scaffolding
Develop - Project ScaffoldingDevelop - Project Scaffolding
Develop - Project Scaffolding
 
Deploying PHP Applications with Ansible
Deploying PHP Applications with AnsibleDeploying PHP Applications with Ansible
Deploying PHP Applications with Ansible
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with Capistrano
 
WordPress workflow of the future
WordPress workflow of the futureWordPress workflow of the future
WordPress workflow of the future
 
Gitlab installation
Gitlab installationGitlab installation
Gitlab installation
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41
 
Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
 
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
 
Custom Non-RDS Multi-AZ Mysql Replication
Custom Non-RDS Multi-AZ Mysql ReplicationCustom Non-RDS Multi-AZ Mysql Replication
Custom Non-RDS Multi-AZ Mysql Replication
 
asyncio community, one year later
asyncio community, one year laterasyncio community, one year later
asyncio community, one year later
 
AWS 기반 Docker, Kubernetes
AWS 기반 Docker, KubernetesAWS 기반 Docker, Kubernetes
AWS 기반 Docker, Kubernetes
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 

Destaque (6)

President Estrada’s BW Resources Scandal
President Estrada’s BW Resources ScandalPresident Estrada’s BW Resources Scandal
President Estrada’s BW Resources Scandal
 
Philippine presidents
Philippine presidentsPhilippine presidents
Philippine presidents
 
Fidel ramos
Fidel ramosFidel ramos
Fidel ramos
 
Philippine Presidents
Philippine PresidentsPhilippine Presidents
Philippine Presidents
 
Fidel v ramos 2
Fidel v ramos 2Fidel v ramos 2
Fidel v ramos 2
 
Joseph Estrada
Joseph EstradaJoseph Estrada
Joseph Estrada
 

Semelhante a Deploying Rails applications with Moonshine

Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
Andreas Heim
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
Eric D. Schabell
 

Semelhante a Deploying Rails applications with Moonshine (20)

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)
 
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to ProductionRuby and Rails Packaging to Production
Ruby and Rails Packaging to Production
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
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,...
 
[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
 
Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
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
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
K8s, Amazon EKS - 유재석, AWS 솔루션즈 아키텍트
K8s, Amazon EKS - 유재석, AWS 솔루션즈 아키텍트K8s, Amazon EKS - 유재석, AWS 솔루션즈 아키텍트
K8s, Amazon EKS - 유재석, AWS 솔루션즈 아키텍트
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
 
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 

Último

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Deploying Rails applications with Moonshine

  • 1. 1 Moonshine 190 Proof Deployment Jarin Udom, Robot Mode LLC http://robotmo.de
  • 3. 3 Deployment Sucks! Install Ubuntu Update packages Configure SSH Configure iptables Build and install Apache, MySQL/Postgres, Ruby Enterprise Edition, RubyGems, Passenger, ImageMagick, PostFix, Cron, logrotate, NTP, Rails, gems, git, etc. etc.… Finally deploy!
  • 4. 4 What Moonshine does Update packages Configure SSH Configure iptables Build and install Apache, MySQL/Postgres, Ruby Enterprise Edition, RubyGems, Passenger, ImageMagick, PostFix, cron, logrotate, NTP, Rails, gems, git, etc. etc.… Deploy! Manage! …and more!
  • 5. 5 What Moonshine is built on Made by Rails Machine Puppet ShadowPuppet (extracted from Moonshine) Capistrano
  • 6. 6 Moonshine Plugins ar_mailer Local and Amazon S3 backups god iptables memcached sphinx ssh Wordpress (?!)
  • 8. 8 What you need A server running Ubuntu 8.10 A user on the server who can sudo and access your Git repository A beer (optional)
  • 9. 9 Install Plugins script/plugin install git://github.com/railsmachine/moonshine.git script/plugin install git://github.com/railsmachine/moonshine_ssh.git script/plugin install git://github.com/railsmachine/ moonshine_iptables.git Install any other Moonshine plugins you want script/generate moonshine Generates config/moonshine.yml and app/manifests/
  • 10. 10 Gems Make sure all of your gems are declared in environment.rb rake moonshine:gems Generates gems.yml You need to do this any time you add/remove/change the gems
  • 11. 11 Edit moonshine.yml :ruby: ree :application: ultranetweb :user: rails :time_zone: UTC :deploy_to: /srv/ultranetweb :domain: ultranetweb.com :domain_aliases: - www.ultranetweb.com - assets1.ultranetweb.com # The entries in shared_children are created in #{application}/shared :shared_children: - system - log - pids - config :repository: git@github.com:robotmode/ultranetweb.git
  • 12. 12 Edit moonshine.yml :local_config: - config/database.yml :ssh :port: 9022 :allow_users: - jarin - rails :apt_gems: :paperclip: - imagemagick :passenger: :max_pool_size: 3 :use_global_queue: true :mysql: :innodb_buffer_pool_size: 128M
  • 13. 13 Edit application_manifest.rb Located in app/manifests/ # Installs Rails, Apache, Passenger, the database from database.yml, Postfix, # Cron, logrotate and NTP. recipe :default_stack plugin :ssh recipe :ssh plugin :iptables recipe :iptables
  • 14. 14 Edit application_manifest.rb Located in app/manifests/ def application_packages send_weekly_emails = "/usr/bin/rake -f #{configuration[:deploy_to]}/ current/Rakefile mailer:send_weekly_emails RAILS_ENV=#{ENV['RAILS_ENV']}" cron 'notifications:send_weekly_emails', :command => send_weekly_emails, :user => configuration[:user], :minute => 0, :hour => 3, :weekday => 1 # Only run the following on the 'staging' stage using capistrano-ext. on_stage 'staging' do file '/etc/motd', :ensure => :file, :content => "!!! STAGING SERVER !!!" end end
  • 15. 15 Capify and go! capify . config/deploy.rb: server "ultranetweb.com", :app, :web, :db, :primary => true Add to git git add . && git commit -am "added moonshine" && git push Bootstrap! cap deploy:setup Deploy! cap deploy
  • 16. 16 Now, cap deploy will… Verify your system config on each deploy Run migrations Install gems …and their system dependencies! Pull down submodules Keep your system configuration in version control!
  • 17. 17 But what about other servers? You can have per-server manifests for your app servers, database servers, memcache, etc. set :moonshine_manifest, 'memcached_manifest' By default, Moonshine sets your database auto-increment to 10 to allow for easier database sharding later Check the Moonshine Google Group for more info
  • 18. 18 Resources Source/wiki: http://github.com/railsmachine/moonshine Docs: http://railsmachine.github.com/moonshine/ Mailing list: http://groups.google.com/group/railsmachine- moonshine Slides will be up at http://jarinheit.com in the next couple of days