MainWP Community

Options for cloning from a production to an acceptance environment without having to reconnect

I have a production server with several WordPress sites (and other systems) that I’m using MainWP on to manage them. The exact same setup is also available as an acceptance environment.

Whenever I need to update the acceptence environment, I make a snapshot of the production server, restore that to the acceptance server and run a script that adjusts a coupld of things such as WordPress URL’s, hostname of the server and other non-worpress related things. It’s basically an exact copy of the production environment and afterwards some configuration settings are changed. This makes sure you have the most optimal situation to test software deployments, before actually deploying to production servers.

The WordPress sites on the acceptance environments are also managed by MainWP, however, if I clone the production environment the way I described above, the WordPress sites will be in a disconnected state after the clone. When I press the reconnect button, the following message appears:

Public key already set. Please deactivate & reactivate the MainWP Child plugin and try again.

Are there options available to allow me to clone a production environment to an acceptance environment (as described above) without losing that connection? Perhaps saving and restoring some data first using wp-cli or something of the sort? Or perhaps other ways?

I was thinking that I could deactivate the plugins on the acceptance environment using wp-cli, and then reconnect them on the server that has the WP install with the MainWP dashboard. Is it possible to reconnect a site using wp-cli? Because then I could automate the whole proces, which is my end-goal.

Hi Ronnerd, to reconnect sites via WP Cli command you can use:

wp mainwp reconnect 2,5

where 2 and 5 are site IDs.

1 Like

Hi Bogdan,

Then I can simply deactivate the MainWP child plugin using WP-CLI, after the clone and then use WP-CLI on the MainWP dashboard install to reconnect. Should work. Thanks!

Works like a charm, thanks!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.