pandora/docker/install.sh

65 lines
1.9 KiB
Bash
Raw Normal View History

2019-07-06 16:12:32 +00:00
#!/bin/bash
export LANG=en_US.UTF-8
PANDORA=${PANDORA-pandora}
echo Installing pandora with user: $PANDORA
getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA
HOST=$(hostname -s)
HOST_CONFIG="/srv/pandora/pandora/config.$HOST.jsonc"
SITE_CONFIG="/srv/pandora/pandora/config.jsonc"
test -e $HOST_CONFIG && cp $HOST_CONFIG $SITE_CONFIG
test -e $SITE_CONFIG || cp /srv/pandora/pandora/config.pandora.jsonc $SITE_CONFIG
cat > /srv/pandora/pandora/local_settings.py <<EOF
import os
SECRET_KEY = os.environ.get('SECRET_KEY')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': 'db',
'PORT': 5432,
}
}
CELERY_BROKER_URL = "amqp://{0}:{1}@rabbitmq:5672//".format(os.environ.get('RABBITMQ_DEFAULT_USER'), os.environ.get('RABBITMQ_DEFAULT_PASS'))
2019-07-06 16:12:32 +00:00
XACCELREDIRECT = True
DEBUG = False
TEMPLATE_DEBUG = DEBUG
JSON_DEBUG = False
DB_GIN_TRGM = True
WEBSOCKET_ADDRESS = "0.0.0.0"
EMAIL_HOST=os.environ.get('EMAIL_HOST')
EMAIL_HOST_USER=os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD=os.environ.get('EMAIL_PASSWORD')
EMAIL_PORT=int(os.environ.get('EMAIL_PORT', 587))
EMAIL_USE_TLS=os.environ.get('EMAIL_TLS', 'true').lower() == 'true'
overlay_settings = 'overlay_settings.py'
if os.path.exists(overlay_settings):
from overlay_settings import *
EOF
cp /srv/pandora/pandora/gunicorn_config.py.in /srv/pandora/pandora/gunicorn_config.py
sed -i s/127.0.0.1/0.0.0.0/g /srv/pandora/pandora/gunicorn_config.py
chown -R $PANDORA:$PANDORA /srv/pandora
cd /srv/pandora
./ctl init
cp /srv/pandora/docker/entrypoint.sh /entrypoint.sh
mv /srv/pandora/ /srv/pandora_base/
mkdir /pandora
ln -s /pandora /srv/pandora
2020-09-27 15:53:37 +00:00
cat > /usr/local/bin/pandoractl << EOF
2019-07-06 16:12:32 +00:00
#!/bin/sh
2020-09-27 15:53:37 +00:00
exec /srv/pandora/ctl \$@
2019-07-06 16:12:32 +00:00
EOF
2020-09-27 15:53:37 +00:00
chmod +x /usr/local/bin/pandoractl