Created
November 23, 2022 19:09
-
-
Save davidleandro/d1f739a34c6e606d6c252e5334b6adce to your computer and use it in GitHub Desktop.
DEPLOY ANTIGO RADIOLOG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config valid only for current version of Capistrano | |
lock '3.4.1' | |
set :application, 'radiolog' | |
set :repo_url, 'https://<usuario>:<senha>@bitbucket.org/napex/radiolog.git' | |
set :git_https_username, '<usuario>' | |
set :git_https_password, '<senha>' | |
# Default branch is :master | |
ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp | |
# Default deploy_to directory is /var/www/my_app_name | |
# set :deploy_to, '/var/www/my_app_name' | |
set :deploy_to, '/var/www/radiolog' | |
# Default value for :scm is :git | |
# set :scm, :git | |
set :scm_passphrase, "<senha>" | |
# Default value for :format is :pretty | |
# set :format, :pretty | |
set :use_sudo, false | |
# Default value for :log_level is :debug | |
# set :log_level, :debug | |
# Default value for :pty is false | |
# set :pty, true | |
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/avatar','public/midia') | |
set :file_permissions_paths, ['public/midia','public/avatar'] | |
set :file_permissions_users, ["centos"] | |
set :file_permissions_chmod_mode, '0755' | |
#set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') | |
# Default value for :linked_files is [] | |
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') | |
# Default value for linked_dirs is [] | |
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system') | |
# 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 :ssh_options, { :forward_agent => true, :port => 22} | |
set :keep_releases, 5 | |
#default_run_options[:pty] = true | |
namespace :deploy do | |
desc 'Reiniciar aplica��o' | |
task :restart do | |
on roles(:app), in: :sequence, wait: 5 do | |
# Your restart mechanism here, for example: | |
# execute :touch, "#{release_path}/tmp/restart.txt" | |
execute :mkdir, '-p', "#{release_path}/log" | |
execute :mkdir, '-p', "#{release_path}/tmp" | |
execute :touch, "#{release_path}/tmp/restart.txt" | |
end | |
end | |
# desc "Criar links de documentos e uploads " | |
# task :create_links_dir_uploads do | |
# on release_roles :all do | |
# target_up = "#{release_path}/public/uploads" | |
# target_doc = "#{release_path}/documentos" | |
# | |
# source_up = "#{shared_path}/uploads" | |
# source_doc = "#{shared_path}/documentos" | |
# | |
# execute :rm, '-rf', target_up | |
# execute :rm, '-rf', target_doc | |
# | |
# execute :mkdir, '-p', source_up | |
# execute :mkdir, '-p', source_doc | |
# | |
# execute :ln, '-s', source_up, "#{release_path}/public/" | |
# execute :ln, '-s', source_doc, "#{release_path}/" | |
# | |
# set :file_permissions_paths, [target_up, target_doc] | |
# end | |
# end | |
desc "Criar links de audios detectados " | |
task :create_links_dir_uploads do | |
on release_roles :all do | |
target_up = "#{release_path}/public/" | |
execute :ln, '-nsf', '/mnt/audio_detec', target_up | |
set :file_permissions_paths, [target_up] | |
#set :file_permissions_chmod_mode, '0666' | |
target_mon = "#{release_path}/public/" | |
execute :ln, '-nsf', '/mnt/audio_monitor', target_mon | |
set :file_permissions_paths, [target_mon] | |
end | |
end | |
#after :log_revision, :create_links_dir_uploads | |
after :publishing, :create_links_dir_uploads, :restart | |
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 | |
before "deploy:updated", "deploy:set_permissions:acl" | |
after "deploy:set_permissions:acl", "deploy:set_permissions:chmod" | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# server-based syntax | |
# ====================== | |
# Defines a single server with a list of roles and multiple properties. | |
# You can define all roles on a single server, or split them: | |
# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value | |
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value | |
# server 'db.example.com', user: 'deploy', roles: %w{db} | |
server '52.43.232.248', user: 'centos', roles: %w{web app} | |
# role-based syntax | |
# ================== | |
# Defines a role with one or multiple servers. The primary server in each | |
# group is considered to be the first unless any hosts have the primary | |
# property set. Specify the username and a domain or IP for the server. | |
# Don't use `:all`, it's a meta role. | |
# role :app, %w{[email protected]}, my_property: :my_value | |
# role :web, %w{[email protected] [email protected]}, other_property: :other_value | |
# role :db, %w{[email protected]} | |
role :app, "52.43.232.248" | |
role :web, "52.43.232.248" | |
role :db, "52.43.232.248", :primary => true | |
# Configuration | |
# ============= | |
# You can set any configuration variable like in config/deploy.rb | |
# These variables are then only loaded and set in this stage. | |
# For available Capistrano configuration variables see the documentation page. | |
# http://capistranorb.com/documentation/getting-started/configuration/ | |
# Feel free to add new variables to customise your setup. | |
set :deploy_via, :copy | |
set :deploy_to, '/var/www/radiolog_prod' | |
# Custom SSH Options | |
# ================== | |
# You may pass any option but keep in mind that net/ssh understands a | |
# limited set of options, consult the Net::SSH documentation. | |
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start | |
# | |
# Global options | |
# -------------- | |
# set :ssh_options, { | |
# keys: %w(/home/rlisowski/.ssh/id_rsa), | |
# forward_agent: false, | |
# auth_methods: %w(password) | |
# } | |
# | |
# The server-based syntax can be used to override options: | |
# ------------------------------------ | |
# 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' | |
# } | |
set :rails_env, "production" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment