70 lines
1.9 KiB
Bash
Executable File
70 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
echo "mayan: starting entrypoint.sh"
|
|
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
|
|
|
|
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
|
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
|
export MAYAN_ALLOWED_HOSTS=*
|
|
export MAYAN_BIN=/usr/local/lib/python2.7/dist-packages/mayan/bin/mayan-edms.py
|
|
export MAYAN_BROKER_URL=${MAYAN_BROKER_URL:-redis://127.0.0.1:6379/0}
|
|
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-redis://127.0.0.1:6379/0}
|
|
export MAYAN_GUNICORN_WORKERS=${MAYAN_GUNICORN_WORKERS:-2}
|
|
export MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan
|
|
export MAYAN_MEDIA_ROOT=/var/lib/mayan
|
|
export MAYAN_SETTINGS_FILE=${MAYAN_SETTINGS_FILE:-mayan.settings.production}
|
|
|
|
export CELERY_ALWAYS_EAGER=False
|
|
export PYTHONPATH=$PYTHONPATH:$MAYAN_MEDIA_ROOT/settings
|
|
|
|
chown mayan:mayan /var/lib/mayan -R
|
|
|
|
initialize() {
|
|
echo "mayan: initialize()"
|
|
su mayan -c "mayan-edms.py initialsetup --force"
|
|
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
|
}
|
|
|
|
upgrade() {
|
|
echo "mayan: upgrade()"
|
|
su mayan -c "mayan-edms.py performupgrade"
|
|
su mayan -c "mayan-edms.py collectstatic --noinput --clear"
|
|
}
|
|
|
|
start() {
|
|
echo "mayan: start()"
|
|
rm -rf /var/run/supervisor.sock
|
|
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
|
|
}
|
|
|
|
os_package_installs() {
|
|
echo "mayan: os_package_installs()"
|
|
if [ "${MAYAN_APT_INSTALLS}" ]; then
|
|
apt-get-install $MAYAN_APT_INSTALLS
|
|
fi
|
|
}
|
|
|
|
pip_installs() {
|
|
echo "mayan: pip_installs()"
|
|
if [ "${MAYAN_PIP_INSTALLS}" ]; then
|
|
pip install $MAYAN_PIP_INSTALLS
|
|
fi
|
|
}
|
|
|
|
os_package_installs || true
|
|
pip_installs || true
|
|
|
|
if [ "$1" = 'mayan' ]; then
|
|
# Check if this is a new install, otherwise try to upgrade the existing
|
|
# installation on subsequent starts
|
|
if [ ! -f $INSTALL_FLAG ]; then
|
|
initialize
|
|
else
|
|
upgrade
|
|
fi
|
|
start
|
|
else
|
|
su mayan -c "mayan-edms.py $@";
|
|
fi
|