Specify the name of the application in the scene files on capistrano

I am trying to deploy my application with multi-stage / ext estities. It works great when each stage is on different servers. But for one specific project, I want to deploy two stages on the same server.

To do this, I need to set a different application name on each server. And this is what does not work.

I moved the application variable to the scene file and set the deploy_to variable with lazy loading.

config /deploy.rb

 set :stages, %w(production beta) set :default_stage, "beta" require 'capistrano/ext/multistage' #set :application, "myapp-beta" set :user, "deploy" set (:deploy_to) { "/home/#{user}/applications/#{application}" } 

configuration / expand / beta.rb

 server "my.server.com", :web, :app, :db, primary: true set :application, "myapp-beta" set :domains, "beta.myapp.com" set :branch, "beta" 

I get an error. Please specify the name of your application, set :application, 'foo'

Perhaps I should consider deploying to another server, but now I really want to understand why this does not work.

thanks

+4
source share
2 answers

There is nothing functionally wrong in the code. As Lavixu said, as long as you specify the scene name during deployment (i.e. cap beta deploy:setup , cap beta deploy ), the application variable will be recognized.

0
source
 set (:deploy_to) { "/home/#{user}/applications/#{application}" } 

Must be

 set :deploy_to, -> { "/home/#{user}/applications/#{application}" } 
0
source

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


All Articles