Loading...
 

History: TRIM and Syncthing for automated offsite backups

Preview of version: 7

Use case: I have a Tiki on ClearOS. and I want automatic backups of that Tiki to my local computer for safekeeping. These are high level instructions as to how to combine TRIM and Syncthing to do so.

Setup TRIM

Requirements

Installation

svn co https://svn.code.sf.net/p/tikiwiki/code/trim

Configure TRIM to backup your Tiki site

In this example, we will add an instance named ii. notresuite.com. TRIM and TIKI are in the same server. Pay attention where to input 127.0.0.1.

[root@trimclient trim]# make instance php -d memory_limit=256M scripts/addinstance.php Default editor used (nano). You can change the EDITOR environment variable. Default diff used (diff). You can change the DIFF environment variable. Connection type [ssh|ftp] : ssh Host name : 127.0.0.1 Port number : [22] User : root Instance name : [127.0.0.1] ii.notresuite.com Contact email : your@email.com Instance information saved. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system. Testing connection... After successfully entering your password, were you asked for a password again? [yes|no] no Detecting remote configuration. You are running on a ClearOS Web root : [/var/www/virtual/127.0.0.1/] /var/www/virtual/ii.notresuite.com Web URL : [http://127.0.0.1] http://ii.notresuite.com/ Working directory : [/tmp/trim_temp] Instance information saved. PHP Notice: Undefined offset: 1 in /root/trim/src/rclib.php on line 70 Detected SVN : branches/15.x [root@trimclient trim]#


You can backup as always.

[root@trimclient trim]# make backup bash scripts/backup.sh php -d memory_limit=256M php which: no cpulimit in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) dont use cpulimit Default editor used (nano). You can change the EDITOR environment variable. Default diff used (diff). You can change the DIFF environment variable. Note: Backups are only available on SSH instances. Which instances do you want to backup? [1] 127.0.0.1 m@com [2] vv.notresuite.com m@.com [3] ii.notresuite.com your@email.com >>> 3 Performing backup for ii.notresuite.com Downloading files locally. RSYNC Return var: 0 Obtaining database dump. Creating archive. Return var: 0 [root@trimclient trim]#

Set up automatic backups

Of all the instances

https://doc.tiki.org/TRIM#To_setup_automated_backups

For just one of the instances

We will use the PIPE from the Linux bash in order to inject the desired number. In this case, it is the number 3.

[root@trimclient trim]# echo 3 | make backup bash scripts/backup.sh php -d memory_limit=256M php which: no cpulimit in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) dont use cpulimit Default editor used (nano). You can change the EDITOR environment variable. Default diff used (diff). You can change the DIFF environment variable. Note: Backups are only available on SSH instances. Which instances do you want to backup? [1] 127.0.0.1 m@com [2] vv.notresuite.com m@.com [3] ii.notresuite.com your@email.com Performing backup for ii.notresuite.com Downloading files locally. RSYNC Return var: 0 Obtaining database dump. Creating archive. Return var: 0

As you see, no human interaction was needed.
You may want to install this in a cronjob, to do it every day at noon, do the following.

echo '0 0 * * * pushd /root/trim/ && echo 3 | make backup && popd' > /etc/cron.d/trim-ii.notresuite.com-backup


Install Syncthing

On the server

On your laptop

Setup Syncthing


The TRIM folder to backup is /root/trim/backup/archive

Make sure Syncthing automatically restarts when you reboot so that you have unattended automatic backups.

History

Advanced
Information Version
Marc Laporte 54
View
Marc Laporte 53
View
Marc Laporte 52
View
Marc Laporte 51
View
Marc Laporte 48 - 50
View
Marc Laporte 47
View
Marc Laporte 42 - 46
View
Marc Laporte 41
View
Marc Laporte 28 - 40
View
Marc Laporte 25 - 27
View
Marc Laporte cleaning up 23 - 24
View
Marc Laporte 21 - 22
View
Marc Laporte 20
View
Marc Laporte 18 - 19
View
Marc Laporte 17
View
Marc Laporte 14 - 16
View
Marc Laporte Better domain name 13
View
Marc Laporte 12
View
Marc Laporte 11
View
Marc Laporte 10
View
Marc Laporte Code Plugin modified by editor. 7 - 9
View
luis.lucio 5 - 6
View
  • «
  • 1 (current)
  • 2