Hastexo / tutor-contrib-backup

Hi @foadlind
can you help me please?

First question: I used the backup plugin and successfully installed and enabled it, but when I restore, it displays this message :

⚠️  You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)
docker compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm backup-job sh -e -c 'python restore_services.py --date=2023-12-04 --exclude=caddy'
[+] Creating 4/0
 ✔ Container tutor_local-caddy-1        Running                                                                                                                               0.0s
 ✔ Container tutor_local-mysql-1        Running                                                                                                                               0.0s
 ✔ Container tutor_local-permissions-1  Created                                                                                                                               0.0s
 ✔ Container tutor_local-mongodb-1      Running                                                                                                                               0.0s
[+] Running 1/1
 ✔ Container tutor_local-permissions-1  Started                                                                                                                               0.3s
2023-12-04 07:11:55,005 INFO Extracting archive /data/backup/backup.2023-12-04.tar.xz to /data
2023-12-04 07:11:55,044 INFO Complete. /data is 6545890 bytes.
2023-12-04 07:11:55,044 INFO Restoring MySQL databases on mysql:3306 from /data/mysql_dump.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 3552 (HY000) at line 24: Access to system schema 'mysql' is rejected.
Traceback (most recent call last):
  File "restore_services.py", line 258, in <module>
    main()
  File "/s3/venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/s3/venv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/s3/venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/s3/venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "restore_services.py", line 250, in main
    restore_mysql()
  File "restore_services.py", line 50, in restore_mysql
    check_call(mysql_cmd,
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'mysql --host=mysql --port=3306 --user=root --password=uTGAkVTr' returned non-zero exit status 1.
Error: Command failed with status 1: docker compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm backup-job sh -e -c python restore_services.py --date=2023-12-04 --exclude=caddy

where does the problem come from, and I ran it with the following command :

root@HP-OMEN-17:~/.local/share/tutor/env/build/openedx/themes/indigo/lms/static/images# tutor local restore --exclude=mysql

it answered

⚠️  You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)
docker compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm backup-job sh -e -c 'python restore_services.py --date=2023-12-04 --exclude=mysql --exclude=caddy'
[+] Creating 4/0
 ✔ Container tutor_local-permissions-1  Created                                   0.0s
 ✔ Container tutor_local-mongodb-1      Runn...                                   0.0s
 ✔ Container tutor_local-caddy-1        Runnin...                                 0.0s
 ✔ Container tutor_local-mysql-1        Runnin...                                 0.0s
[+] Running 1/1
 ✔ Container tutor_local-permissions-1  Started                                   0.2s
2023-12-04 07:08:04,393 INFO Extracting archive /data/backup/backup.2023-12-04.tar.xz to /data
2023-12-04 07:08:04,432 INFO Complete. /data is 6545890 bytes.
2023-12-04 07:08:04,432 INFO Restoring MongoDB databases on mongodb:27017 from /data/mongodb_dump
2023-12-04T07:08:04.464+0000    preparing collections to restore from
2023-12-04T07:08:04.464+0000    reading metadata for openedx.modulestore.active_versions from /data/mongodb_dump/openedx/modulestore.active_versions.metadata.json
2023-12-04T07:08:04.464+0000    reading metadata for openedx.modulestore.definitions from /data/mongodb_dump/openedx/modulestore.definitions.metadata.json
2023-12-04T07:08:04.464+0000    reading metadata for openedx.modulestore.structures from /data/mongodb_dump/openedx/modulestore.structures.metadata.json
2023-12-04T07:08:04.464+0000    dropping collection openedx.modulestore.structures before restoring
2023-12-04T07:08:04.464+0000    dropping collection openedx.modulestore.active_versions before restoring
2023-12-04T07:08:04.464+0000    dropping collection openedx.modulestore.definitions before restoring
2023-12-04T07:08:04.540+0000    restoring openedx.modulestore.structures from /data/mongodb_dump/openedx/modulestore.structures.bson
2023-12-04T07:08:04.551+0000    restoring openedx.modulestore.definitions from /data/mongodb_dump/openedx/modulestore.definitions.bson
2023-12-04T07:08:04.551+0000    finished restoring openedx.modulestore.structures (26 documents, 0 failures)
2023-12-04T07:08:04.562+0000    restoring openedx.modulestore.active_versions from /data/mongodb_dump/openedx/modulestore.active_versions.bson
2023-12-04T07:08:04.562+0000    finished restoring openedx.modulestore.definitions (15 documents, 0 failures)
2023-12-04T07:08:04.573+0000    finished restoring openedx.modulestore.active_versions (1 document, 0 failures)
2023-12-04T07:08:04.573+0000    no indexes to restore for collection openedx.modulestore.definitions
2023-12-04T07:08:04.573+0000    no indexes to restore for collection openedx.modulestore.structures
2023-12-04T07:08:04.573+0000    no indexes to restore for collection openedx.modulestore.active_versions
2023-12-04T07:08:04.573+0000    42 document(s) restored successfully. 0 document(s) failed to restore.
2023-12-04 07:08:04,574 INFO MongoDB restored.

is the problem with restoring mysql?

Second question: Is this plugin suitable for transferring the entire platform, including courses, user information, exams, and themes and all customization and configuration?

But I have 1 Error in installation

root@HP-OMEN-17:/home/mahdi-tarrah/.local/share# tutor images build backup
⚠️  You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)
Building image docker.io/backup:3.0.1
docker buildx build --tag=docker.io/backup:3.0.1 --output=type=docker --cache-from=type=registry,ref=docker.io/backup:3.0.1-cache /root/.local/share/tutor/env/plugins/backup/build/backup
[+] Building 12.3s (14/14) FINISHED                                     docker:default
 => [internal] load .dockerignore                                                 0.0s
 => => transferring context: 2B                                                   0.0s
 => [internal] load build definition from Dockerfile                              0.0s
 => => transferring dockerfile: 881B                                              0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                   4.4s
 => ERROR importing cache manifest from docker.io/backup:3.0.1-cache              7.8s
 => [1/8] FROM docker.io/library/ubuntu:20.04@sha256:f5c3e53367f142fab0b49908550  0.0s
 => [internal] load build context                                                 0.0s
 => => transferring context: 16.47kB                                              0.0s
 => CACHED [2/8] RUN apt-get update &&     apt-get install -y curl gnupg          0.0s
 => CACHED [3/8] RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.as  0.0s
 => CACHED [4/8] RUN python3 -m venv /s3/venv/                                    0.0s
 => CACHED [5/8] RUN pip install --upgrade pip &&     pip install boto3 click &&  0.0s
 => CACHED [6/8] COPY backup_services.py .                                        0.0s
 => CACHED [7/8] COPY restore_services.py .                                       0.0s
 => CACHED [8/8] COPY s3_client.py .                                              0.0s
 => exporting to image                                                            0.0s
 => => exporting layers                                                           0.0s
 => => writing image sha256:4dd0e27b4f7f5ce4ad97b6f8028546bc2cb88e090a06c4b802bf  0.0s
 => => naming to docker.io/library/backup:3.0.1                                   0.0s
------
 > importing cache manifest from docker.io/backup:3.0.1-cache:
------