Created
February 21, 2014 08:45
Revisions
-
stevenyap revised this gist
May 22, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -79,6 +79,7 @@ desc "Seed data to the database" task :seed => :environment do queue "cd #{deploy_to}/#{current_path}/" queue "bundle exec rake db:seed RAILS_ENV=#{rails_env}" queue %[echo "-----> Rake Seeding Completed."] end ``` -
stevenyap revised this gist
May 19, 2014 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -74,6 +74,12 @@ task :deploy => :environment do end end end desc "Seed data to the database" task :seed => :environment do queue "cd #{deploy_to}/#{current_path}/" queue "bundle exec rake db:seed RAILS_ENV=#{rails_env}" end ``` ## Extra -
stevenyap revised this gist
May 2, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -77,6 +77,7 @@ end ``` ## Extra - If the git repository is in the same server, you can change to: `set :repository, '/full/path/to/git/appname.git'` - To force unlock, `mina deploy:force_unlock` - Mina deploy by creating and symlinking the entire release folder with a new folder from git: - If you are storing files as data (such as Paperclip to store uploaded attachments) or need to maintain folders that cannot be overwritten by git, -
stevenyap created this gist
Feb 21, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,85 @@ ## Introduction - Mina is a gem which is very simliar to Capistrano but much FASTER! - See https://github.com/nadarei/mina for the gem - See http://nadarei.co/mina/ for documentation - See https://gist.github.com/jbonney/6257372 for a good example on configuring Mina ## Mina Deploy.rb ```ruby require 'mina/bundler' require 'mina/rails' require 'mina/git' require 'mina/rvm' # Basic settings: set :domain, 'api.openseas.com.sg' set :app, 'stapi' set :repository, 'ssh://stapi@203.142.24.148/~/git/stapi.git' set :rvm_path, '/usr/local/rvm/scripts/rvm' set :user, 'stapi' # You need to manually upload your database.yml file as Mina will not deploy for you - 12factors set :shared_paths, ['config/database.yml', 'log'] # This task is the environment that is loaded for most commands, such as # `mina deploy` or `mina rake`. task :environment do # Ensure that a server has been set stage = ENV['to'] case stage when 'staging' set :branch, 'staging' when 'production' set :branch, 'master' else print_error "Please specify a stage. eg. mina deploy to=production" exit end set :rails_env, stage set :deploy_to, "/var/www/#{app}/#{stage}" invoke :"rvm:use[ruby-2.0.0-p353@#{app}]" end # Put any custom mkdir's in here for when `mina setup` is ran. # For Rails apps, we'll make some of the shared paths that are shared between # all releases. 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! %[touch "#{deploy_to}/shared/config/database.yml"] queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."] end desc "Deploys the current version to the server." task :deploy => :environment do deploy do # Put things that will set up an empty directory into a fully set-up # instance of your project. invoke :'git:clone' invoke :'deploy:link_shared_paths' invoke :'bundle:install' invoke :'rails:db_migrate' invoke :'rails:assets_precompile' to :launch do queue "mkdir -p #{deploy_to}/#{current_path}/tmp" queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt" end end end ``` ## Extra - To force unlock, `mina deploy:force_unlock` - Mina deploy by creating and symlinking the entire release folder with a new folder from git: - If you are storing files as data (such as Paperclip to store uploaded attachments) or need to maintain folders that cannot be overwritten by git, - put the folder in `shared/{path_to_folder}` - add the file path in set `:shared_paths` - Eg. `set :shared_paths, ['config/database.yml', 'log', '{path_to_folder}']`