remove last remnants of Paths, now only 1 directory per path AND created a new db-container subdir that takes the latest postgres image and adds a crontab / uses cron to run a bkup_users.sh script that dumps the person, refimg and linkage table so that if we ever blow the DB away, we dont lose the users

This commit is contained in:
2022-09-17 22:40:50 +10:00
parent 19bd4285e1
commit 71ec54807a
7 changed files with 36 additions and 40 deletions

View File

@@ -13,5 +13,6 @@ RUN truncate -s0 /tmp/preseed.cfg && \
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get update && apt-get -y install cron
COPY crontab /etc/crontab
COPY bkup_users.sh /tmp/
EXPOSE 5432
CMD ["sh", "-c", "cron ; /usr/local/bin/docker-entrypoint.sh postgres"]

7
db-container/bkup_users.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
pg_dump -a --user=pa --table=person --table=refimg --table=person_refimg_link > /tmp/new_users.sql
tmp=`diff -q /docker-entrypoint-initdb.d/users.sql /tmp/new_users.sql`
if (( $? !=0 && $(stat -c%s "/tmp/new_users.sql") > 200000 )) ; then
cp -f /tmp/new_users.sql /docker-entrypoint-initdb.d/users.sql
fi

View File

@@ -1 +1 @@
* * * * * root pg_dump -a --user=pa --table=person --table=refimg --table=person_refimg_link > /tmp/new_users.sql
* * * * * root /tmp/bkup_users.sh