mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-07 07:45:28 +00:00
Gets database cron into the right image
This commit is contained in:
parent
8b061d63a8
commit
687ff5a6d7
7 changed files with 18 additions and 14 deletions
|
@ -8,12 +8,3 @@ COPY requirements.txt /app/
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY ./bookwyrm /app
|
COPY ./bookwyrm /app
|
||||||
COPY ./celerywyrm /app
|
COPY ./celerywyrm /app
|
||||||
|
|
||||||
# crontab
|
|
||||||
COPY ./db_backup.sh /app
|
|
||||||
RUN apt-get update && apt-get -y install cron
|
|
||||||
COPY db-backups-cron /etc/cron.d/db-backups-cron
|
|
||||||
RUN chmod 0644 /etc/cron.d/db-backups-cron
|
|
||||||
RUN crontab /etc/cron.d/db-backups-cron
|
|
||||||
RUN touch /var/log/cron.log
|
|
||||||
CMD cron && tail -f /var/log/cron.log
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
0 0 * * * /app/db_bashup.sh
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
filename=backup__$(date +%F)
|
|
||||||
pg_dump -U fedireads | gzip > $filename.gz
|
|
|
@ -14,10 +14,11 @@ services:
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/images
|
- media_volume:/app/images
|
||||||
db:
|
db:
|
||||||
image: postgres
|
build: postgres-docker
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
- backups:/backups
|
||||||
networks:
|
networks:
|
||||||
- main
|
- main
|
||||||
web:
|
web:
|
||||||
|
@ -58,6 +59,7 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
backups:
|
||||||
static_volume:
|
static_volume:
|
||||||
media_volume:
|
media_volume:
|
||||||
networks:
|
networks:
|
||||||
|
|
10
postgres-docker/Dockerfile
Normal file
10
postgres-docker/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM postgres:latest
|
||||||
|
|
||||||
|
# crontab
|
||||||
|
RUN mkdir /backups
|
||||||
|
COPY ./db_backup.sh /backups
|
||||||
|
COPY ./db-backups-cron /etc/cron.d/db-backups-cron
|
||||||
|
RUN apt-get update && apt-get -y install cron
|
||||||
|
RUN chmod 0644 /etc/cron.d/db-backups-cron
|
||||||
|
RUN crontab /etc/cron.d/db-backups-cron
|
||||||
|
RUN touch /var/log/cron.log
|
2
postgres-docker/db-backups-cron
Normal file
2
postgres-docker/db-backups-cron
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
0 0 * * * /backups/db_bashup.sh
|
||||||
|
|
3
postgres-docker/db_backup.sh
Executable file
3
postgres-docker/db_backup.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
filename=backup__$(date +%F)
|
||||||
|
pg_dump -U fedireads > $filename.sql
|
Loading…
Reference in a new issue