Skip to content

Commit

Permalink
reset ecoportal deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 30, 2024
1 parent ebe1997 commit 4b8304a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 162 deletions.
110 changes: 0 additions & 110 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,20 @@

set :deploy_via, :remote_cache

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

# default deployment branch is master which can be overwritten with BRANCH env var
# BRANCH env var can be set to specific branch of tag, i.e 'v6.8.1'


# Default deploy_to directory is /var/www/my_app
set :deploy_to, "/srv/ontoportal/bioportal_web_ui"

# Default value for :scm is :git
# set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
set :log_level, :error

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
# set :linked_files, %w{config/bioportal_config.rb config/database.yml public/robots.txt}

# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache public/system public/assets config/locales}
set :linked_dirs, %w{log tmp/pids tmp/cache}
append :linked_files, 'config/database.yml', 'config/bioportal_config_appliance.rb'
#append :linked_dirs, 'log', 'tmp', '.bundle'
append :linked_files, 'config/secrets.yml', 'config/site_config.rb','config/credentials/appliance.key', 'config/credentials/appliance.yml.enc'

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
set :keep_releases, 5
set :bundle_without, 'development:test'
set :bundle_config, { deployment: true }
Expand All @@ -53,86 +31,9 @@
# If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb:

set :passenger_restart_with_touch, true
# If you want to restart using `passenger-config restart-app`, add this to your config/deploy.rb:
# set :passenger_restart_with_touch, false # Note that `nil` is NOT the same as `false` here
# If you don't set `:passenger_restart_with_touch`, capistrano-passenger will check what version of passenger you are running
# and use `passenger-config restart-app` if it is available in that version.

# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
# and/or per server
# server 'example.com',
# user: 'user_name',
# roles: %w{web app},
# ssh_options: {
# user: 'user_name', # overrides user setting above
# keys: %w(/home/user_name/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(publickey password)
# # password: 'please use keys'
# }
# setting per server overrides global ssh_options

SSH_JUMPHOST = ENV.include?('SSH_JUMPHOST') ? ENV['SSH_JUMPHOST'] : 'jumpbox.hostname.com'
SSH_JUMPHOST_USER = ENV.include?('SSH_JUMPHOST_USER') ? ENV['SSH_JUMPHOST_USER'] : 'username'

JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}"
set :ssh_options, {
user: 'ontoportal',
forward_agent: 'true',
keys: %w(config/deploy_id_rsa),
auth_methods: %w(publickey),
# use ssh proxy if UI servers are on a private network
proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p")
}

#private git repo for configuraiton
PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://[email protected]/your_organization/ontoportal-configs.git'
desc "Check if agent forwarding is working"
task :forwarding do
on roles(:all) do |h|
if test("env | grep SSH_AUTH_SOCK")
info "Agent forwarding is up to #{h}"
else
error "Agent forwarding is NOT up to #{h}"
end
end
end

namespace :deploy do
desc 'display remote system env vars'
task :show_remote_env do
on roles(:all) do
remote_env = capture("env")
puts remote_env
end
end

desc 'Incorporate the bioportal_conf private repository content'
# Get cofiguration from repo if PRIVATE_CONFIG_REPO env var is set
# or get config from local directory if LOCAL_CONFIG_PATH env var is set
task :get_config do
if defined?(PRIVATE_CONFIG_REPO)
TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}".freeze
on roles(:app) do
execute "git clone -q #{PRIVATE_CONFIG_REPO} #{TMP_CONFIG_PATH}"
execute "rsync -a #{TMP_CONFIG_PATH}/#{fetch(:config_folder_path)}/ #{release_path}/"
execute "rm -rf #{TMP_CONFIG_PATH}"
end
elsif defined?(LOCAL_CONFIG_PATH)
on roles(:app) do
execute "rsync -a #{LOCAL_CONFIG_PATH}/#{fetch(:application)}/ #{release_path}/"
end
end
end

desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
Expand All @@ -141,16 +42,5 @@
end
end


#after :updating, :get_config
after :publishing, :restart

after :restart, :clear_cache do
on roles(:app), 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
end
17 changes: 0 additions & 17 deletions config/deploy/agroportal.rb

This file was deleted.

17 changes: 0 additions & 17 deletions config/deploy/staging.rb

This file was deleted.

30 changes: 13 additions & 17 deletions config/deploy/test.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary
# server in each group is considered to be the first
# unless any hosts have the primary property set.
# Don't declare `role :all`, it's a meta role
role :app, %w{testportal.lirmm.fr}
role :db, %w{testportal.lirmm.fr} # sufficient to run db:migrate only on one system
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server
# definition into the server list. The second argument
# something that quacks like a hash can be used to set
# extended properties on the server.
#server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
set :log_level, :error
set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'test'
set :branch, 'master'
set :server, 'ecoportal.lifewatchdev.eu'

server fetch(:server), user: fetch(:user), roles: %w{web app}

set :ssh_options, {
user: 'ontoportal',
forward_agent: 'true',
#keys: %w(config/deploy_id_rsa),
#auth_methods: %w(publickey),
# use ssh proxy if UI servers are on a private network
#proxy: Net::SSH::Proxy::Command.new('ssh [email protected] -W %h:%p')
}
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2020_09_21_120918) do
ActiveRecord::Schema[7.0].define(version: 2023_11_30_210229) do
create_table "analytics", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "segment"
t.string "action"
Expand Down

0 comments on commit 4b8304a

Please sign in to comment.