Add a dependency link between two containers and change the way Django migrations are done. Provide example for auto-starting the containers

This commit is contained in:
Georgi Todorov
2018-02-05 18:23:35 -05:00
parent c85b6b425d
commit 3f9ea7b971
4 changed files with 29 additions and 5 deletions

View File

@@ -42,9 +42,24 @@ set_permissions() {
chown -Rh paperless:paperless /usr/src/paperless
}
migrations() {
# A simple lock file in case other containers use this startup
LOCKFILE="/usr/src/paperless/data/db.sqlite3.migration"
set -o noclobber
# check for and create lock file in one command
(> ${LOCKFILE}) &> /dev/null
if [ $? -eq 0 ]
then
sudo -HEu paperless "/usr/src/paperless/src/manage.py" "migrate"
rm ${LOCKFILE}
fi
}
initialize() {
map_uidgid
set_permissions
migrations
}
install_languages() {