jdabtieu/CTFOJ

[FEATURE] Better Backups

Closed this issue · 3 comments

Is your feature request related to a problem? Please describe.

Since the backups code was last updated, we've added a lot to CTFOJ and many more things need backing up, not just the database. Examples of such additional things to back up are:

  • metadata folder (problem statements, announcements, contests, editorials)
  • dl folder (problem downloads)*
  • temaplates/unauth_index.html (homepage for not-logged-in users)

The database (already backed up) stores things like:

  • users & their settings
  • list of problems, contests, and announcements (but not their contents)
  • submissions
  • rankings for contests

Describe the solution you'd like

Ideally, backing up these folders and files should also be built into daily_tasks.py, instead of only backing up the database.

Also, we should aim to keep this backup process light, since larger installs (e.g. the size of DMOJ) might take hours to backup every time the backup is run due to the sheer amount of problems and contests. Perhaps this could be made weekly since problem/contest data doesn't change frequently?

* the dl folder doesn't actually need to be backed up because once a file is uploaded, it can't be modified by the app anymore. The only way to modify those files is to obtain access to the local files directly, and at that point a malicious actor could change the backups as well

pretty sure only the database and metadata folder can be corrupted programmatically

anything else being lost would mean a) that a hacker has access to the machine itself, in which case a local backup is meaningless, b) hardware failure, in which case a local backup is also meaningless, or c) user error, which is regrettable but not something we should be backing up to prevent