Capistrano -> Mina.
This commit is contained in:
parent
d6d84ee2e3
commit
5e903b6ff7
1 changed files with 63 additions and 51 deletions
114
config/deploy.rb
114
config/deploy.rb
|
|
@ -1,66 +1,78 @@
|
|||
require 'bundler/capistrano'
|
||||
require 'mina/bundler'
|
||||
require 'mina/rails'
|
||||
require 'mina/git'
|
||||
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
|
||||
# require 'mina/rvm' # for rvm support. (http://rvm.io)
|
||||
|
||||
set :application, "contact-o-rama"
|
||||
set :local_repository, "apps@freebsd.tailorama.com:/home/apps/gitrepo/contactorama.git"
|
||||
set :repository, "/home/apps/gitrepo/contactorama.git"
|
||||
# Temporary(?) workaround to get 'mina setup' to run.
|
||||
# see: https://github.com/nadarei/mina/issues/99
|
||||
set :term_mode, nil
|
||||
|
||||
set :deploy_to, "/home/apps/rails/#{application}"
|
||||
#set :symlink_path, "/var/www/htdocs/web1/html/rails/#{application}"
|
||||
# Basic settings:
|
||||
# domain - The hostname to SSH to.
|
||||
# deploy_to - Path to deploy into.
|
||||
# repository - Git repo to clone from. (needed by mina/git)
|
||||
# branch - Branch name to deploy. (needed by mina/git)
|
||||
|
||||
set :scm, :git
|
||||
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
||||
set :user, "apps"
|
||||
# ssh_options[:port] = 981
|
||||
set :use_sudo, false
|
||||
set :domain, 'freebsd.tailorama.com'
|
||||
set :deploy_to, '/home/apps/rails/contact-o-rama'
|
||||
set :repository, '/home/apps/gitrepo/contactorama.git'
|
||||
set :branch, 'master'
|
||||
|
||||
set :deploy_via, :remote_cache
|
||||
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
||||
# They will be linked in the 'deploy:link_shared_paths' step.
|
||||
set :shared_paths, ['config/database.yml', 'config/initializers/setup_mail.rb', 'log']
|
||||
|
||||
role :web, "tailorama.com" # Your HTTP server, Apache/etc
|
||||
role :app, "tailorama.com" # This may be the same as your `Web` server
|
||||
role :db, "tailorama.com", :primary => true # This is where Rails migrations will run
|
||||
# role :db, "tailorama.com"
|
||||
# Optional settings:
|
||||
set :user, 'apps' # Username in the server to SSH to.
|
||||
# set :port, '30000' # SSH port number.
|
||||
|
||||
# copy shared files after update
|
||||
task :update_config, :roles => :app do
|
||||
run "cp -Rf #{shared_path}/config/* #{release_path}/config/"
|
||||
# This task is the environment that is loaded for most commands, such as
|
||||
# `mina deploy` or `mina rake`.
|
||||
task :environment do
|
||||
# If you're using rbenv, use this to load the rbenv environment.
|
||||
# Be sure to commit your .rbenv-version to your repository.
|
||||
# invoke :'rbenv:load'
|
||||
|
||||
# For those using RVM, use this to load an RVM version@gemset.
|
||||
# invoke :'rvm:use[ruby-1.9.3-p125@default]'
|
||||
end
|
||||
|
||||
# create symlink after setup
|
||||
# task :symlink_config, :roles => :app do
|
||||
# run "mkdir -p /var/www/htdocs/#{user}/html/rails"
|
||||
# run "ln -nfs #{current_path}/public #{symlink_path}"
|
||||
# end
|
||||
# Put any custom mkdir's in here for when `mina setup` is ran.
|
||||
# For Rails apps, we'll make some of the shared paths that are shared between
|
||||
# all releases.
|
||||
task :setup => :environment do
|
||||
queue! %[mkdir -p "#{deploy_to}/shared/log"]
|
||||
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
|
||||
|
||||
#after "deploy:setup", :symlink_config
|
||||
after "deploy:update_code", :update_config
|
||||
# queue! %[mkdir -p "#{deploy_to}/shared/config"]
|
||||
# queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
|
||||
|
||||
# mod_rails (phusion_passenger) stuff
|
||||
namespace :deploy do
|
||||
desc "Restart Application"
|
||||
task :restart, :roles => :app, :except => { :no_release => true } do
|
||||
run "touch #{current_path}/tmp/restart.txt"
|
||||
end
|
||||
|
||||
[:start, :stop].each do |t|
|
||||
desc "start/stop is not necessary with mod_rails"
|
||||
task t, :roles => :app do
|
||||
# nothing
|
||||
# queue! %[touch "#{deploy_to}/shared/config/database.yml"]
|
||||
# queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
|
||||
end
|
||||
|
||||
desc "Deploys the current version to the server."
|
||||
task :deploy => :environment do
|
||||
deploy do
|
||||
# Put things that will set up an empty directory into a fully set-up
|
||||
# instance of your project.
|
||||
invoke :'git:clone'
|
||||
invoke :'deploy:link_shared_paths'
|
||||
invoke :'bundle:install'
|
||||
invoke :'rails:db_migrate'
|
||||
invoke :'rails:assets_precompile'
|
||||
|
||||
to :launch do
|
||||
queue "touch #{deploy_to}/tmp/restart.txt"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Precompile the assets and copy them over to the production site. (Don't build them there.)
|
||||
namespace :assets do
|
||||
after "deploy:update_code", "assets:precompile"
|
||||
after "assets:precompile", "assets:upload_assets"
|
||||
# For help in making your deploy script, see the Mina documentation:
|
||||
#
|
||||
# - http://nadarei.co/mina
|
||||
# - http://nadarei.co/mina/tasks
|
||||
# - http://nadarei.co/mina/settings
|
||||
# - http://nadarei.co/mina/helpers
|
||||
|
||||
desc "precompile assets"
|
||||
task :precompile do
|
||||
run_locally("bundle exec rake assets:clean && bundle exec rake assets:precompile")
|
||||
end
|
||||
|
||||
desc "precompile and upload assets to webserver"
|
||||
task :upload_assets, :roles => :app do
|
||||
top.upload( "public/assets", "#{release_path}/public/", :via => :scp, :recursive => true)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue