work around nasty characters as part of the database password
This commit is contained in:
parent
c313b6fdb1
commit
b272acf292
2 changed files with 6 additions and 6 deletions
|
|
@ -9,8 +9,6 @@
|
|||
"TIME_FORMAT": "utcnow:%Y-%m-%d_%H:%M:%S",
|
||||
"REPO_SUBDIR": "forgejo",
|
||||
"MYSQL_DB": "database name",
|
||||
"MYSQL_USER": "database user required for dumping the database",
|
||||
"MYSQL_PASSWORD": "password required for dumping the database "
|
||||
},
|
||||
"remotes": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,11 +55,13 @@ class ForgejoManager(backup_manager.BackupManager):
|
|||
return True
|
||||
|
||||
def dump_database(self):
|
||||
password = self._common["MYSQL_PASSWORD"]
|
||||
user = self._common["MYSQL_USER"]
|
||||
db = self._common["MYSQL_DB"]
|
||||
|
||||
cmd = f"docker compose exec -i --user 1000:1000 db mariadb-dump --single-transaction --default-character-set=utf8mb4 -h localhost -u {user} --password={password} {db} > mysql/forgejo.sql"
|
||||
# we assume that a [client] conf as default for user and password is mounted inside the mysql directory of the container
|
||||
# e.g.:
|
||||
# [client]
|
||||
# user=<theusername>
|
||||
# password=<thepassword>
|
||||
cmd = f"docker compose exec -it db sh -c 'mariadb-dump --defaults-extra-file=/var/lib/mysql/forgejo-mysql.conf {db} > /var/lib/mysql/forgejo.sql'"
|
||||
try:
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
|
|
|
|||
Loading…
Reference in a new issue