Web development: Synchronising a web server and a localhost server?

giggity

Expert Member
Joined
Feb 19, 2011
Messages
1,209
Reaction score
135
Location
Pretoria
Good day

Here's my situation:

I have a hosted shared web server with Elitehost on which I host a Wordpress site. Whenever I want to change the site's code, I have to use a plug-in called All-in-one WP Migration to do the following:
  1. Download a complete backup of the site
  2. Load that backup onto my localhost wordpress
  3. Edit the files
  4. Do a backup of the localhost wordpress
  5. Upload localhost backup to the server and restore it.
It's embarrassing, and it's not a fun, nor a fast task. I also cannot edit the files directly on the server as I use gulp tasks to convert sass and javascript.

Does anyone know of any software which allows one to sync files and MySQL databases (basically clone a server) on demand from server to server without having to download the entire site? Preferably open source and free?

Cheers and thank you
 
All-in-one WP Migration is a great tool!

You should be able to use the advanced options and only sync the theme and database.
That should cut down the file size to a couple MB ...

Else use something like git on your side to track which files you've changed and only ftp/upload the necessary ones?
 
You could use phpStorm and setup your project with automatic ftp upload when you change files, so it would keep the files in sync but the database you would have to do a bit manual
 
Depending on the size of the website. You can use git/github to push and pull changes between remote and local servers. So, we were code locally then push this to the github repository then on the live server we've run a cron job / script to pull the changes or sync up to date.

This won't solve the problem for your database and usually wordpress is too big to fit into a github repository.

You can use things like batch/bash scripts to do this too.... An easy enough to achieve solution would be a script that:

=> Zips your local directory with the website files
=> Dumps the database to .sql file
=> SSH to remote server
=> Unzip and rsync local copy with remote copy of website files
=> Import local .sql file to the remote database
 
Top
Sign up to the MyBroadband newsletter
X