Last active
August 24, 2018 15:05
-
-
Save tyaakow/82dbe0994c398ac4d3772a1a7745a7b9 to your computer and use it in GitHub Desktop.
deploy script for mina
This file contains 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
require 'mina/rails' | |
require 'mina/git' | |
set :application_name, 'minaguide' | |
set :domain, ENV['domain'] | |
set :deploy_to, '/root/project/minaguide' | |
set :repository, 'https://github.com/tyaakow/django-uwsgi-starter.git' | |
set :branch, 'master' | |
set :user, 'root' | |
task :remote_environment do | |
end | |
# 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/ https://gist.githubusercontent.com/tyaakow/62a5f91dbf59b32e088ec15c8375ca76/raw/c0c864317888419cbb9f2c4311149649cea2be1a/rc.local} | |
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']} https://gist.githubusercontent.com/tyaakow/1cd0a30095000c11301d3359b13a3537/raw/197eb92160588c2e61818a90e28782a344e5fbae/myxydomain.conf } | |
comment "replacing the myxydomain.com with the actual domain specified in deploy.rb..." | |
command %{sed -i 's/myxydomain.com/#{ENV['domain']}/g' /etc/nginx/sites-enabled/#{ENV['domain']}} | |
end | |
desc "Deploys the current version to the server." | |
task :deploy do | |
deploy do | |
invoke :'git:clone' | |
on :launch do | |
command %{sed -i 's/myxydomain.com/#{ENV['domain']}/g' /root/project/minaguide/current/minaguide/settings.py} | |
command %{uwsgi --emperor /root/project/minaguide/current/uwsgi/vassals --daemonize /var/log/uwsgi-emperor.log} | |
command %{service nginx restart} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment