• This seems to be something that many people would like to do but it all seems very difficult to set up in an efficient manner.*

    * Note that this is for a wordpress install that does not do any dynamic updating of the live system – no blog comments etc -that would make things very different)

    I’ve got “WP Multi Network” working on my WP Dev’s iMac (see https://ww.wp.xz.cn/support/topic/cannot-get-it-to-work-on-localhost/ for some info on that).

    I’ve set up so she can double click on a shell script (batch file) on the desktop, that quickly rsync’s the wordpress directory via SSH so the production server has the same directories and files as the dev machine (efficient as rsync just copies the changes, not the entire file system)

    The only thing left to do now is replicating the mySQL database up to the production server.

    This would be fairly simple (I think) as mySQL supports replication, where the slave (production server) reads the binary log file stored on the master (dev server) and simply plays back the changes made to the dev database, command by command, and does the same to the live DB.

    The catch is, the domain names in the wordpress DB files on the dev machine are different than what they need to be for the production machine. I’ve never looked at the structure of the wordpress DB’s so have no idea how difficult this will be to change on the fly.

    Ideally, a “Go live” wordpress plugin that had mappings for “dev system domain name” to “production system domain name”, that tracked the last time the DB was modified and made all the required changes to the live DB file, and rsync’d the directory structures afterward would be the way to go.

    Is this do-able, or am I just banging my head against a brick wall?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I doubt that an on the fly translation of database snapshots is viable, the domain name is inserted in lots of entries, some of which are serialised (encoded with field length).

    What I think would be possible is to have both the live and development websites using the same domain name. You could selectively comment / un-comment an entry in the “hosts” file to switch the browser on the localhost machine between accessing the live and local website.
    OR instead access the live website using he hosting domain name for accessing FTP and phpmyadmin and have the hosts file map the domain name to localhost always. Of course you would also check the live site from a different computer.

    So I think you should be using the “moving wordpress” procedures, or use the plugin DUPLICATOR and configure your localhost site to use the same domain name as live. This way the WordPress files and database will barely know when they are moved. The only difference will be things like that the localhost instance cannot send emails by SMTP and similar.

    Thread Starter lmnop

    (@lmnop)

    Right. Thanks for that. I’m a bit aghast that WordPress spreads the site’s hostname all through the DB. That should be located in one place only, then referenced from elsewhere!

    The catch with updating the localhost file is OSX pretty much ignores it, which you have to overcome by running dnsmasq.

    But from what you’ve said, running a duplicate host structure sounds like it’s the only way to do this that doesn’t involve copious quantities of arseing around, thanks to the DB structure.

    My dev will have to remember that her machine is always referencing her local version of wordpress and she’ll have to get on a different machine to access the production system.

    Thanks for your input.

    I’ll set it up so that a script does a SQL replication and then rsync’s the file system changes.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Syncing/mirroring/replicating local dev version to live server’ is closed to new replies.