require "bundler/capistrano"
set :application, "YOURAPINAME"
set :user,"USERNAME"
set :scm, :git
set :repository, "git@github.com:GITHUBUSERNAME/REPO.git"
set :branch, "master"
set :use_sudo, false
server "VNDNSname", :web, :app, :db, primary: true
set :deploy_to, "/home/#{user}/apps/#{application}"
default_run_options[:pty] = true
ssh_options[:forward_agent] = false
ssh_options[:port] = 22
ssh_options[:keys] = ["/PATH/TO/myPrivateKey.key"]
namespace :deploy do
task :start, :roles => [:web, :app] do
run "cd #{deploy_to}/current && nohup bundle exec thin start -C config/production_config.yml -R config.ru"
sudo "/opt/openresty/nginx/sbin/nginx -p /opt/openresty/nginx/ -c /opt/openresty/nginx/conf/nginx.conf"
end
task :stop, :roles => [:web, :app] do
run "kill -QUIT cat /opt/openresty/nginx/logs/nginx.pid"
run "cd #{deploy_to}/current && nohup bundle exec thin stop -C config/production_config.yml -R config.ru"
end
task :restart, :roles => [:web, :app] do
deploy.stop
deploy.start
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /opt/openresty/nginx/conf/nginx.conf"
sudo "ln -nfs #{current_path}/config/lua_tmp.lua /opt/openresty/nginx/conf/lua_tmp.lua"
sudo "mkdir -p #{shared_path}/config"
end
after "deploy:setup", "deploy:setup_config"
end
require "bundler/capistrano"
set :application, "YOURAPINAME"
set :user,"USERNAME"
set :scm, :git
set :repository, "git@github.com:GITHUBUSERNAME/REPO.git"
set :branch, "master"
set :use_sudo, false
server "VNDNSname", :web, :app, :db, primary: true
set :deploy_to, "/home/#{user}/apps/#{application}"
default_run_options[:pty] = true
ssh_options[:forward_agent] = false
ssh_options[:port] = 22
ssh_options[:keys] = ["/PATH/TO/myPrivateKey.key"]
namespace :deploy do
task :start, :roles => [:web, :app] do
run "cd #{deploy_to}/current && nohup bundle exec thin start -C config/production_config.yml -R config.ru"
sudo "/opt/openresty/nginx/sbin/nginx -p /opt/openresty/nginx/ -c /opt/openresty/nginx/conf/nginx.conf"
end
task :stop, :roles => [:web, :app] do
run "kill -QUIT cat /opt/openresty/nginx/logs/nginx.pid"
run "cd #{deploy_to}/current && nohup bundle exec thin stop -C config/production_config.yml -R config.ru"
end
task :restart, :roles => [:web, :app] do
deploy.stop
deploy.start
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /opt/openresty/nginx/conf/nginx.conf"
sudo "ln -nfs #{current_path}/config/lua_tmp.lua /opt/openresty/nginx/conf/lua_tmp.lua"
sudo "mkdir -p #{shared_path}/config"
end
after "deploy:setup", "deploy:setup_config"
end
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
task :cold do
deploy.update
deploy.start
end
task :cold do
deploy.update
deploy.start
end
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
task :cold do
deploy.update
deploy.start
end
task :cold do
deploy.update
deploy.start
end
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
environment: production
chdir: /home/USERNAME/apps/YOURAPINAME/current/
address: 127.0.0.1
user: USERNAME
port: 8000
pid: /home/USERNAME/apps/YOURAPINAME/current/tmp/thin.pid
rackup: /home/USERNAME/apps/YOURAPINAME/current/config.ru
log: /home/USERNAME/apps/YOURAPINAME/current/log/thin.log
max_conns: 1024
timeout: 30
max_persistent_conns: 512
daemonize: true
environment: production
chdir: /home/USERNAME/apps/YOURAPINAME/current/
address: 127.0.0.1
user: USERNAME
port: 8000
pid: /home/USERNAME/apps/YOURAPINAME/current/tmp/thin.pid
rackup: /home/USERNAME/apps/YOURAPINAME/current/config.ru
log: /home/USERNAME/apps/YOURAPINAME/current/log/thin.log
max_conns: 1024
timeout: 30
max_persistent_conns: 512
daemonize: true
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
git add .
git commit -m "adding config files"
git push
git add .
git commit -m "adding config files"
git push
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow