Forum

Thread tagged as: Installation, Configuration, Hosting

Local vs Live

So I have my website with my host provider. I installed perch in the root folder, linked to a mysql database I created on the host. Tested everything works.

Then I created a local server on my Windows 10 using XAMPP. I added my local website to the htdocs. When setting up XAMPP and Perch I also created a local mysql database.

My question is simple. How to I now upload my website and the Perch local changes to effect my hosting provider ?

I could just upload the Perch folder with my website changes which seems to me would change the templates and such, however am I overwriting other Perch account features that may differ from my local setup ?

And what about the two mysql database's ? Do I need to syncronize them somehow ?

Thanks for any input on how this is done and workflow....

Gary Heydon

Gary Heydon 0 points

  • 3 years ago

Hi Gary,

I am sure there are much smarter ways to do this but this is what I do as a complete novice. You are correct in that you have to keep track of the files for the site AND the database data. This is a key piece of knowledge and understanding how to deal with each portion is the key to keeping the sites in sync.

For the files (web page files, css, perch templates, layouts, etc) I use git to track what has changed. I am sure smart people can then synchronize git with the live site but I am not that clever. I use git to tell me what files have changed and then manually upload the changed ones. Once set up, it isn't as tedious as it sounds. Also not being so clever, I use a piece of software called Tower (I think recommended by Rachel somewhere) for git. It is a nice graphic interface for git and allows me to visually see what has changed and needs to be uploaded.

For the mysql database, these also need to by synced. This can be confusing and you need to be very careful (from bad experience). The "master" data for me will often shift from the live server to the local and back. What I mean by this, is that sometimes I will set things up locally and then sync those changes with the live server database. Sometimes I make changes to the live server through the back end and then have to sync those changes with the local. My site is small and I am the only one that works on it so it is easy to track this way. For database management I use another graphic interface called Navicat. With Navicat I can use the data synchronization tools to see what has changed and then it will make changes to the live server or the local server as I instruct it to. Otherwise you can do a "manual" mysql backup and restore through whatever tool you want (phpmyadmin, etc).

Everybody's workflow I imagine is different and this is what I have settled on so far as a "tinkerer" or someone who doesn't do this for a living. I hope it helps.

Thanks, that was very informative and helpful. One followup question.

I have the main website project files in the root folder. I see where it is highly recommended to place the Perch Folder in the root also. My logic tells me though that I should create a subfolder and put a seperate website project that I would load up anytime I am going to edit the "editable" Perch pages.

If I where to put my "second" website basically in a subfolder and then add the Perch main folder in that would that mess up the file structure linking for the runtime etc ? It just seems easier to keep edited pages away from my main design folder. If I need to add a edit page I will just load up my other project folder.

Don't develop the second site in a sub-folder. Keep it separate to the first site. You would then have two sites defined in your XAMPP set-up.

Here's a post that may be useful https://allinthehead.com/retro/352/stop-building-sites-in-subfolders