Automatic Backup OJS3

Description of issue or problem I’m having:
We are looking for a recommended method for generating automatic and backups for a production environment. Our server has 160GB of files and a 22GB database.
It currently updates the file copy and a database dump which usually takes some time in a defined routine at night. We believe that this is not the best process as there could be a difference between the time of copying files and copying the database.

Would there be any method of putting the System on read-only?
Should we suspend web access to generate the backup?

Steps I took leading up to the issue:
Dump database and file copy at scheduled times.

What I tried to resolve the issue:
We follow the guidelines of:
https://docs.pkp.sfu.ca/faq/en/site-administration#how-can-i-create-a-backup-of-my-site

Application Version: OJS versão 3.3.0-8

Additional information, such as screenshots and error log messages if applicable:

Thanks a lot and all best,
Luciano

1 Like

Hello Luciano

It is interesting to read up on your case. If you need to protect the database on the process of MysqlDump you can use the lock tables by using this query :

FLUSH TABLES WITH READ LOCK;

After the dump is finished you can release the lock by this query :

UNLOCK TABLES;

However, since our team never think about this case it made us never test this on our real OJS client installation.

Thank
OJT team

2 Likes

Hi @luciano,

There is a github issue filed to add a maintenance mode to OJS:

However, I don’t recommend something like this for a regular backup process as a multi-GB backup can take a long time, and having the website regularly in maintenance or read-only mode is annoying for users if their working time zone corresponds to your maintenance window.

I would recommend leaving the site live, and backing up first the database, then the files directory. The contents of the files directory are generally added to (e.g. new uploads) and almost never modified. If the database is backed up first and e.g. an author submits a new submission between the two processes, then the database will be consistent and the files directory will contain an extra file or two that is not referred to by the database; you will be able to restore from this backup without problems.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi @navotera ,

I will do this in the dump process you have. Thank you for the tip.

Best regards,

Luciano

Hi @asmecher,

As soon as possible, we will test this maintenance mode.

Let’s also adapt this suggested backup mode.

How is the process for generating the names of the files that will be stored? Do you have a link on this subject?

Very grateful for the tips.

Hi @luciano,

Filenames are generated differently depending on your version of OJS:

The upgrade scripts take care of renaming files when crossing one of these version thresholds.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

This topic was automatically closed after 12 days. New replies are no longer allowed.