[openevent-web] Gunicorn keeps spawning workers that fail to start, replace it with uwsgi (https://github.com/benoit
- From: Andrea Veri <averi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [openevent-web] Gunicorn keeps spawning workers that fail to start, replace it with uwsgi (https://github.com/benoit
- Date: Thu, 6 Jun 2019 16:54:30 +0000 (UTC)
commit 75456c48df3bcf74fa015f275a79e5e9595fb44d
Author: Andrea Veri <averi redhat com>
Date: Thu Jun 6 18:54:16 2019 +0200
Gunicorn keeps spawning workers that fail to start, replace it with uwsgi
(https://github.com/benoitc/gunicorn/issues/1663)
docker/Dockerfile | 23 +++++++++++++++++++++++
docker/container_start.sh | 23 +++++++++++++++++++++++
2 files changed, 46 insertions(+)
---
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..b901fde
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,23 @@
+FROM python:3.6-alpine
+LABEL maintainer="GNOME Infrastructure Team <gnome-sysadmin gnome org>"
+
+RUN apk update && \
+ apk add --virtual build-deps git gcc python3-dev musl-dev jpeg-dev zlib-dev libevent-dev file-dev
libffi-dev openssl && \
+ apk add postgresql-dev && \
+ pip install setuptools
+
+WORKDIR /data/app
+RUN git clone https://github.com/fossasia/open-event-server.git -b master .
+
+RUN wget https://bootstrap.pypa.io/ez_setup.py && python ez_setup.py
+
+RUN pip --no-cache-dir install setuptools uwsgi && \
+ LIBRARY_PATH=/lib:/usr/lib pip --no-cache-dir install -r requirements.txt
+
+RUN apk --no-cache add postgresql-dev ca-certificates libxslt jpeg zlib file libxml2 git && \
+ pip install git+https://github.com/fossasia/flask-rest-jsonapi.git@shubhamp-master#egg=flask-rest-jsonapi
+
+COPY container_start.sh /
+
+EXPOSE 5000
+CMD ["sh", "/container_start.sh"]
diff --git a/docker/container_start.sh b/docker/container_start.sh
new file mode 100644
index 0000000..f973571
--- /dev/null
+++ b/docker/container_start.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+export DEPLOYMENT=${DEPLOYMENT:-api}
+
+echo "[LOG] Deploying ${DEPLOYMENT}"
+echo "[LOG] Using database: ${DATABASE_URL}"
+echo "[LOG] Using redis: ${REDIS_URL}"
+
+if [ "$DEPLOYMENT" == "api" ]
+then
+ echo "[LOG] Preparing database"
+ python manage.py prepare_kubernetes_db
+ echo "[LOG] Running migrations"
+ python manage.py db upgrade
+ export PORT=${PORT:-8080}
+ echo "[LOG] Starting uwsgi on port ${PORT}"
+ uwsgi --socket 0.0.0.0:${PORT} --protocol=http --chdir=/data/app --enable-threads -w app:app
+fi
+if [ "$DEPLOYMENT" == "celery" ]
+then
+ echo "[LOG] Starting celery worker"
+ export INTEGRATE_SOCKETIO=false
+ celery worker -A app.celery --loglevel=warning
+fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]