Use a config file for uwsgi.

This commit is contained in:
Abhilash Raj
2017-05-28 14:20:39 -07:00
parent f920f88165
commit 7bc5bf5dc4
4 changed files with 24 additions and 37 deletions

View File

@@ -32,10 +32,6 @@ services:
volumes: volumes:
- /opt/mailman/web:/opt/mailman-web-data - /opt/mailman/web:/opt/mailman-web-data
environment: environment:
- UWSGI_WSGI_FILE=wsgi.py
- UWSGI_HTTP=:8000
- UWSGI_WORKERS=2
- UWSGI_THREADS=4
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb - DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- HYPERKITTY_API_KEY=someapikey - HYPERKITTY_API_KEY=someapikey
networks: networks:

View File

@@ -10,20 +10,16 @@ RUN apt-get update \
postgresql-client \ postgresql-client \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN wget -O mailmanclient.zip https://gitlab.com/mailman/mailmanclient/repository/archive.zip?ref=master \ RUN python -m pip install -U mailmanclient==3.1.0 \
&& wget -O postorius.zip https://gitlab.com/mailman/postorius/repository/archive.zip?ref=master \ postorius==1.1.0 \
&& wget -O django-mailman3.zip https://gitlab.com/mailman/django-mailman3/repository/archive.zip?ref=master \ hyperkitty==1.1.0 \
&& wget -O hyperkitty.zip https://gitlab.com/mailman/hyperkitty/repository/archive.zip?ref=master \ django-mailman3==1.1.0 \
&& python -m pip install -U mailmanclient.zip \ whoosh \
postorius.zip \ uwsgi \
hyperkitty.zip \ psycopg2 \
whoosh \ dj-database-url \
uwsgi \ pymysql \
psycopg2 \ && python -m pip install -U django==1.10
dj-database-url \
pymysql \
&& python -m pip install -U django-mailman3.zip \
&& rm mailmanclient.zip postorius.zip hyperkitty.zip django-mailman3.zip
ADD mailman-web /opt/mailman-web ADD mailman-web /opt/mailman-web
@@ -35,4 +31,4 @@ EXPOSE 8000
ENTRYPOINT ["/opt/run.sh"] ENTRYPOINT ["/opt/run.sh"]
CMD ["uwsgi", "--http-auto-chunked","--http-keepalive"] CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]

View File

@@ -49,8 +49,9 @@ if [[ ! -v DATABASE_URL ]]; then
echo "DATABASE_URL is not defined. Using sqlite database..." echo "DATABASE_URL is not defined. Using sqlite database..."
export DATABASE_URL=sqlite://mailmanweb.db export DATABASE_URL=sqlite://mailmanweb.db
export DATABASE_TYPE='sqlite' export DATABASE_TYPE='sqlite'
else fi
export DATABASE_TYPE='postgres'
if [[ "$DATABASE_TYPE" = 'postgres' ]]; then
wait_for_postgres wait_for_postgres
fi fi
@@ -88,20 +89,4 @@ python manage.py collectstatic --noinput
# this command will upgrade the database. # this command will upgrade the database.
python manage.py migrate 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 $@ exec $@

10
web/mailman-web/uwsgi.ini Normal file
View 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