You are previewing Puppet 2.7 Cookbook.

Puppet 2.7 Cookbook

Cover of Puppet 2.7 Cookbook by John Arundel Published by Packt Publishing
  1. Puppet 2.7 Cookbook
    1. Puppet 2.7 Cookbook
    2. Credits
    3. About the Author
    4. About the Reviewers
      1. Support files, eBooks, discount offers and more
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
    7. 1. Puppet Infrastructure
      1. Using version control
      2. Using commit hooks
      3. Deploying changes with Rake
      4. Configuring Puppet's file server
      5. Creating decentralized Puppet architecture
    8. 2. Monitoring, Reporting, and Troubleshooting
      1. Generating reports
      2. E-mailing log messages containing specific tags
      3. Creating graphical reports
      4. Producing automatic HTML documentation
      5. Drawing dependency graphs
      6. Testing your Puppet manifests
      7. Doing a dry run
      8. Detecting compilation errors
      9. Understanding Puppet errors
      10. Logging command output
      11. Logging debug messages
      12. Inspecting configuration settings
      13. Using tags
      14. Using run stages
      15. Using environments
    9. 3. Puppet Language and Style
      1. Using community Puppet style
      2. Using modules
      3. Using standard naming conventions
      4. Using embedded Ruby
      5. Writing manifests in pure Ruby
      6. Iterating over multiple items
      7. Writing powerful conditional statements
      8. Using regular expressions in if statements
      9. Using selectors and case statements
      10. Testing whether values are contained in strings
      11. Using regular expression substitutions
    10. 4. Writing Better Manifests
      1. Using arrays of resources
      2. Using define resources
      3. Using dependencies
      4. Using node inheritance
      5. Using class inheritance and overriding
      6. Passing parameters to classes
      7. Writing reusable, cross-platform manifests
      8. Getting information about the environment
      9. Importing dynamic information
      10. Importing data from CSV files
      11. Passing arguments to shell commands
    11. 5. Working with Files and Packages
      1. Making quick edits to config files
      2. Using Augeas to automatically edit config files
      3. Building config files using snippets
      4. Using ERB templates
      5. Using array iteration in templates
      6. Installing packages from a third-party repository
      7. Setting up an APT package repository
      8. Setting up a gem repository
      9. Building packages automatically from source
      10. Comparing package versions
    12. 6. Users and Virtual Resources
      1. Using virtual resources
      2. Managing users with virtual resources
      3. Managing users' SSH access
      4. Managing users' customization files
      5. Efficiently distributing cron jobs
      6. Running a command when a file is updated
      7. Using host resources
      8. Using multiple file sources
      9. Distributing directory trees
      10. Cleaning up old files
      11. Using schedules with resources
      12. Auditing resources
      13. Temporarily disabling resources
      14. Managing timezones
    13. 7. Applications
      1. Managing Apache servers
      2. Creating Apache virtual hosts
      3. Creating Nginx virtual hosts
      4. Creating MySQL databases and users
      5. Managing Drupal sites
      6. Managing Rails applications
    14. 8. Servers and Cloud Infrastructure
      1. Deploying a Nagios monitoring server
      2. Building high-availability services using Heartbeat
      3. Managing NFS servers and file shares
      4. Using HAProxy to load-balance multiple web servers
      5. Managing firewalls with iptables
      6. Managing EC2 instances
      7. Managing virtual machines with Vagrant
    15. 9. External Tools and the Puppet Ecosystem
      1. Creating custom Facter facts
      2. Executing commands before and after Puppet runs
      3. Generating manifests from shell sessions
      4. Generating manifests from a running system
      5. Using Puppet Dashboard
      6. Using Foreman
      7. Using MCollective
      8. Using public modules
      9. Using an external node classifier
      10. Creating your own resource types
      11. Creating your own providers

Managing Rails applications

Rails is an enormously popular web app framework (in the sense that it's widely used, rather than that people like it). So it's probable that you'll be called upon to manage it at some point. The recipe presented here contains most of what you'll need to prepare a server to have a Rails application installed on it. This recipe assumes that you'll be using Nginx and Passenger as the web server, though you can easily modify the recipe to use Apache instead.

How to do it...

  1. Create the directory structure for a rails module:
    # mkdir /etc/puppet/modules/rails
    # mkdir /etc/puppet/modules/rails/manifests
    # mkdir /etc/puppet/modules/rails/templates
    # mkdir /etc/puppet/modules/rails/files
  2. Create the file /etc/puppet/modules/rails/manifests/init.pp ...

The best content for your career. Discover unlimited learning on demand for around $1/day.