After a couple of years of making changes and pushing directly to the live production server environment, and seeing the detrimental effects it can cause, I am now looking at doing it properly.
I have read many forums and watched a whole bunch of videos on how people set up a remote repo in their server so they can push directly from the dev machine.
The issue I face is that all of them demonstrate a single domain, with no subdomains, simple html (no complex database stuffs), and always show how to push to a production server, not a dev/staging.
This is my situation:
I have a site (say it’s domain(dot)com). It has 8 subdomains, each containing a crm, cms, customer poertals, admin portals etc.
They all use the same sql database, so I cannot set up a new domain name and just stage to that, as it wouldn’t have access to the same database as the production domain server.
I have thought of having a seperate domain, eg domain-stage(dot)com and domain-dev(dot)com, but this won’t work because of the database issue.
I have also thought of domain(dot)com/stage/, but this will mess up a lot of hrefs/links in the code
I have thought of maybe some sort of htaccess magic to show the stage working tree instead, but haven’t explored it fully.
I guess the questions are;
How do I best go about this? How do other developers manage many subdomains, whilst using version control (GIT) and 2/3 accessible environments?
How will this fit in with the GIT repo? (I am planning on creating a new repo anyways, so this is flexible depending on what is best for this scenario)
My initial thought is that i would want to access portal.domain-stage(dot)com, hub.domain-stage(dot)com etc. But I cannot bring myself to creating 3 versions (1 for each environment) for each of the 8 subdomains. Along with that, the database wouldn’t be accessible from a separate domain. (unless it was a parked domain and with some htaccess magic?)
I am extremely stuck on how to best do this, so any suggestions or tips would be much appreciated!
(Yes… I have read every forum post on github, stackexchange, and google in general, and none of them answer my question, as they don’t focus on having many subdomains)