Skip to content

Commit 8a078dd

Browse files
reset ecoportal deploy scripts
1 parent e5167c1 commit 8a078dd

File tree

4 files changed

+25
-92
lines changed

4 files changed

+25
-92
lines changed

config/deploy.rb

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
set :author, "ontoportal-lirmm"
2-
set :application, "ontologies_api"
3-
set :repo_url, "https://github.com/#{fetch(:author)}/#{fetch(:application)}.git"
1+
# config valid only for Capistrano 3
42

53
APP_PATH = '/srv/ontoportal'
64

@@ -13,7 +11,7 @@
1311
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
1412

1513
# Default deploy_to directory is /var/www/my_app
16-
set :deploy_to, "/srv/ontoportal/#{fetch(:application)}"
14+
set :deploy_to, "#{APP_PATH}/#{fetch(:application)}"
1715

1816
# Default value for :scm is :git
1917
# set :scm, :git
@@ -22,7 +20,7 @@
2220
# set :format, :pretty
2321

2422
# Default value for :log_level is :debug
25-
set :log_level, :error
23+
# set :log_level, :debug
2624

2725
# Default value for :pty is false
2826
# set :pty, true
@@ -47,39 +45,11 @@
4745
# required for restarting unicorn with sudo
4846
set :pty, true
4947
# Default value for default_env is {}
50-
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
48+
set :default_env, {
49+
}
5150

5251
# Default value for keep_releases is 5
5352
set :keep_releases, 5
54-
set :config_folder_path, "#{fetch(:application)}/#{fetch(:stage)}"
55-
56-
# If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb:
57-
58-
SSH_JUMPHOST = ENV.include?('SSH_JUMPHOST') ? ENV['SSH_JUMPHOST'] : 'jumpbox.hostname.com'
59-
SSH_JUMPHOST_USER = ENV.include?('SSH_JUMPHOST_USER') ? ENV['SSH_JUMPHOST_USER'] : 'username'
60-
61-
JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}"
62-
set :ssh_options, {
63-
user: 'ontoportal',
64-
forward_agent: 'true',
65-
keys: %w(config/deploy_id_rsa),
66-
auth_methods: %w(publickey),
67-
# use ssh proxy if API servers are on a private network
68-
proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p")
69-
}
70-
71-
# private git repo for configuraiton
72-
PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://[email protected]/your_organization/ontoportal-configs.git'
73-
desc "Check if agent forwarding is working"
74-
task :forwarding do
75-
on roles(:all) do |h|
76-
if test("env | grep SSH_AUTH_SOCK")
77-
info "Agent forwarding is up to #{h}"
78-
else
79-
error "Agent forwarding is NOT up to #{h}"
80-
end
81-
end
82-
end
8353

8454
# inspired by http://nathaniel.talbott.ws/blog/2013/03/14/post-deploy-smoke-tests/
8555
desc 'Run smoke test'
@@ -107,17 +77,18 @@
10777
end
10878
end
10979

80+
11081
namespace :deploy do
11182

11283
desc 'Incorporate the private repository content'
11384
# Get cofiguration from repo if PRIVATE_CONFIG_REPO env var is set
11485
# or get config from local directory if LOCAL_CONFIG_PATH env var is set
11586
task :get_config do
11687
if defined?(PRIVATE_CONFIG_REPO)
117-
TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}".freeze
88+
TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}"
11889
on roles(:app) do
11990
execute "git clone -q #{PRIVATE_CONFIG_REPO} #{TMP_CONFIG_PATH}"
120-
execute "rsync -av #{TMP_CONFIG_PATH}/#{fetch(:config_folder_path)}/ #{release_path}/"
91+
execute "rsync -av #{TMP_CONFIG_PATH}/#{fetch(:application)}/ #{release_path}/"
12192
execute "rm -rf #{TMP_CONFIG_PATH}"
12293
end
12394
elsif defined?(LOCAL_CONFIG_PATH)
@@ -130,10 +101,10 @@
130101
desc 'Restart application'
131102
task :restart do
132103
on roles(:app), in: :sequence, wait: 5 do
133-
# Your restart mechanism here, for example:
134-
# execute :touch, release_path.join('tmp/restart.txt')
135-
execute 'sudo systemctl restart unicorn'
136-
execute 'sleep 5'
104+
# Your restart mechanism here, for example:
105+
# execute :touch, release_path.join('tmp/restart.txt')
106+
execute 'sudo systemctl restart unicorn'
107+
execute 'sleep 5'
137108
end
138109
end
139110

config/deploy/agroportal.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/deploy/staging.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/deploy/test.rb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
# Simple Role Syntax
2-
# ==================
3-
# Supports bulk-adding hosts to roles, the primary
4-
# server in each group is considered to be the first
5-
# unless any hosts have the primary property set.
6-
# Don't declare `role :all`, it's a meta role
7-
role :app, %w{testportal.lirmm.fr}
8-
role :db, %w{testportal.lirmm.fr} # sufficient to run db:migrate only on one system
9-
# Extended Server Syntax
10-
# ======================
11-
# This can be used to drop a more detailed server
12-
# definition into the server list. The second argument
13-
# something that quacks like a hash can be used to set
14-
# extended properties on the server.
15-
#server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
16-
set :log_level, :error
17-
set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'test'
1+
set :branch, 'master'
2+
set :server, 'ecoportal.lifewatchdev.eu'
3+
4+
server fetch(:server), user: fetch(:user), roles: %w{web app}
5+
6+
set :ssh_options, {
7+
user: 'ontoportal',
8+
forward_agent: 'true',
9+
#keys: %w(config/deploy_id_rsa),
10+
#auth_methods: %w(publickey),
11+
# use ssh proxy if UI servers are on a private network
12+
#proxy: Net::SSH::Proxy::Command.new('ssh [email protected] -W %h:%p')
13+
}

0 commit comments

Comments
 (0)