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

Failures during backup #340

Closed
Anthirian opened this issue Sep 22, 2023 · 3 comments · Fixed by #342
Closed

Failures during backup #340

Anthirian opened this issue Sep 22, 2023 · 3 comments · Fixed by #342
Assignees

Comments

@Anthirian
Copy link

Anthirian commented Sep 22, 2023

Describe the bug
I'm unable to back up the data using the CLI.

To Reproduce
Steps to reproduce the behavior:

  1. SSH into the server running Ghostwriter
  2. Change directory to the install folder
  3. Run sudo ./ghostwriter-cli-linux backup
  4. Observe errors like below

Expected Behavior
A regular back up.

Screenshots

geert@ghostwriter:/opt/Ghostwriter$ sudo ./ghostwriter-cli-linux backup
[+] Checking the status of Docker and the Compose plugin...
[+] Backing up the PostgreSQL database for the production environment
[+] Running `docker` to back up the PostgreSQL database with production.yml...
Backing up the 'ghostwriter' database...
ERROR: Backing up as 'postgres' user is not supported. Assign 'POSTGRES_USER' env with another one and try again.
[-] Error from `docker`: exit status 1
2023/09/22 16:16:32 Error trying to back up the PostgreSQL database with production.yml: exit status 1

Server Specs:

  • OS: [e.g., Ubuntu]

    $ cat /etc/os-release
    PRETTY_NAME="Ubuntu 22.04.2 LTS"
    NAME="Ubuntu"
    VERSION_ID="22.04"
    VERSION="22.04.2 LTS (Jammy Jellyfish)"
    VERSION_CODENAME=jammy
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=jammy
    
  • Docker [e.g., output of docker --version and docker-compose -v]

    $ docker -v
    Docker version 24.0.5, build ced0996
    
    $ docker compose version
    Docker Compose version v2.20.2
    
  • Ghostwriter [e.g., 2.2.3 or whatever is printed at the bottom of the left-hand sidebar]

    $ sudo ./ghostwriter-cli-linux version
    Ghostwriter-CLI ( v0.2.16, 21 Sep 2023 )
    

    Ghostwriter 4.0.0

Additional context
N/A

@Anthirian Anthirian added the bug Something isn't working label Sep 22, 2023
@chrismaddalena
Copy link
Collaborator

Hey @Anthirian,

The Postgres backup script Ghostwriter uses doesn't like that your user is the default postgres account. It's a best practice to not use postgres, but it can get in the way here. I've considered removing that check.

You can do that by editing this file and removing these lines: https://github.com/GhostManager/Ghostwriter/blob/master/compose/production/postgres/maintenance/backup#L23

You can also follow the steps outlined in this issue to change your user:

#322

@chrismaddalena chrismaddalena removed the bug Something isn't working label Sep 22, 2023
@Anthirian
Copy link
Author

Thanks, I followed the suggestions and created the backup_user and used the same password that Ghostwriter already set during install. Is there any reason not to do this by default during install?

@chrismaddalena
Copy link
Collaborator

You can change the user on install, but most people leave it at the default. That's fine, but then there is this conflict with the PostgreSQL maintenance scripts.

I can't find anything that states PostgreSQL backups and restores do not work with a user named postgres. It's only in the community scripts. It looks like a safeguard against the postgres user not working for backups on some *nix systems. It works without any issues in Ghostwriter's containers so I've removed the checks in the scripts for v4.0.1.

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

Successfully merging a pull request may close this issue.

2 participants