Deploying Staging and Production to Server Environment

Apologies if this comes off as a really stupid question – but having made it all the way through the deployment of Capistrano of Bedrock, I’m stumped how that actually translates into a live environment. I see the deploy, but not sure what I do to get it up on staging.mysite.com. Basically, my folder structure look like this (relevant directory only):

  • public_html |
    staging.mysite.com
    –myapp [Capistrano deploy]
    ---- current
    ----- web
    -----index.php
    ---- releases, etc…

It seems like either I am messing up the folder structure of the deploy OR I am supposed to set .htaccess files that will direct to the myapp/current/web folder with relevant rewrites.

Am I right about this or have I just screwed it up?

DId you setup your server using Bedrock Ansible?

I’m a little confused.

Is staging.mysite.com an existing folder on your server that either a) you want the site served out of, or b) something is already server out of. Meaning, is Apache configured to server a WP project out of staging.mysite.com?

If so, the solution seems mostly simple. In your deploy.rb just change deploy_to:

set :deploy_to, -> { "/srv/www/#{fetch(:application)}" } # default
set :deploy_to, -> { "/srv/www/staging.mysite.com" }

Then your repo will be deployed into staging.mysite.com which it seems like you want/need.

Thanks for writing back – first off, not using ansible.

So, I made the changes to the deploy.rb and it seems to mostly work (it’s pointing to the right place, though for some reason I am getting this error:

"Warning: require(/home/mysite/public_html/staging.mysite.com/releases/20150227231611/web/wp/wp-blog-header.php): failed to open stream: No such file or directory in /home/mysite/public_html/staging.mysite.com/releases/20150227231611/web/index.php on line 5

Fatal error: require(): Failed opening required ‘/home/mysite/public_html/staging.mysite.com/releases/20150227231611/web/wp/wp-blog-header.php’ (include_path=’.:/usr/local/php53/lib:/usr/lib/php:/usr/local/lib/php’) in /home/mysite/public_html/staging.mysite.com/releases/20150227231611/web/index.php on line 5"

But that (I think) is an unrelated issue. What I am trying to do is pretty basic – I want a production site at /public_htm/ and the staging server to live at /public_html/staging.mysite.com

I guess my question here is that while following your suggestion in deploy.rb I could create an additional

set :deploy_to, -> { “/home/public_html/” } for the production site, but (and again, I’m new at this, so thank you for bearing with me – isn’t that or shouldn’t that be specified in staging.rb and production.rb?

Basically what I want is that when I run bundle exec cap staging deploy – it deploys to /home/public_html/staging.mysite.com and when it deploys to production it goes to /home/public_html/

Thanks you so much for the help so far.