Use a config file for uwsgi.
This commit is contained in:
@@ -32,10 +32,6 @@ services:
|
||||
volumes:
|
||||
- /opt/mailman/web:/opt/mailman-web-data
|
||||
environment:
|
||||
- UWSGI_WSGI_FILE=wsgi.py
|
||||
- UWSGI_HTTP=:8000
|
||||
- UWSGI_WORKERS=2
|
||||
- UWSGI_THREADS=4
|
||||
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
|
||||
- HYPERKITTY_API_KEY=someapikey
|
||||
networks:
|
||||
|
||||
@@ -10,20 +10,16 @@ RUN apt-get update \
|
||||
postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget -O mailmanclient.zip https://gitlab.com/mailman/mailmanclient/repository/archive.zip?ref=master \
|
||||
&& wget -O postorius.zip https://gitlab.com/mailman/postorius/repository/archive.zip?ref=master \
|
||||
&& wget -O django-mailman3.zip https://gitlab.com/mailman/django-mailman3/repository/archive.zip?ref=master \
|
||||
&& wget -O hyperkitty.zip https://gitlab.com/mailman/hyperkitty/repository/archive.zip?ref=master \
|
||||
&& python -m pip install -U mailmanclient.zip \
|
||||
postorius.zip \
|
||||
hyperkitty.zip \
|
||||
whoosh \
|
||||
uwsgi \
|
||||
psycopg2 \
|
||||
dj-database-url \
|
||||
pymysql \
|
||||
&& python -m pip install -U django-mailman3.zip \
|
||||
&& rm mailmanclient.zip postorius.zip hyperkitty.zip django-mailman3.zip
|
||||
RUN python -m pip install -U mailmanclient==3.1.0 \
|
||||
postorius==1.1.0 \
|
||||
hyperkitty==1.1.0 \
|
||||
django-mailman3==1.1.0 \
|
||||
whoosh \
|
||||
uwsgi \
|
||||
psycopg2 \
|
||||
dj-database-url \
|
||||
pymysql \
|
||||
&& python -m pip install -U django==1.10
|
||||
|
||||
ADD mailman-web /opt/mailman-web
|
||||
|
||||
@@ -35,4 +31,4 @@ EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/opt/run.sh"]
|
||||
|
||||
CMD ["uwsgi", "--http-auto-chunked","--http-keepalive"]
|
||||
CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]
|
||||
|
||||
@@ -49,8 +49,9 @@ if [[ ! -v DATABASE_URL ]]; then
|
||||
echo "DATABASE_URL is not defined. Using sqlite database..."
|
||||
export DATABASE_URL=sqlite://mailmanweb.db
|
||||
export DATABASE_TYPE='sqlite'
|
||||
else
|
||||
export DATABASE_TYPE='postgres'
|
||||
fi
|
||||
|
||||
if [[ "$DATABASE_TYPE" = 'postgres' ]]; then
|
||||
wait_for_postgres
|
||||
fi
|
||||
|
||||
@@ -88,20 +89,4 @@ python manage.py collectstatic --noinput
|
||||
# this command will upgrade the database.
|
||||
python manage.py migrate
|
||||
|
||||
|
||||
# Log to the default location /opt/mailman-web-data/logs/uwsgi.log if the
|
||||
# logging variable is not set.
|
||||
if [[ ! -v UWSGI_LOGTO ]]; then
|
||||
echo "No UWSGI_LOGTO defined, logging uwsgi to /opt/mailman-web-data/logs/uwsgi.log ..."
|
||||
export UWSGI_LOGTO='/opt/mailman-web-data/logs/uwsgi.log'
|
||||
touch "$UWSGI_LOGTO"
|
||||
fi
|
||||
|
||||
if [[ ! -v UWSGI_WSGI_FILE ]]; then
|
||||
export UWSGI_WSGI_FILE="wsgi.py"
|
||||
export UWSGI_HTTP=:8000
|
||||
export UWSGI_WORKERS=2
|
||||
export UWSGI_THREADS=4
|
||||
fi
|
||||
|
||||
exec $@
|
||||
|
||||
10
web/mailman-web/uwsgi.ini
Normal file
10
web/mailman-web/uwsgi.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
[uwsgi]
|
||||
http = :8000
|
||||
chdir = /opt/mailman-web
|
||||
wsgi-file = wsgi.py
|
||||
process = 2
|
||||
threads = 2
|
||||
uid = 1000
|
||||
gid = 1000
|
||||
req-log = file:/opt/mailman-web-data/uwsgi.log
|
||||
error-log = file:/opt/mailman-web-data/uwsgi-error.log
|
||||
Reference in New Issue
Block a user