70 lines
2.2 KiB
Ruby

set :application, 'thirteen-tien-len'
set :repo_url, 'git@bitbucket.org:jessecfisher/thirteen-tien-len.git'
# If you want to import assets, you can change default asset dir (default = system)
# This directory must be in your shared directory on the server
set :assets_dir, %w(public/assets public/system)
#set :local_assets_dir, %w(public/assets public/att)
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_to, "/home/jesse/web/thirteen-tien-len_#{fetch(:stage)}"
# set :scm, :git
# set :format, :pretty
# set :log_level, :debug
# set :pty, true
set :linked_files, %w{config/database.yml .env}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/lift-calculator}
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.2.3'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all # default value
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# set :keep_releases, 5
set :nginx_path, '/etc/nginx' # directory containing sites-available and sites-enabled
set :nginx_template, 'config/deploy/nginx_conf.erb' # configuration template
#set :nginx_server_name, 'example.com' # optional, defaults to :application
#set :nginx_upstream, 'example-app' # optional, defaults to :application
set :nginx_listen, 80 # optional, default is not set
set :nginx_roles, :all
namespace :db do
desc 'Setup the database'
task :setup do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
with rails_env: (fetch(:rails_env) || fetch(:stage)) do
execute :rake, 'db:setup'
end
end
end
end
end
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, 'deploy:cleanup'
end