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"
|
# Temporary(?) workaround to get 'mina setup' to run.
|
||||||
set :local_repository, "apps@freebsd.tailorama.com:/home/apps/gitrepo/contactorama.git"
|
# see: https://github.com/nadarei/mina/issues/99
|
||||||
set :repository, "/home/apps/gitrepo/contactorama.git"
|
set :term_mode, nil
|
||||||
|
|
||||||
set :deploy_to, "/home/apps/rails/#{application}"
|
# Basic settings:
|
||||||
#set :symlink_path, "/var/www/htdocs/web1/html/rails/#{application}"
|
# 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
|
set :domain, 'freebsd.tailorama.com'
|
||||||
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
set :deploy_to, '/home/apps/rails/contact-o-rama'
|
||||||
set :user, "apps"
|
set :repository, '/home/apps/gitrepo/contactorama.git'
|
||||||
# ssh_options[:port] = 981
|
set :branch, 'master'
|
||||||
set :use_sudo, false
|
|
||||||
|
|
||||||
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
|
# Optional settings:
|
||||||
role :app, "tailorama.com" # This may be the same as your `Web` server
|
set :user, 'apps' # Username in the server to SSH to.
|
||||||
role :db, "tailorama.com", :primary => true # This is where Rails migrations will run
|
# set :port, '30000' # SSH port number.
|
||||||
# role :db, "tailorama.com"
|
|
||||||
|
|
||||||
# copy shared files after update
|
# This task is the environment that is loaded for most commands, such as
|
||||||
task :update_config, :roles => :app do
|
# `mina deploy` or `mina rake`.
|
||||||
run "cp -Rf #{shared_path}/config/* #{release_path}/config/"
|
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
|
end
|
||||||
|
|
||||||
# create symlink after setup
|
# Put any custom mkdir's in here for when `mina setup` is ran.
|
||||||
# task :symlink_config, :roles => :app do
|
# For Rails apps, we'll make some of the shared paths that are shared between
|
||||||
# run "mkdir -p /var/www/htdocs/#{user}/html/rails"
|
# all releases.
|
||||||
# run "ln -nfs #{current_path}/public #{symlink_path}"
|
task :setup => :environment do
|
||||||
# end
|
queue! %[mkdir -p "#{deploy_to}/shared/log"]
|
||||||
|
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
|
||||||
|
|
||||||
#after "deploy:setup", :symlink_config
|
# queue! %[mkdir -p "#{deploy_to}/shared/config"]
|
||||||
after "deploy:update_code", :update_config
|
# queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
|
||||||
|
|
||||||
# mod_rails (phusion_passenger) stuff
|
# queue! %[touch "#{deploy_to}/shared/config/database.yml"]
|
||||||
namespace :deploy do
|
# queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
|
||||||
desc "Restart Application"
|
end
|
||||||
task :restart, :roles => :app, :except => { :no_release => true } do
|
|
||||||
run "touch #{current_path}/tmp/restart.txt"
|
desc "Deploys the current version to the server."
|
||||||
end
|
task :deploy => :environment do
|
||||||
|
deploy do
|
||||||
[:start, :stop].each do |t|
|
# Put things that will set up an empty directory into a fully set-up
|
||||||
desc "start/stop is not necessary with mod_rails"
|
# instance of your project.
|
||||||
task t, :roles => :app do
|
invoke :'git:clone'
|
||||||
# nothing
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Precompile the assets and copy them over to the production site. (Don't build them there.)
|
# For help in making your deploy script, see the Mina documentation:
|
||||||
namespace :assets do
|
#
|
||||||
after "deploy:update_code", "assets:precompile"
|
# - http://nadarei.co/mina
|
||||||
after "assets:precompile", "assets:upload_assets"
|
# - 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