#Postgres automatic backup
1 messages ยท Page 1 of 1 (latest)
:wave: Hey @distant heart,
Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich
.
References
- Container Logs:
docker compose logsdocs - Container Status:
docker compose psdocs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
Checklist
- :blue_square: I have verified I'm on the latest release(note that mobile app releases may take some time).
- :blue_square: I have read applicable release notes.
- :blue_square: I have reviewed the FAQs for known issues.
- :blue_square: I have reviewed Github for known issues.
- :blue_square: I have tried accessing Immich via local ip (without a custom reverse proxy).
- :blue_square: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
- :blue_square: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
If this ticket can be closed you can use the /close command, and re-open it later if needed.
So for your host show me a df -hT
and post your compose/env files so I can know what I'm working with here ๐
tmpfs tmpfs 3,2G 3,3M 3,2G 1% /run
/dev/sda2 ext4 457G 86G 349G 20% /
tmpfs tmpfs 16G 17M 16G 1% /dev/shm
tmpfs tmpfs 5,0M 8,0K 5,0M 1% /run/lock
efivarfs efivarfs 150K 82K 64K 57% /sys/firmware/efi/efivars
/dev/sda1 vfat 511M 6,2M 505M 2% /boot/efi
/dev/sdb1 fuseblk 17T 10T 6,5T 61% /media/ntfs3
/dev/sdc1 fuseblk 7,3T 6,5T 841G 89% /media/ntfs2
tmpfs tmpfs 3,2G 204K 3,2G 1% /run/user/1000
You can find documentation for all the supported env variables at https://imm>
The location where your uploaded files are stored
UPLOAD_LOCATION=/media/ntfs2/immich
The Immich version to use. You can pin this to a specific version like "v1.71>
IMMICH_VERSION=release
Connection secret for postgres. You should change it to a random password
DB_PASSWORD=jasjfaf
The values below this line do not need to be changed
###############################################################################>
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
Right, so it's /media/ntfs2/db_dumps not just ntfs...
That's what I said before
Yes but in my code snippets I put /ntfs/ not /ntfs2/ so if you copied that it'll be wrong ๐
Ah, that's what you mean
I changed it correctly
./media/ntfs2/immich/db_dumps:${BACKUP_DIR}
That's what I currently have
no you put ./media
It's /media
. is short for 'this directory'
so ./media is /path/to/compose/file/media
Oh
Let me try it out
the dumper wants to use port 8080, can I change that? It's already used
Under environment try replacing the 8080 with something you want:
environment:
- HEALTHCHECK_PORT=8080
(See also the original maker https://github.com/prodrigestivill/docker-postgres-backup-local )
How long does it usually take to check the health? It's using port 8555 now but it's still checking health
I think the default interval is a couple of seconds
Then sth is wrong ;D
It says starting and tha's the output 2024/09/22 10
57 Running version: v0.0.11
2024/09/22 10
57 new cron: @daily
2024/09/22 10
57 Opening port 8555 for health checking
Does it hang or is that what it's just supposed to show?
curl -f http://localhost:8555
What does your compose file look like?
please use backticks for code blocks, three of these ` at start and end
container_name: immich_db_dumper
image: prodrigestivill/postgres-backup-local:14
restart: always
env_file:
- .env
environment:
POSTGRES_HOST: database
POSTGRES_CLUSTER: 'TRUE'
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_DATABASE_NAME}
SCHEDULE: "@daily"
POSTGRES_EXTRA_OPTS: '--clean --if-exists'
BACKUP_DIR: /db_dumps
HEALTHCHECK_PORT: 8555
volumes:
- /media/ntfs2/immich/db_dumps:/db_dumps
depends_on:
- database ```
If it's done it should report healthy or running. Starting means sth is wrong
anything in docker logs immich_db_dumper ?
Same thing
2024/09/22 10:36:42 new cron: @daily
2024/09/22 10:36:42 Opening port 8555 for health checking
at least it says healthy now instead of starting but there is no backup of postgres in the folder
We'll have to check when "daily" runs
Just started mine, it's looking healthy
Took about 5-10 minutes before it went to 'healthy' though
Ok, so similar to mine
Cron should've been run by now but there is no dump. Ubuntu runs cron for the user root every 17 min after one hours
so 1:17 and 2:17 and so on
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
# You can also override PATH, but by default, newer versions inherit it from the environment
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
#
Where are you getting that from
You need the container crontab not your system cron
and you put @DAILY right?
So why would it have run
Gotta switch it to @HOURLY then ๐
So the container has a crontab too. The cron I posted is from my desktop
So daily would be 6:25 am if I am reading the chart correctly. Probably will be around that for the container too
it really depends from release to release, I tried to find it for alpine/go-cron but no dice
Best to wait about 36 hours and see what happens. No sense going crazy debugging now
mine populated fine right now @distant heart so should be the same for you
Mine worked too ๐
How does the backup work now? I see mltiple folders called daily, weekly, monthly and all three of them are populated. Does the daily get replaced each day and the monthly once every month?
It probably just moves it according to some logic
And yeah I imagine the month one will stay in place for the whole month, or perhaps until the first of october
So it does not delete my daily created one. I now have 23 and 24 in daily but that would consume a lot of space. Is there any way to automatically overwrite the old one?
BACKUP_KEEP_DAYS Number of daily backups to keep before removal. Defaults to 7.
BACKUP_KEEP_WEEKS Number of weekly backups to keep before removal. Defaults to 4.
BACKUP_KEEP_MONTHS Number of monthly backups to keep before removal. Defaults to 6.