Skip to content

Instantly share code, notes, and snippets.

@sud0n1m
Last active December 13, 2015 18:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sud0n1m/4953154 to your computer and use it in GitHub Desktop.
Save sud0n1m/4953154 to your computer and use it in GitHub Desktop.
A preliminary capistrano deploy script for discourse. To be used together with https://github.com/sud0n1m/discourse-chef
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'deploy/assets'
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
require "bundler/capistrano"
# Application Settings
set :application, "discourse"
set :deploy_to, "/web/#{application}"
# Repo Settings
# Cloned to a private copy of discourse
set :repository, "ssh://git@github.com/xxxxxxxx/discourse.git"
set :deploy_via, :remote_cache
set :branch, fetch(:branch, "master")
set :scm, :git
ssh_options[:forward_agent] = true
# General Settings
set :use_sudo, false
set :deploy_type, :deploy
default_run_options[:pty] = true
# Server Settings
set :user, "deploy"
set :rails_env, :production
role :app, "yourserver.com"
role :db, "yourserver.com"
role :web, "yourserver.com", :primary => true
# Hooks
after "deploy:setup" do
run "cd #{current_path} && bundle install"
end
# Seed the database
# Bluepill related tasks
after "deploy:update", "bluepill:quit", "bluepill:start"
namespace :bluepill do
desc "Stop processes that bluepill is monitoring and quit bluepill"
task :quit, :roles => [:app] do
sudo "bluepill stop"
sudo "bluepill quit"
end
desc "Load bluepill configuration and start it"
task :start, :roles => [:app] do
sudo "bluepill load /web/discourse/current/config/discourse.pill"
end
desc "Prints bluepills monitored processes statuses"
task :status, :roles => [:app] do
sudo "bluepill status"
end
desc "Stops bluepill from running services"
task :stop, :roles => [:app] do
sudo "bluepill stop"
end
end
namespace :db do
desc "seed the database for the first time"
task :seed, :roles => [:db] do
sudo "cd #{current_path} && bundle exec rake db:migrate"
sudo "cd #{current_path} && bundle exec rake db:seed_fu"
end
end
@sud0n1m
Copy link
Author

sud0n1m commented Feb 14, 2013

See the companion chef scripts for bootstrapping your Ubuntu 12.10 server: https://github.com/sud0n1m/discourse-chef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment