Skip to content

Instantly share code, notes, and snippets.

Last active Aug 24, 2018
What would you like to do?
deploy script for mina
require 'mina/rails'
require 'mina/git'
set :application_name, 'minaguide'
set :domain, ENV['domain']
set :deploy_to, '/root/project/minaguide'
set :repository, ''
set :branch, 'master'
set :user, 'root'
task :remote_environment do
# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
task :setup do
# we are pulling rc.local from a gist, in order to make uWSGI boot with the system
comment "pulling rc.local to /etc/ ..."
command %{wget -P /etc/}
comment "making it executable..."
command %{sudo chmod 755 /etc/rc.local}
comment "removing existing virtualhosts from /etc/nginx/sites-enabled/ ..."
command %{rm /etc/nginx/sites-enabled/*}
comment "fetching the virtualhost file from github gist..."
command %{wget -O /etc/nginx/sites-enabled/#{ENV['domain']} }
comment "replacing the with the actual domain specified in deploy.rb..."
command %{sed -i 's/{ENV['domain']}/g' /etc/nginx/sites-enabled/#{ENV['domain']}}
desc "Deploys the current version to the server."
task :deploy do
deploy do
invoke :'git:clone'
on :launch do
command %{sed -i 's/{ENV['domain']}/g' /root/project/minaguide/current/minaguide/}
command %{uwsgi --emperor /root/project/minaguide/current/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log}
command %{service nginx restart}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment