Skip to content

[bug] restic backup fail when website has already existed #414

@ponsfrilus

Description

@ponsfrilus

If a web site has been delete and the recreated, the restic backup fails with Fatal: create key in repository at s3:https://s3.epfl.ch/svc0041-123456789/backup/path/file failed: repository master key and config already initialized

Steps to reproduce:

  1. Create a new web site (wp-veritas + ansible)
  2. Run ansible -t wp.backup
  3. Wipe the website
  4. Remove the website from wp-veritas
  5. Then, restore the website from the wp-veritas's trash
  6. Re-run the website creation with ansible
  7. Run any task related to a backup (wipe or backup)
expand error message
fatal: [www__campus__services__website__canari2]: FAILED! => {"changed": true, "cmd": "set -o pipefail
set -e -x
echo \"restic_start{url=\\\"https://www.epfl.ch/campus/services/website/canari2/\\\", wp_env=\\\"www\\\"} $(date +%s)\" \\
| curl -X POST -H \"Content-Type: text/plain\" --data-binary @- http://pushgateway.wwp-infra:9091/metrics/job/backup/instance/www__campus__services__website__canari2
for repo in \"s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files\" \"s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql\"; do

[...]
\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 98 0 0 100 98 0 2969 --:--:-- --:--:-- --:--:-- 2969
+ for repo in "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files\\" "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql\"
+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files init

Fatal: create key in repository at s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files failed: repository master key and config already initialized

+ true
+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files unlock
+ for repo in "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/fil\es\" "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql\"
+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql init

Fatal: create key in repository at s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql failed: repository master key and config already initialized

+ true
+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql unlock
+ cd /srv/www/www.epfl.ch/htdocs/campus/services/website/canari2/
+ declare -a excludes
++ find . -mindepth 2 -maxdepth 2 -name wp-config.php
++ set -o pipefail
++ set -e -x
++ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files backup --json .
++ jq -r -s 'last(.[] | select(.message_type == "summary")) | .snapshot_id'

Fatal: unable to save snapshot: snapshot is empty

+ files_snapshot_id=null", "stderr_lines": ["+ curl -X POST -H 'Content-Type: text/plain' --data-binary @- http://pushgateway.wwp-infra:9091/metrics/job/backup/instance/www__campus__services__website__canari2", "++ date +%s", "+ echo 'restic_start{url="https://www.epfl.ch/campus/services/website/canari2/", wp_env="www"} 1613557480'", " % Total % Received % Xferd Average Speed Time Time Time Current", " Dload Upload Total Spent Left Speed", "", " 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0", "100 98 0 0 100 98 0 2969 --:--:-- --:--:-- --:--:-- 2969", "+ for repo in "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files" "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql"", "+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files init", "Fatal: create key in repository at s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files failed: repository master key and config already initialized", "", "+ true", "+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files unlock", "+ for repo in "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files" "s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql"", "+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql init", "Fatal: create key in repository at s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql failed: repository master key and config already initialized", "", "+ true", "+ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/sql unlock", "+ cd /srv/www/www.epfl.ch/htdocs/campus/services/website/canari2/", "+ declare -a excludes", "++ find . -mindepth 2 -maxdepth 2 -name wp-config.php", "++ set -o pipefail", "++ set -e -x", "++ restic -r s3:https://s3.epfl.ch/svc0041-123456789/backup/wordpresses/www__campus__services__website__canari2/files backup --json .", "++ jq -r -s 'last(.[] | select(.message_type == "summary")) | .snapshot_id'",
"Fatal: unable to save snapshot: snapshot is empty", "+ files_snapshot_id=null"], "stdout": "created new cache in /var/www/.cache/restic
successfully removed locks
created new cache in /var/www/.cache/restic
successfully removed locks", "stdout_lines": ["created new cache in /var/www/.cache/restic", "successfully removed locks", "created new cache in /var/www/.cache/restic", "successfully removed locks"]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions