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

fix(docs): Windows backup script #13091

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aviv926
Copy link
Contributor

@aviv926 aviv926 commented Oct 1, 2024

The method shown in the Immich documents for backing up on Windows does not work well and it does not properly back up city names in languages ​​other than English.

Cities in Hebrew and Arabic languages ​​would appear as ┘ו╪»┘ך┘ז╪⌐ ╪¿┘ז┘ך ┘ך╪º╪│and caused problems after restoring from a backup.

A solution to this problem is to backup directly from the Docker container and then copy the file to Windows.

The script will create a folder named Immich DB backups on the desktop where a file named immich_dump.sql.gz will be stored.

It's important for me to say, I'm not a big expert in PS that's why I used artificial intelligence to write this script, it works well and does the job properly.

I will understand if you don't want to include it in the documentation, however if we don't include it we will have to remove the option of backing up the database in Windows and instead put a link to the gits I created or link it to the Community Guides, or find a way to back up the database properly , as you see fit :)

demo.mp4

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 1, 2024
@bo0tzz
Copy link
Member

bo0tzz commented Oct 1, 2024

I don't really understand the issue

A solution to this problem is to backup directly from the Docker container and then copy the file to Windows.

As far as I can tell the existing setup already runs the pg dump inside of the container.

Copy link
Contributor

github-actions bot commented Oct 1, 2024

📖 Documentation deployed to pr-13091.preview.immich.app

@aviv926
Copy link
Contributor Author

aviv926 commented Oct 1, 2024

I don't really understand the issue

A solution to this problem is to backup directly from the Docker container and then copy the file to Windows.

As far as I can tell the existing setup already runs the pg dump inside of the container.

From an experiment I did when I ran the script:
docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgres | Set-Content -Encoding utf8 "C:\path\to\backup\dump.sql"

This returned a file with the names of the cities in Hebrew and Arabic corrupted, in addition even if a user uses an external directory with paths that contain Hebrew or Arabic characters it corrupts them.

This is how it looks:
image

I tried to figure out if the problem is related to Set-Content -Encoding utf8 but I couldn't get it to work even when I changed it to Windows-1256 for Arabic or Windows-1255 for Hebrew.

Only when I ran inside the docker container the backup command
pg_dumpall --clean --if-exists --username=postgres | gzip > "/path/to/backup/dump.sql.gz"

And I checked the backup content, it displayed the Hebrew and Arabic letters correctly.

This is how it should look:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:documentation documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants