[deploy] config

This commit is contained in:
2018-01-01 20:42:55 +03:00
parent f1156d0779
commit 7209a297d7
4 changed files with 34 additions and 4 deletions

7
config.shmyga.ru.json Normal file
View File

@@ -0,0 +1,7 @@
{
"SdkDir": "/home/holop/sdk",
"SSH": {
"PrivateKey": null,
"Passphrase": null
}
}

16
config/config.rb Normal file
View File

@@ -0,0 +1,16 @@
set :config_role, :app
set :config_path, -> { release_path }
set :config_type, 'json'
namespace :config do
task :setup do
config_role = fetch(:config_role)
config_path = fetch(:config_path)
config_type = fetch(:config_type)
on roles(config_role) do |server|
# stage = fetch(:stage)
execute "cd #{config_path} && cp config.#{server.hostname}.#{config_type} config.#{config_type}"
end
end
end

View File

@@ -1,4 +1,5 @@
require_relative 'npm' require_relative 'npm'
require_relative 'config'
app = 'tankz' app = 'tankz'
user = 'holop' user = 'holop'
@@ -13,6 +14,9 @@ set :deploy_to, "/home/#{user}/repo/#{app}"
set :format, :airbrussh set :format, :airbrussh
set :format_options, command_output: false set :format_options, command_output: false
# config
before 'deploy:updated', 'config:setup'
# npm # npm
set :npm_target_path, -> { "/home/#{fetch(:user)}/npm" } set :npm_target_path, -> { "/home/#{fetch(:user)}/npm" }
set :npm_flags, '--silent --no-spin' set :npm_flags, '--silent --no-spin'

View File

@@ -1,10 +1,13 @@
role :app, %w{94.130.110.9} # host = '94.130.110.9'
role :web, %w{94.130.110.9} host = 'shmyga.ru'
role :db, %w{94.130.110.9}
role :app, host
role :web, host
role :db, host
user = fetch(:user) user = fetch(:user)
server '94.130.110.9', ssh_options: { port: 22, user: user, forward_agent: true } server host, ssh_options: { port: 22, user: user, forward_agent: true }
set :tmp_dir, "/home/#{user}/tmp" set :tmp_dir, "/home/#{user}/tmp"
set :branch, 'master' set :branch, 'master'