Ssh you_server "cp /home/deploy/database.yml /home/deploy/rails_projects/dummy_app/shared/config/database.yml & mv /home/deploy/database.yml /home/deploy/rails_projects/dummy_app_staging/shared/config/database.yml" Ssh your_server "mkdir /home/deploy/rails_projects/dummy_app/shared/config/initializers & mkdir /home/deploy/rails_projects/dummy_app_staging/shared/config/initializers" Ssh your_server "mkdir /home/deploy/rails_projects/dummy_app/shared/config & mkdir /home/deploy/rails_projects/dummy_app_staging/shared/config" Scp config/database.yml you-server:/home/deploy & scp config/initializers/secret_token.rb your-server:/home/deploy You have to specify paths, where the production and staging app instance will be deployed. Now, create deploy directory in config directory and add production.rb and staging.rb files there. # config/deploy.rb require "bundler/capistrano" require 'capistrano/ext/multistage' require "rvm/capistrano" # General set :keep_releases, 5 # or any other number of releases you would like to keep ssh_options = 12345 # if you haven't changed anything in SSH config, set it to 22 ssh_options = true # forward ssh keys default_run_options = true # set for the password prommpt set :application, "dummy_app" # set the name of you application here set :user, "deploy" # and the server user name set :stages, # Set staging and production environment set :default_stage, "staging" # Use staging environment as the default one to prevent accidentally deploying to production set :deploy_via, :remote_cache # it will only fetch from the repository on server, not clone the entire repository from scratch set :use_sudo, false # do not use sudo # Git set :scm, :git # set git as a Source Code Manager set :repository, # /config/initializers/secret_token.rb" # This file is not included repository, so we will create a symlink end end before 'deploy:assets:precompile', 'deploy:symlink_db' # callback: run this task before deploy:assets:precompile before 'deploy:assets:precompile', 'deploy:symlink_secret_token' # callback: run this task before deploy:assets:precompile after "deploy", "deploy:cleanup" # delete old releases
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |