Last active
December 13, 2015 18:08
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
load 'deploy/assets' | |
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | |
load 'config/deploy' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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://[email protected]/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the companion chef scripts for bootstrapping your Ubuntu 12.10 server: https://github.com/sud0n1m/discourse-chef