How do you Backup your site?


#1

Hi,

I’m just curious how you’re backing up your Kirby sites.
Are you using backup solutions from your hosting provider or do you use additional software?
What are your recommendations?

Florian


#2

I build my sites with source control and work locally and push to private repositories on Bitbucket before pushing to live. If it it’s a site that a client is able to edit, I pull down from the server using rSync.

Theres a number of ways to back up. If you literally just want to take a carbon copy of the live site occasionally, rSync is the way to go. You can of course do it with SFTP, but it is many times slower than rSync.

With the help of this plugin you can also push directly from the server to a Git repository.

Lastly, you can also sync the site to Dropbox, but remember that works in both directions!


#3

That’s good to know :slight_smile: I use bit bucket and Dropbox for all sites where the client is not able to edit. But I definitely have to check out rSync.


#4

I wrote a bash script for it, allowing the pulling down of content from live to local, and pushing up to a staging server and a liver server. It will also do a dry run so you can see what will be changed without actually doing it. You can also exclude certain files and folders with it.

You can fire it off with these lines in your package.json. Saves memorising that epic command…

    "deploy:live:sim": "./deploy live",
    "deploy:live": "./deploy live go",
    "deploy:staging:sim": "./deploy staging",
    "deploy:staging": "./deploy staging go",
    "content:sync:sim": "./deploy sync",
    "content:sync": "./deploy sync go",

Keep in mind that rSync is brutal in that it just does it. If your local copy is under source control, you should be fine but rSync will just over right files or delete them so that both sides match identically. Personally I only pull from the content folder from the live server.


#5

cheers for these tips :slight_smile:


#6

If you want to control what changes have been made and have an option to undo those changes as well, I’d use a Git plugin (I have no experience with AutoGit, but have used gcapc.

This is also what I’d use if changes are not only made remotely.


#7

@texnixe I just gave gcapc a try and decided I will use it on a new site! Thanks for the suggestion :slight_smile:


#8

@flokuek When using Git on the server, make sure that the .git folder is not publicly accessible (that should be standard on a good server, but is often not the case, so better check and prohibit access via .htaccess or your server configuration).


#9

Yep, that’s what I did.


#10

For the content sync demand how would I determine the USER and IP address?


#11

Its the IP address of your web server and the user is the same as you use for SSH of SFTP. You don’t have to use the IP, you can actually use the domain name too, but stick to one or the other. Your computer will treat them as unique connections and you will end up with unnecessary SSH keys stored on your machine…

You can get the full path to your content by logging into your server with SSH, navigating to the content folder of your site and then type the command pwd - it will print the full path to your current location.