carlalexander / debops-wordpress

Your superpowered WordPress server in three commands.
GNU General Public License v3.0
440 stars 65 forks source link

Changing domain after installation #134

Closed journeytosilius closed 7 years ago

journeytosilius commented 7 years ago

Hi, I am using debops-wordpress and everything is fine so far, but I am using a temporary domain to develop the site only to switch to the production domain once it is ready for production. What would be the proper approach to do this ?

carlalexander commented 7 years ago

Good question! I think there are a few ways to do. It also depends on whether you're using Let's Encrypt or not.

But, from a professional perspective, I view the temporary site as a staging environment. So, once it's ready, I'd create a new server with the production domain. I'd then migrate the database (replacing the old domain in the process) and files over.

drybjed commented 7 years ago

To supplement this from the DebOps side of things - the project isn't designed with the ability to change the host's domain at will. What you want to do is setup a new host on the required domain and apply the playbooks on it - various roles will use the detected domain in the configuration files. Changing the domain after that is theoretically possible, but things might break as a result.

journeytosilius commented 7 years ago

Yeah, using Let's Encrypt is a must, so I guess the best way to do this is dumping files and database and then import to the new site I guess. There is a little plugin that does the domain changing very effectively so no more local scripts to achieve it. I have tested this in production and it's flawless : https://wordpress.org/plugins/automatic-domain-changer/

carlalexander commented 7 years ago

Did this work for you? Can we close?

felixfrtz commented 7 years ago

I am also interested in this, as I am in a situation where I can't change the records of the production domain to point to my dev droplet. The transfer must be seamless. @chromafunk As carl asked, did this work for you?

AJMiller commented 7 years ago

not to hijack this thread, but as I've used this script I've found myself caught in the same situation. If there is already an old production site, then standing up a new server with the correct production domain would mean the site going down for x period of time, then showing a default WP theme until you get the new site uploaded. It would be ideal if we could add multiple hosts to a server like:

// inventory/hosts
[debops_all_hosts]
staging.wordpress.com

[wordpress]
staging.wordpress.com
wordpress.com
www.wordpress.com

that would setup the ssh and default config under the staging url but allow nginx to listen on both staging/prod urls. There's still the matter of re-running let's encrypt once the DNS record for the prod site is pointed to the new IP address, but if that could simply occur by re-running # debops or # debops wordpress, that wouldn't be a huge issue.

carlalexander commented 7 years ago

I'm going to close this. Feel free to reopen if you still have the issue @chromafunk!