Skip to content

Instantly share code, notes, and snippets.

@giosakti
Created July 1, 2012 05:58
Show Gist options
  • Save giosakti/3027041 to your computer and use it in GitHub Desktop.
Save giosakti/3027041 to your computer and use it in GitHub Desktop.
[Server] Example configuration file to deploy a site in puppet (using nginx & unicorn module)
class example_com {
file {
"/var/www/":
ensure => directory,
owner => vagrant,
group => vagrant,
mode => 775;
"/var/www/example.com/":
ensure => directory,
owner => vagrant,
group => vagrant,
mode => 775,
require => File["/var/www/"];
"/var/www/example.com/shared/":
ensure => directory,
owner => vagrant,
group => vagrant,
mode => 775,
require => File["/var/www/example.com/"];
"/var/www/example.com/shared/config/":
ensure => directory,
owner => vagrant,
group => vagrant,
mode => 775,
require => File["/var/www/example.com/shared"];
}
file {
"/var/www/example.com/shared/config/database.yml":
ensure => present,
owner => vagrant,
group => vagrant,
mode => 600,
require => File["/var/www/example.com/shared/config"],
source => "puppet:///modules/example_com/database.yml",
}
# nginx site configuration
nginx::resource::vhost { '127.0.0.1':
ensure => present,
listen_ip => '*',
listen_port => '80',
root => '/var/www/example.com/current/public',
try_files => '$uri/index.html $uri @example_com',
location => '@example_com',
proxy => 'http://example_com',
client_max_body_size => '10M',
keepalive_timeout => '5';
}
nginx::resource::upstream { 'example_com':
ensure => present,
socket => 'unix:/tmp/example_com.todo.sock fail_timeout=0';
}
# unicorn configuration
unicorn::instance { 'example_com':
basedir => '/var/www/example.com',
socket_path => '/tmp/example_com.todo.sock',
rails => true,
command => '/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin/unicorn',
env => 'production',
uid => 'root',
gid => 'root';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment