Comments (18)
Hi! Thanks for reporting this. Here's a workaround for you: assuming that you haven't created any users or set privileges and passwords in your MySQL database manually (you shouldn't), you can add this bit to your Tutor configuration, then after tutor config save
run a fresh backup and restore.
BACKUP_MYSQL_DATABASES:
- openedx
(Add other databases except mysql
to this list if you are running any plugins that create another database, such as tutor-contrib-webhook-receiver
.)
This way, the mysql
database is not included in the backup, and consequently, no attempt is made to overwrite it on restore.
We should probably make this the default, now that people are moving to Palm and with it, to MySQL 8. Any MySQL user accounts and privileges are managed by init
jobs in Tutor anyway, so the mysql
database shouldn't really contain anything that's necessary to restore.
Please let us know if this workaround gets you moving again. Thanks!
from tutor-contrib-backup.
@dagg Yes please, do send a PR for that! I have a couple of questions/suggestions on your approach, but those are best discussed in a PR thread. Thanks for looking into this!
from tutor-contrib-backup.
That worked like a charm !!!!
Thanks for the quick support !
from tutor-contrib-backup.
Good to know, but let's not close this just yet — like I said, what I recommended you do was a workaround, not a fix. :)
from tutor-contrib-backup.
hmm, maybe I was too fast confirming.
I don't know if this is expected but after I restored the backup on a different openedx instance, I see that the courses are there but I lost some settings like the 'indigo' theme, the OAuth configuration I had configured.
Is this expected?
from tutor-contrib-backup.
@mrtmm What do you think, should we make [openedx]
the default for BACKUP_MYSQL_DATABASES
?
- We shouldn't need to back up the
mysql
database, for reasons discussed above. - If people are running on AWS RDS/Aurora, we know that including the
mysql
already broke things for MySQL 5.7, so anyone using that would have needed to excludemysql
fromBACKUP_MYSQL_DATABASES
for a while (see #44).
So, it probably makes more sense to default to backing up just the openedx
database.
The only situation in which this is problematic is if people are running with databases other than openedx
that they do want backed up. If they rely on the current default behavior of mysqldump --all-databases
, and forget to subsequently set BACKUP_MYSQL_DATABASES
to a list that includes all the databases they want backed up, they'd lose some backup data that they are presumably interested in.
from tutor-contrib-backup.
@mariovitale1979 OAuth settings are in the openedx
database, so they would be included in the backup. However, they are keyed to the site configuration so if you restore your database to a different Open edX instance than where you backed it up (with a different site name, presumably), then it would be expected that you "lose" them. (Which is reasonable, because your OAuth callbacks wouldn't work anyway.) In other words, that's a wholly different issue compared to what you initially reported — and it does sound like the behaviour you describe is by design.
from tutor-contrib-backup.
ok, makes sense. Thanks for clarifying. So the plugin's purpose is mainly made for backup/restoring of 1 openedx instance. Not for transferring everything to a different instance.
from tutor-contrib-backup.
You can totally transfer everything to an exactly identically configured instance, as you would if you ran a production Open edX instance in one location and another, non-production one that's running in a different location, so that you can cut over from one instance to the other by, say, a DNS update (or by transferring the IP address behind your DNS name, using a dynamic routing protocol). You can even automate this via scheduled backup and restore; see the README for details.
But backing up one database and trying to drop it into a completely different site is something you can't expect to work, without additional modifications, in any Django application. That's not a limitation of Open edX specifically, nor of Tutor, and certainly not of this plugin.
from tutor-contrib-backup.
@mrtmm What do you think, should we make [openedx] the default for BACKUP_MYSQL_DATABASES?
Or maybe, since we know not having it defined can be problematic in various cases, we can make it a required setting? So anyone who is not using it yet will get a message to set it? So there is no risk of someone silently losing some data from their backups.
from tutor-contrib-backup.
Hmmm at the risk of asking a very silly question, how does one do that, in a way that doesn't break Tutor's expectations? The way I read the cookiecutter, I think we can
- set a variable with a default (even if that default is
None
/null
, the empty string, an empty list, etc.), - set a variable with a "unique" value, such as a generated password,
- set an override for an existing Tutor configuration value.
But setting a variable with no default that the user must set (that is, a "required" setting) — is that a thing that a plugin is "allowed" (expected) to do?
from tutor-contrib-backup.
Okay, I was thinking of the "unique" option (previously named "add") and when doing something like:
config = {
"unique": {
"MYSQL_DATABASES": "{{ MYSQL_DATABASES }}",
},
"defaults": {
...
}
the setting requires itself basically, if you don't have BACKUP_MYSQL_DATABASES
defined, when running tutor config save
you should see an error like: "Error: Missing configuration value: 'MYSQL_DATABASES' is undefined"
But setting a variable with no default that the user must set (that is, a "required" setting) — is that a thing that a plugin is "allowed" (expected) to do?
Well that I am not sure about, it was my interpretation that the "unique" option was suitable for this but now that I read the cookiecutter example again I see that it suggests that a default value should be set.
So on second thought, I believe "unique" would still be the right place for this setting because I believe the "settings that don't have a reasonable default for all users" bit applies here; who's also running ecommerce or plugins with a database, we don't know. In addition in that case the setting will be added to config.yml
so folks who haven't defined it yet should notice it. But what should be the default value either the empty list or openedx
only I am still conflicted but I would trust your judgement on that.
from tutor-contrib-backup.
There is another option that we have here, which is to retain the default for BACKUP_MYSQL_DATABASES
being []
, but modify the plugin's behavior in that case.
Right, now, we do this:
What we could also do is that rather than set --all-databases
, we enumerate the databases first, then exclude mysql
from that enumeration, and then back up all others. That way we'd catch notes
, ecommerce
, etc. if someone runs those.
If we did that, and
- someone has already set
BACKUP_MYSQL_DATABASES
, the plugin already does (and continues to) backup the databases the user wants. - someone hasn't set
BACKUP_MYSQL_DATABASES
and manages their all their database users, passwords, and privileges with Tutor (as they should), then the backup includes all databases that matter. - someone hasn't set
BACKUP_MYSQL_DATABASES
and they manually created or set users, privileges, or passwords, they would be in trouble. But they probably are anyway, because in a Tutor environment you really aren't supposed to do that.
from tutor-contrib-backup.
What we could also do is that rather than set --all-databases, we enumerate the databases first, then exclude mysql from that enumeration, and then back up all others. That way we'd catch notes, ecommerce, etc. if someone runs those.
That sounds quite reasonable to me :)
from tutor-contrib-backup.
Hi! Thanks for reporting this. Here's a workaround for you: assuming that you haven't created any users or set privileges and passwords in your MySQL database manually (you shouldn't), you can add this bit to your Tutor configuration, then after
tutor config save
run a fresh backup and restore.BACKUP_MYSQL_DATABASES: - openedx(Add other databases except
mysql
to this list if you are running any plugins that create another database, such astutor-contrib-webhook-receiver
.)This way, the
mysql
database is not included in the backup, and consequently, no attempt is made to overwrite it on restore.We should probably make this the default, now that people are moving to Palm and with it, to MySQL 8. Any MySQL user accounts and privileges are managed by
init
jobs in Tutor anyway, so themysql
database shouldn't really contain anything that's necessary to restore.Please let us know if this workaround gets you moving again. Thanks!
Where do we actually set this BACKUP_MYSQL_DATABASES conf? In config.yml that is located in the root of tutor folder?
from tutor-contrib-backup.
Yes, and in addition you have to add the backup
plugin to the PLUGINS
list.
from tutor-contrib-backup.
Hello @fghaas , and everyone else, I had the same problem with the 'mysql' schema when trying to restore.
I saw the whole conversation here and there are some very interesting solutions.
I have one suggestion though which I have implemented in a fork:
Get a list of all database schemas except from 'mysql' (and 'sys', 'performance_schema' and 'information_schema', I think those aren't needed as well but I might be wrong), and use that list of databases instead of all.
So, instead of '--all-databases' use '--databases {databases_list}'...
My changes in the code are here (just one line):
And here:
Maybe they can be proven useful.
I didn't create a PR for it but if you want me to, just let me know.
~ ~ ~
Something else I would like to propose is the possibility to create the backup files/folders (before compressing them into the .tar.xz file) inside the /data/backup folder which is mounted and visible outside the container, instead of the /data folder which only exists inside the container.
My problem is that our implementation has a disk space problem with our huge data (about 90G for MySQL and MongoDB).
I think if I mount the $(tutor config printroot)/env/backup/ folder to another drive (or a network drive), this would solve our disk space problem while backing up the databases... Since I'm quite novice with docker, I cannot be sure if that will work, and also I cannot manage to make my changes to the backup above to work yet, but I'd love to know your thoughts on these suggestions.
from tutor-contrib-backup.
Thank you @fghaas the PR has been created!
from tutor-contrib-backup.
Related Issues (9)
- I created two new Github Actions for this plugin
- Cannot use plugin when MySQL is not managed by Tutor HOT 1
- Need to list minimum required tutor version HOT 1
- No disk space in K8s HOT 25
- Issues backing up `--all-databases` HOT 3
- Dump only this instance mongo databases HOT 6
- Restore job killed in K8s HOT 4
- Backup fails in RDS with MySQL 8 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tutor-contrib-backup.