Skip to content

Commit 4d862a2

Browse files
committed
Config to allow capistrano to deploy the application
1 parent a14cb60 commit 4d862a2

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

Capfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Load DSL and Setup Up Stages
2+
require 'capistrano/setup'
3+
4+
# Includes default deployment tasks
5+
require 'capistrano/deploy'
6+
7+
# Includes tasks from other gems included in your Gemfile
8+
#
9+
# For documentation on these, see for example:
10+
#
11+
# https://github.com/capistrano/rvm
12+
# https://github.com/capistrano/rbenv
13+
# https://github.com/capistrano/chruby
14+
# https://github.com/capistrano/bundler
15+
# https://github.com/capistrano/rails
16+
#
17+
# require 'capistrano/rvm'
18+
# require 'capistrano/rbenv'
19+
# require 'capistrano/chruby'
20+
# require 'capistrano/bundler'
21+
# require 'capistrano/rails/assets'
22+
# require 'capistrano/rails/migrations'
23+
24+
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
25+
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

config/deploy.rb

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# config valid only for Capistrano 3.1
2+
lock '3.2.1'
3+
4+
set :application, 'gas-api'
5+
set :repo_url, 'https://github.com/GeekSoc/gas-api.git'
6+
7+
# Default branch is :master
8+
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
9+
10+
# Default deploy_to directory is /var/www/my_app
11+
# set :deploy_to, '/home/asmillie/public_html/cap_test'
12+
13+
# Default value for :scm is :git
14+
# set :scm, :git
15+
16+
# Default value for :format is :pretty
17+
# set :format, :pretty
18+
19+
# Default value for :log_level is :debug
20+
set :log_level, :info
21+
22+
# Default value for :pty is false
23+
# set :pty, true
24+
25+
# Default value for :linked_files is []
26+
# set :linked_files, %w{config/database.yml}
27+
set :linked_files, %w{config.php}
28+
29+
# Default value for linked_dirs is []
30+
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
31+
32+
# Default value for default_env is {}
33+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
34+
35+
# Default value for keep_releases is 5
36+
# set :keep_releases, 5
37+
38+
39+
40+
namespace :deploy do
41+
42+
desc 'Restart application'
43+
task :restart do
44+
on roles(:app), in: :sequence, wait: 5 do
45+
# Your restart mechanism here, for example:
46+
# execute :touch, release_path.join('tmp/restart.txt')
47+
end
48+
end
49+
50+
after :publishing, :restart
51+
52+
after :restart, :clear_cache do
53+
on roles(:web), in: :groups, limit: 3, wait: 10 do
54+
# Here we can do anything such as:
55+
# within release_path do
56+
# execute :rake, 'cache:clear'
57+
# end
58+
end
59+
end
60+
61+
end

config/deploy/production.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Server details:
2+
server 'idran.geeksoc.org', user: 'deploy', port: 22, roles: %w{web app db}
3+
4+
set :deploy_to, '/var/www/applications/production/gas-api'

config/deploy/staging.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Server details:
2+
server 'idran.geeksoc.org', user: 'deploy', port: 22, roles: %w{web app db}
3+
4+
set :deploy_to, '/var/www/applications/staging/gas-api'

0 commit comments

Comments
 (0)