Skip to content

Instantly share code, notes, and snippets.

$ cap staging maintenance:start
@fuse
fuse / nginx
Created November 15, 2011 10:59
server {
listen 80;
server_name fake.server;
access_log /var/log/nginx/fake.access.log;
error_log /var/log/nginx/fake.error.log;
# direct to maintenance if this file exists
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
@fuse
fuse / unicorn.rb
Created November 15, 2011 10:43
Unicorn configuration
# unicorn_rails -c config/unicorn.rb -E production -D
worker_processes 4
user "synbioz", "users"
working_directory "/var/www/fake/current"
listen "/var/www/fake/shared/sockets/unicorn.sock", :backlog => 1024
pid "/var/www/fake/shared/pids/unicorn.pid"
# nuke workers after 30 seconds instead of 60 seconds (the default)
$ cap staging deploy
$ cap staging deploy:cold
$ bundle install --binstubs
$ bin/capify .
$ mkdir config/deploy
$ cp config/environments/production.rb config/environments/staging.rb
$ cap staging deploy:setup
gem 'capistrano'
gem 'capistrano-ext'
@fuse
fuse / production.rb
Created November 15, 2011 10:25
config/deploy/production.rb
set :rails_env, "production"
role :web, ""
role :app, ""
role :db, "", :primary => true
@fuse
fuse / deploy.rb
Created November 15, 2011 10:24
Capistrano configuration
require "bundler/capistrano"
# allowing shell interactions
default_run_options[:pty] = true
# multistaging
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
<form id="new_post" action="/articles" method="post">
<input type="submit" formaction="/articles/preview" formmethod="get" value="Aperçu" />
</form>
<input type="submit" form="new_post" value="Publier" />