Roots Discourse

Bedrock Capistrano Deploying Staging and Production to different directories


#1

I am using Bedrock Capistrano and attempting to install to a shared hosting account with addon domains and subdomains pointing to the following directory setup on the server:

public_html/example.com
public_html/staging.example.com

My question relates to deploy.rb

It seems that deploy_to is set via the application variable, however I need to deploy staging and production to different folders.

I am unsure how to do that with the current configuration.

Would the deploy_to line simply be moved from deploy.rb to staging.rb and production.rb and edited accordingly?

Much thanks,


#2

Yes you can just set deploy_to in the environment configs.

However you’ll probably run into issues with extensions like Composer/NPM. See this issue for more details on the problem and workarounds:


#3

Thanks for the response,

I see your workaround in the referenced issue, but do you think it might be simpler to use your same logic to set the application variable instead?

#deploy.rb
if fetch(:stage) == 'production'
  set :application, 'example.com'
else
  set :application, 'staging.example.com'
end

Am I correct in assuming that Composer and NPM would be referencing the application variable? I know it fails to fully separate the configurations, but it seems like a simple solution in theory.


#4

I have no idea to be honest. You’d have to try it :slight_smile:


#5

Seems to work!

Now to figure out how to trigger composer and npm build for sage-9