ruby on rails - Running Migration after capistrano deployment -


i trying learn deployment using capistrano. want deploy code on separate folder in local machine , run migrations after deployment. capistrano gems used in project follows

capistrano (3.4.0) capistrano-bundler (1.1.4) capistrano-ext (1.2.1) capistrano-rails (1.1.3) 

the application using ruby 2.1 , rails 4.1 deploy file follows

require 'capistrano/rails/migrations' lock '3.4.0'  set :application, 'capistrano_study' set :repo_url, 'https://github.com/xxxxxx/capistrano_study.git'  # config valid current version of capistrano set :stages, ["staging", "production"] set :default_stage, "staging" set :user, "prajeesh" after "deploy:updated", "deploy:migrate" namespace :deploy   after :restart, :clear_cache     on roles(:web), in: :groups, limit: 3, wait: 10       # here can such as:       # within release_path       #   execute :rake, 'cache:clear'       # end     end   end end 

staging.rb file follows.

server 'xx.x.x.xxx', user: 'prajeesh', roles: %w{app db web}, my_property: :my_value set :deploy_to, "/home/prajeesh/desktop/projects/capistrano_staging" 

database.yml

development:   adapter: mysql2   encoding: utf8   reconnect: false   database: cap_test_staging   pool: 5   username: root   password: xxxxx #  socket: /var/run/mysqld/mysqld.sock     staging:   adapter: mysql2   encoding: utf8   reconnect: false   database: cap_test_staging   pool: 5   username: root   password: xxxxx 

when run command cap staging:deploy, deployment working fine. issue migrations not running after deployment.

does know how fix this?

edit:

this error getting.

info [175f4b0b] running /usr/bin/env rake db:migrate   prajeesh@xx.x.x.xxx debug [175f4b0b] command: cd /home/prajeesh/desktop/projects/capistrano_staging/current && ( rails_env=development /usr/bin/env rake db:migrate ) debug [175f4b0b]    rake aborted! debug [175f4b0b]      cannot load such file -- bundler/setup 

if run command rails_env=development /usr/bin/env rake db:migrate directly project path, migration running through capistrano not working.

any appreciated.

hey should run below command run command:

cap deploy:migrate 

to run, can see documentation here

updated automating migration:

after "deploy:update_code", "deploy:migrate" 

into file config/deploy.rb.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -