Skip to content

subvisual/subvisual-puppet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Subvisual Puppet

A Puppet module and a few helper scripts to set up web servers

Puppet module

The module contains common patterns to be used in puppet manifests accross different web applications. It is available on puppet forge.

Provisioning a machine

1. Base provisioning

For the default base setup for a web server, the ubuntu helper script can be applied. To use it, SSH into a newly created machine, and run this command:

curl -s https://raw.githubusercontent.com/subvisual/subvisual-puppet/master/setup/ubuntu > install
chmod +x install
./install

This will:

  • install some base packages (git, puppet)
  • create a deploy user. You will be prompted for a password at the end
  • Add all of Subvisual public keys to the deploy user
  • Adds Subvisual dotfiles to the deploy user using rcm
  • ensure /apps (where all web apps will go) belongs to the deploy user
  • enable Upstart session jobs
  • install nginx

2. App provisioning

At this step, it is assumed the machine is ready with the setup described in base provisioning.

This will be app-specific. For each app, a puppet manifest and a hiera data file is needed. The later one is used to store sensitive data (and thus should not be commited to git). Here's an example for an app that uses ruby 2.1.5 and a PostgreSQL database, and is deployed with Capistrano:

# manifest.pp
$data = hiera('common')
gb::ruby { 'ruby-2.1.5': }

gb::postgresql { 'app_name':
  password => $data[app_name][db_password],
}

gb::capistrano { 'app_name': }

gb::nginx_conf { 'app_name':
  path => 'config/nginx.production.conf',
}
# common.yaml
---
common:
  app_name:
    db_password: "a-random-p4ssw0rd"

The setup/app helper script assists with getting these files on the server and provisioning it. No SSH needed at this stage:

curl -s https://raw.githubusercontent.com/subvisual/subvisual-puppet/master/setup/app > install-app
chmod +x install-app
./install-app

The script will prompt you for a few things:

  • The hostname or IP address of the server
  • The SSH port to use (defaults to 22)
  • path to the manifest
  • path to the hiera data

The script will upload both files to the server and apply the puppet manifest.