Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup restore doesn't work #17

Closed
danimbrogno opened this issue Jun 28, 2017 · 3 comments
Closed

Backup restore doesn't work #17

danimbrogno opened this issue Jun 28, 2017 · 3 comments
Assignees

Comments

@danimbrogno
Copy link

Hey, I'm using your backup image and it works great but I'm having an issue restoring.

When I call the restore command I get the error:

fatal error: Parameter validation failed: Invalid bucket name "s3:": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"

If I echo out the bucket name it's trying to use I get:

s3://s3://[my-bucket]/[prefix]/[prefix]/hourly/2017-06-28_03-00-04.tar.xz

so it seem the s3:// gets doubled and the [prefix] gets doubled as well in the url construction.

Changing linke 167 in entrypoint.sh from

aws s3 cp "s3://${AWS_S3_PATH}/${RESTORE_FILE}" "$RESTORE_FILE"

to

aws s3 cp "s3://${AWS_S3_BUCKET}/${RESTORE_FILE}" "$RESTORE_FILE"

Seems to fix the path.

@danimbrogno
Copy link
Author

One other issue, if you choose not to encrypt your backup, the backup works fine but the restore fails because it attempts to decrypt a tar that is not encrypted. I fixed this by changing lines 172-177

 export RESTORE_FILE_DECRYPTED="decrypted.tar.xz"
  if [[ -s "$RESTORE_FILE" ]]; then
    log "Decrypt ${RESTORE_FILE}"
    export GPG_TTY=/dev/console
    gpg --batch --output "$RESTORE_FILE_DECRYPTED" --decrypt "$RESTORE_FILE"
  fi

to

export RESTORE_FILE_DECRYPTED=$RESTORE_FILE
  if [[ -n "$GPG_RECIPIENT" ]] && [[ -s "$RESTORE_FILE" ]]; then
    export RESTORE_FILE_DECRYPTED="decrypted.tar.xz"
    log "Decrypt ${RESTORE_FILE}"
    export GPG_TTY=/dev/console
    gpg --batch --output "$RESTORE_FILE_DECRYPTED" --decrypt "$RESTORE_FILE"
  fi

I'm not super familiar with bash scripting and haven't tested whether an encrypted backup restore works with this modified code.

I can submit a PR if so desired.

@vladgh
Copy link
Owner

vladgh commented Jun 28, 2017

Thanks for reporting this. I will fix it by the end of this week.

@vladgh
Copy link
Owner

vladgh commented Jul 2, 2017

Hi @danimbrogno, I have fixed the restore function and also did a major refactor of the code in the entrypoint, so that it's cleaner and easier to debug. c871699 should take care if this. Check the examples I added in the README. Some more testing would be appreciated, let me know if it works okay or not.

@vladgh vladgh closed this as completed Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants