Why store a copy of the application on the database node?

Many examples of Capistrano recipes include a role :db. By default, the deployment task exports application code to all hosts in all roles. Thus, this suggests that it is typical for people to keep a copy of their application on the database node. In addition, in a common Capistrano recipe, deploy.rb :deploy:migrateit looks like this:

task :migrate, :roles => :db, :only => { :primary => true } do
  # ...
end

My question is: why is this done? Wouldn't it be cleaner to keep the application code with the DB host (which Ruby might not have even installed) and run the migrations from the production box?

+3
source share
1 answer

db , "" .

, // .

, , , .

, - :

role :db, 'dbhost', :no_release => true

:

role :app, 'apphost', :runs_migrations => true
task :migrate, :roles = :app, :only => {:runs_migrations => true } do
  #...
end
+7

Source: https://habr.com/ru/post/1713143/


All Articles