Last active
April 8, 2018 16:13
-
-
Save prsanjay/e44b62826f0554d19cd9bc73dd3814df to your computer and use it in GitHub Desktop.
Mina Initial Setup
This file contains hidden or 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/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
require 'mina/rbenv' | |
set :repository, '[email protected]:sanjayprajapati/your-app.git' | |
set :user, 'deploy' | |
set :deploy_to, '/home/deploy/your-app-name' | |
set :branch, 'develop' | |
set :domain, YOUR_SERVER_IP | |
set :application_name, 'your-app-name' | |
set :term_mode, nil | |
set :shared_paths, [ | |
'config/database.yml', | |
'config/application.yml', | |
'tmp', | |
'log' | |
] | |
task :environment do | |
invoke :'rbenv:load' | |
end | |
task :setup => :environment do | |
queue! %[mkdir -p "#{deploy_to}/shared/log"] | |
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"] | |
queue! %[mkdir -p "#{deploy_to}/shared/config"] | |
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"] | |
queue! %[mkdir -p "#{deploy_to}/shared/tmp"] | |
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/tmp"] | |
queue! %[touch "#{deploy_to}/shared/config/database.yml"] | |
queue! %[touch "#{deploy_to}/shared/config/application.yml"] | |
end | |
desc "Deploys the current version to the server." | |
task deploy: :environment do | |
deploy do | |
invoke :'git:clone' | |
invoke :'deploy:link_shared_paths' | |
invoke :'bundle:install' | |
invoke :'rails:db_migrate' | |
invoke :'rails:assets_precompile' | |
invoke :'deploy:cleanup' | |
to :launch do | |
invoke :'passenger:restart' | |
end | |
end | |
end | |
namespace :passenger do | |
desc "Restart Passenger" | |
task :restart do | |
queue %{ | |
echo "-----> Restarting passenger" | |
cd #{deploy_to}/current | |
#{echo_cmd %[mkdir -p tmp]} | |
#{echo_cmd %[touch tmp/restart.txt]} | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment