When this project started, we installed a brand new Virtual Machine to staging.domain1.com (www.domain1.com is on another hosting server, that is going to be brought back on the VM). I set up trellis to publish both staging and production servers on that VM. Staging has been working fine and development is going well.
In the meanwhile, the requirements have changed. The site currently developed on staging.domain1.com will need to be produced on the domain2.com domain name, that we will have in a few days. When we have it, I need to publish a “Site under maintenance” waiting page, whilst we continue developing on the staging.domain1.com.
This is my first project using Ansible and I’m puzzled as what I need to do (and a bit afraid to break the staging environment).
- Is it possible to use trellis to provision a production virtualhost when we do not have proper DNS redirection ?
- Or Is it better that I configure the temporary virtualhost manually via SSH?
- Or Should I create 2 completely separate Trellis setups, one for each domain (domain1.com domain2.com), then copy domain1 sourcecode over to domain2?
Any advise would be most welcome.
Have you tried this? Afaik the only issue you might encounter is LetsEncrypt so you may want to disable SSL until you get your DNS squared away.
Which VPS provider are you using? You can set up another server for $5 on Digital Ocean, which is generally suggested anyways to keep staging and production separate, for these reasons. Mess with staging without accidentally modifying the live site.
Do you mean that with Trellis, one shouldn’t use the same VM for the various environments?
I’m not at liberty to reveal the VPS provider, but it is not DigitalOcean.
I thought I solved my issue but provisioning the production server seems to have erased the staging. gasp.
The VM is only for development. Remote environments (staging, production) are separate and associated with the relevant environment names within the
Lots of details missing here. What exactly are you doing? What files have you modified, what do they look like, and what are the commands you are running?
Have you read through the docs?
I’m sorry, I meant VPS.
Is it actually possible to have the staging and the production environments on the same server ?
What I did exactly is to provision the production server, then deploy it. At that point, I noticed the staging server was unavailable. So I looked in /etc/nginx/sites-enabled and only saw a virtualhost for the production server, none for the staging.
(staging is : staging.domain1.com production is: next.domain1.com with redirects the upcoming domain2.com )
Yes, I did read through the documentation.
Thank you, and sorry again for the misleading information.
Each remote environment is its own VPS, you cannot have staging and production on the same remote server — they are two separate ones
Is there anywhere in the documentation that led you to believe that you could have staging and production on the same server? We’re always wanting to improve docs
Honestly, it’s my own mistake. We chose the VPS for this project before I discovered Trellis. since this VPS has so many resources when I discovered Trellis i thought “what the heck, I don’t need another VPS for this”. My bad, really.
That said, if you hear other blokes like me making this mistake, perhaps this page could have an additional sentence at the beginning, describing the concept of “environment”. Something like:
"Now that you have a local environment to develop your site, you probably need a “real” environment to publish your work - often referred to as “production” environment. Moreover, If you work in a team or if you need to show your latest developments to your client or team members, you would need a “staging” (or “testing”) environment . Trellis makes it easy to keep several environments mirrored. Note that each of them must reside on their own (VP or Dedicated) Server, otherwise, you’ll be running into troubles."
Thank you @ben
When provisioning the remote server, is there any differences between production and staging?
I believe this is possible if you have two different names for the sites in your wordpress_sites.yml for staging and production.
This would create two sites-available files that would not conflict, two databases, and two entries in /srv/www/
If you use the same site name, you will confuse the system.
PS: I have NOT done this yet, but have thought about it extensively!