-
-
Save pedrolopez/0815d31e39a93f92e992 to your computer and use it in GitHub Desktop.
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 'bundler/capistrano' | |
| # Include this if you want to be able to set up different deployment stages (i.e. beta, stage, etc.) | |
| # require 'capistrano/ext/multistage' | |
| set :application, "example.com" | |
| set :user, "linuxusername" | |
| default_run_options[:pty] = true | |
| set :use_sudo, true | |
| set :repository, "path to git repo" | |
| set :scm, :git | |
| set :branch, "master" | |
| role :app, application | |
| role :web, application | |
| role :db, application, :primary => true | |
| set :stages, ["staging", "production"] | |
| set :default_stage, "production" | |
| set :deploy_to, "/path/to/project/on/server" | |
| set :deploy_via, :copy | |
| # How many versions of your deployed code to keep | |
| set :keep_releases, 5 | |
| # Setup Shared Folders that should be created inside the shared_path | |
| directory_configuration = %w(db config system) | |
| # It's good security practice to put your database.yml and other sensitive files in another folder on your server & symlink them in | |
| desc "Symlink shared config files" | |
| task :symlink_config_files do | |
| run "#{ try_sudo } ln -s #{ deploy_to }/shared/config/database.yml #{ current_path }/config/database.yml" | |
| end | |
| %w[start stop restart].each do |command| | |
| desc "#{command} Memcached" | |
| task command, roles: :app do | |
| run "service memcached #{command}" | |
| end | |
| end | |
| namespace :deploy do | |
| task :start do ; end | |
| task :stop do ; end | |
| task :restart, :roles => :app, :except => { :no_release => true } do | |
| run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
| end | |
| end | |
| after "deploy", "deploy:symlink_config_files" | |
| after "deploy", "deploy:restart" | |
| after "deploy", "deploy:cleanup" | |
| #http://stackoverflow.com/questions/3740152/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in-linux-ubunt | |
| # https://gist.github.com/meskyanichi/157958 | |
| # http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment