forked from huginn/huginn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.rb
54 lines (42 loc) · 1.55 KB
/
deploy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'dotenv'
Dotenv.load
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'huginn'
set :repo_url, ENV['CAPISTRANO_DEPLOY_REPO_URL'] || 'https://github.com/cantino/huginn.git'
# Default branch is :master
set :branch, ENV['CAPISTRANO_DEPLOY_BRANCH'] || ENV['BRANCH'] || 'master'
set :deploy_to, '/home/huginn'
# Set to :debug for verbose ouput
set :log_level, :info
# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('.env', 'Procfile', 'config/unicorn.rb')
# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle')
# Default value for keep_releases is 5
# set :keep_releases, 5
set :bundle_jobs, 4
set :conditionally_migrate, true # Defaults to false. If true, it's skip migration if files in db/migrate not modified
task :deploy => [:production]
namespace :deploy do
after 'check:make_linked_dirs', :migrate_to_cap do
on roles(:all) do
# Try to migrate from the manual installation to capistrano directory structure
next if test('[ -L ~/huginn ]')
fetch(:linked_files).each do |f|
if !test("[ -f ~/shared/#{f} ] ") && test("[ -f ~/huginn/#{f} ]")
execute("cp ~/huginn/#{f} ~/shared/#{f}")
end
end
execute('mv ~/huginn ~/huginn.manual')
execute('ln -s ~/current ~/huginn')
end
end
after :publishing, :restart do
on roles(:all) do
within release_path do
execute :rake, 'production:restart'
end
end
end
end