diff --git a/config.shmyga.ru.json b/config.shmyga.ru.json new file mode 100644 index 0000000..2375f9c --- /dev/null +++ b/config.shmyga.ru.json @@ -0,0 +1,7 @@ +{ + "SdkDir": "/home/holop/sdk", + "SSH": { + "PrivateKey": null, + "Passphrase": null + } +} diff --git a/config/config.rb b/config/config.rb new file mode 100644 index 0000000..13d1b9f --- /dev/null +++ b/config/config.rb @@ -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 \ No newline at end of file diff --git a/config/deploy.rb b/config/deploy.rb index 57f0372..ae58a5c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,4 +1,5 @@ require_relative 'npm' +require_relative 'config' app = 'tankz' user = 'holop' @@ -13,6 +14,9 @@ set :deploy_to, "/home/#{user}/repo/#{app}" set :format, :airbrussh set :format_options, command_output: false +# config +before 'deploy:updated', 'config:setup' + # npm set :npm_target_path, -> { "/home/#{fetch(:user)}/npm" } set :npm_flags, '--silent --no-spin' diff --git a/config/deploy/production.rb b/config/deploy/production.rb index db51b61..15a56ef 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1,10 +1,13 @@ -role :app, %w{94.130.110.9} -role :web, %w{94.130.110.9} -role :db, %w{94.130.110.9} +# host = '94.130.110.9' +host = 'shmyga.ru' + +role :app, host +role :web, host +role :db, host 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 :branch, 'master'