gealogiuya
Some checks failed
Deploy Django Application to Server / deploy (push) Failing after 19s
Telegram Notifications / Telegram Gate (push) Failing after 5s

This commit is contained in:
2026-02-27 14:56:23 +05:00
commit 0229a0595c
118 changed files with 33948 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
FROM postgres:15-alpine
# Cron o'rnatish
RUN apt-get update && apt-get install -y cron
# Backup skriptni konteynerga qo'shish
COPY deployments/compose/backup/backup.sh /usr/local/bin/backup.sh
RUN chmod +x /usr/local/bin/backup.sh
# Crontab qo'shish
RUN echo "* * * * * /usr/local/bin/backup.sh" > /etc/cron.d/db-backup
RUN crontab /etc/cron.d/db-backup
# Cron va PostgreSQL serverni birgalikda ishga tushirish
CMD cron && tail -f /dev/null

View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Hozirgi vaqtni olish (backup fayl nomi uchun)
TIMESTAMP=$(date +"%F_%H-%M-%S")
# Backup saqlanadigan katalogni yaratish
BACKUP_DIR="/backups/$TIMESTAMP"
mkdir -p "$BACKUP_DIR"
# PostgreSQL'dan backup olish
PGPASSWORD=$POSTGRES_PASSWORD pg_dump -U $POSTGRES_USER -d $POSTGRES_DB -F c > "$BACKUP_DIR/my_database.dump"
# Eski backuplarni 7 kundan keyin o'chirish
find /backups/* -mtime +7 -exec rm -rf {} \;