Tms backup

From Sit

(Redirected from Tms backup plugin)
Jump to: navigation, search
Tms backup
Sit-tms backup menu.png
Current version v2.15
Maintainer Carsten Jensen
Download Download Download
Release status stable
This plugin is stable and ready for use on your production system.


Contents

tms_backup plugin

The plugin makes a backup of your sit database and webfolder.

Installation

  • Download the latest tms_backup plugin from here.
  • extract the file to your plugins directory eg /var/www/plugins
  • make SiT aware of the plugin, go to : SiT | Control Panel | Configuration
    • Locate Load Plugins in the bottom of the screen, and add tms_backup to the comma separated list.
  • go to the setup page of the plugin inside SiT : SiT | Control Panel | Configuration | Plugins -> tms_backup
  • Configure the settings
    • MySQLdump : full path of the location of the mysqldump application e.g. /usr/local/bin or C:\mysql\bin
    • Output Location : Destination directory of where the backups should be put.
    • Backup webfiles : yes = take a full backup of the SiT webdir. No leaves the web alone. regardless of the choice here, the SQl server will still have a backup.
    • Compression : Choose a compression util, choose between tar (native for Linux/Unix) 7z Full 7zip 7za commandline 7zip, and none none will copy the webfolder
    • Full path of the compression util : set this directory to point to the location of your compression util. If you choose none as compression, you'll need to supply the path to where the cp or xcopy are located.
    • Keep backup : the amount of backups stored on the harddrive (the rest will be deleted if tms_backup_purge is enabled in the scheduler.
    • Autodetection for mysqldump, and archive applications (for *nix OS'es only)
      • In order to autodetect the archive application you need to save the settings, refresh the page (i.e. click on the tms_backup in the plugins config menu) and save again.

Go to the SiT Scheduler and configure the tms_backup and tms_backup_purge to suit your needs. Recommended is to have tms_backup_purge run after the backup is run, i.e. 30 minutes after.

Usage

Configure the Scheduler

  • Set up a scheduled job in the scheduler : SiT | Control Panel | Scheduler
  • click on tms_backup.
    • set Interval to minimum 86400 (which is every 24 hours, or if you set timestamp to yes to a minimum of 120 seconds)
    • enable the job
    • set a time to run preferable around midnight.
  • recommended is that you make a test run before setting it into production.
  • repeat the above mentioned steps for tms_backup_purge, but schedule it later than the backup i.e. 30 min later.

Automatic

The backup runs automatically when auto.php has been configured in a cron job, this should be set for SiT in general. You can review the backup files in your chosen backup folder path.

The purge util keeps the newest backups, and deletes the old ones, if somehow the file(s) is not deleted, but they are removed from the page of listed backups, the file will never be touched by the purge program again, that means, that it doesn't mindlessly delete things from the backup folder, so take a look there from time to time and see if old backups haven't been deleted properly.

The purge util keeps the last 14 backups as default, but can be configured in the config page of the plugin (Keep backups), this includes manual backups as well.

You can configure triggers for success and failed backups, see system triggers

New features for v2.0

  • Backup page that shows x last backups (configurable in the plugin configuration page).
    • Backup now : now you have the feature of making a manual backup, by clicking on the Backup Now button
    • Scheduler : You have a quick access to the scheduler from this page too
  • Triggers added for success and failed backups
Sit-tms backup menu.png


Dashlet

Dashboard tms backup.png

I've added a simple dashlet that displays when the last backup was made.

The dashlet only shows scheduled backups, not manual backups

If the backup fails, the scheduled job will be disabled.

You can click on the title to go to the backup menu page (which will be released soon).

Restore

An easy way to restore is in development.

In the meantime I'll help you out here with a manual procedure.

  • Web files - Just unpack the archive (e.g. 2010-03-10-sit-web.tar.gz) and copy all the files on top of the old installation, overwrite all files
  • MySQL Database
    • Get shell/command prompt access
       <path to>/mysql -u <sit db user> -p < yyyy-mm-dd-sit.sql (where yyyy = year, mm = month, dd = day) 
    • Example :
       c:\mysql\bin\mysql -u sit -p < 2010-03-10-sit.sql 
      You'll be prompted for the password of the sit database user, but you won't be asked for confirmation.

That's it, backup restored.

If you are migrating to another server, you'll have to create the sit database user.

mysql -u root -p
CREATE USER 'sit'@'localhost' IDENTIFIED BY 'sitpassword';
GRANT ALL PRIVILEGES ON sit.* TO 'sit'@'localhost';

FAQ

  • Q: I don't see my backed up database, but there is a backup of my web
    • A: Check to see if your path to mysqldump is correct
  • Q: There is no output after a run, I'm not backing up my webfolder
    • A: Check to see if your path to mysqldump is correct
  • Q: After the scheduled job has run, tms_backup is deactivated
    • A: Check to see if your path to mysqldump is correct
  • Q: How do I check if my settings are correct ?
    • A: Enable debugger in the control panel, and create a log file to put debugging logs inside. Run a job, and search for the keyword tms_backup there are several different which will tell you some details.
  • Q: Whats with the TMS, why not just call it Backup ?
    • A: I didn't want to conflict with the possibility of new function the core SiT developer team perhaps would introduce in the future, I kept my naming with a prefix of my nickname (Tomse), thus separating the core team's quality code from my own novice programming.
  • Q: Why need this plugin ? I just backup the MySQL folder
    • A: The thing with a SQL dump is that it makes sure that any transactions are finished. Also you might not recover from the files you have. The dump ensures you to be able to insert all the data into a new SQL server.
  • Q: Why is most/all of the text blank ?
    • A: The plugin comes with en-GB and en-US language, if your SiT! installation's default language is different, you'll need to either translate it or copy it to keep the english language. Simply copy <mysit>/plugins/tms_backup/i18n/en-GB.inc.php to <mysit>/plugins/tms_backup/i18n/xx-XX.inc.php that matches your language, and edit the file (or leave it as is).

More Info

You have 2 choices of namegiving the backup files

  • yyyy-mm-dd
    • The backup only supports 1 backup a day.
    • Each backup will override the former if it has the same name, which means if there are more than 1 backup on the same day, it will overwrite the previous
  • yyy-mm-dd-hh-ss
    • This backup will also timestamp the backup file
    • Each backup will override the former if it has the same name, which means if there are more than 1 backup within the same minute, it will overwrite the previous

Older SiT versions

If you use older versions of SiT 3.40 - 3.51

SiT version equal to and below 3.51 doesn't have the ability to configure plugins using the configure page in the control panel, so you need to add the 5 lines below into the SiT config.inc.php file which is located in the root of the webfolder, just add them to the bottom of the file


  • $CONFIG['tms_backup_webbackup'] = 'no'; // choices : yes/no
  • $CONFIG['tms_backup_compress'] = 'tar'; // choices : tar/7z/7za/none
  • $CONFIG['tms_backup_compressloc'] = '/usr/bin';
  • $CONFIG['tms_backup_outputloc'] = '/home/backup';
  • $CONFIG['tms_backup_mysqldump'] = '/usr/local/bin';
  • $CONFIG['tms_backup_timestamp'] = 'no'; // choices : yes/no
  • add the plugin into the {database prefix}_scheduler in the Database, use any MySQL console to add the following data

(above version 3.51 this is done automatically when you save the tms_backup config page in the control panel)

INSERT INTO `{prefix}_scheduler` (`id`, `action`, `params`, `paramslabel`, `description`, `status`, `start`, `end`, `type`, `interval`, 
`date_type`, `date_offset`, `date_time`, `laststarted`, `lastran`, `success`)
VALUES ('', 'tms_backup', '', NULL, 'SiT Backup', 'disabled', '2010-01-01 23:00:00', '0000-00-00 00:00:00', 'interval', '86400', 'month', '0', NULL, NULL, NULL, '1');

check your prefix, i.e. sit_ and replace it in the code above, in this example {prefix}_scheduler should be named sit_scheduler, in other words the table name that is scheduler should be named the same in the sql code you insert.

  • phpmyadmin : login with your sit account (if root, select the sit database first), find the tab in the top that says SQL. Remove the existing text in the text field, and paste the code above, with your edit, into the field, and click GO.
  • mysql : from the shell or command prompt. Run the command below and replace situser with your database username. After hitting enter, type the password of the situser.
    • mysql -u situser -p
  • adjust the code above to fit your system, and paste it into the console (remember to hit enter).

Disclaimer

It is up to you to verify the data backed up. I can't be held responsible if you lose data.

Last words

This plugin is a work in progress, but is fully functional for making a scheduled backup.

If you have any questions, feedback, suggestions, feel free to make a post in the forum.

  • Be aware that the backups will accumulate each day, and fill up diskspace unless you clean out from time to time (activate the tms_backup_purge in the scheduler to automatic handle this).
  • The plugin's purpose is to prepare the sql-data/web files to be transferred to another computer or put for backup on tapes, or at least store data for human induced error, like deletion etc.

Known Bugs/Issues

  • If your webfolder is very large, and you archive it, the backup job might run multiple times due to a possible bug in the scheduler, make note of this when using the purge function.

Version Matrix

Lists a table where versions separate due to either restructuring or new functions.

  • XX = Working
  • -- = Not working
  • -X = Some work is needed, read this page for further info
SiT v3.40+ SiT v3.52+ SiT v3.63+ SiT v3.90+
TMS_Backup <v2.01 -X XX XX --
TMS_Backup >v2.10 -- -- XX --
TMS_Backup >v3.00 -- -- -- XX
Personal tools
project