[damned-lies/oscp] Rework image to use uwsgi



commit 14589cef3ca4586ef82a820e62c20a6f47f800c2
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Mar 23 15:53:24 2020 +0100

    Rework image to use uwsgi

 Dockerfile                                       | 39 ------------------------
 uwsgi/Dockerfile                                 | 28 +++++++++++++++++
 entrypoint.sh => uwsgi/entrypoint.sh             |  6 ++--
 l10n.gnome.org.conf => uwsgi/l10n.gnome.org.conf |  0
 local_settings.py => uwsgi/local_settings.py     |  0
 ssh_config => uwsgi/ssh_config                   |  0
 uwsgi/uwsgi.ini                                  | 16 ++++++++++
 7 files changed, 47 insertions(+), 42 deletions(-)
---
diff --git a/uwsgi/Dockerfile b/uwsgi/Dockerfile
new file mode 100644
index 00000000..fec0a0ed
--- /dev/null
+++ b/uwsgi/Dockerfile
@@ -0,0 +1,28 @@
+FROM centos:7
+
+RUN INSTALL_PKGS="atlas-devel gcc-gfortran libffi-devel libtool-ltdl enchant \
+        gettext gnome-doc-utils intltool itstool libicu-devel mariadb-devel \
+        subversion translate-toolkit yelp-tools \
+        uwsgi uwsgi-plugin-python36" && \
+    yum install -y epel-release && \
+    yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
+    rpm -V $INSTALL_PKGS 
+
+RUN groupadd l10n -g 1000660000 && \
+    useradd l10n -g 1000660000 -u 1000660000 -G apache -r -l -m && \
+    chown l10n:l10n /etc/pki/tls/certs/localhost.crt /etc/pki/tls/private/localhost.key && \
+    chown l10n:l10n /opt/rh/httpd24/root/var/run/httpd && \
+    mkdir -p /l10n && \
+    git clone --depth 1 --branch master --single-branch 
https://gitlab.gnome.org/Infrastructure/damned-lies.git /l10n/damnedlies
+ADD local_settings.py /l10n/damnedlies/damnedlies/local_settings.py
+ADD l10n.gnome.org.conf /opt/rh/httpd24/root/etc/httpd/conf.d/l10n.gnome.org.conf
+RUN chown -R l10n:l10n /l10n
+
+USER l10n
+WORKDIR /l10n/damnedlies
+RUN pip3 install -r requirements.txt
+
+ADD entrypoint.sh /entrypoint.sh
+ADD uwsgi.ini /uwsgi.ini
+ENTRYPOINT ["/entrypoint.sh"]
+CMD ["uwsgi", "--enable-threads", "--ini", "/uwsgi.ini"]
diff --git a/entrypoint.sh b/uwsgi/entrypoint.sh
similarity index 88%
rename from entrypoint.sh
rename to uwsgi/entrypoint.sh
index 554592b3..dc5a32a8 100755
--- a/entrypoint.sh
+++ b/uwsgi/entrypoint.sh
@@ -15,9 +15,9 @@ ln -s /home/l10n/.ssh_secret/.gitconfig /home/l10n/.gitconfig
 wget https://gitlab.gnome.org/Infrastructure/damned-lies/raw/oscp/ssh_config -O /home/l10n/.ssh/config
 
 echo 'Generating static files'
-/l10n/venv/bin/python manage.py collectstatic
+python3 manage.py collectstatic
 
 echo 'Compiling translations'
-/l10n/venv/bin/python manage.py compile-trans
+python3 manage.py compile-trans
 
-scl enable rh-python36 httpd24 "$*"
+exec "$@"
diff --git a/l10n.gnome.org.conf b/uwsgi/l10n.gnome.org.conf
similarity index 100%
rename from l10n.gnome.org.conf
rename to uwsgi/l10n.gnome.org.conf
diff --git a/local_settings.py b/uwsgi/local_settings.py
similarity index 100%
rename from local_settings.py
rename to uwsgi/local_settings.py
diff --git a/ssh_config b/uwsgi/ssh_config
similarity index 100%
rename from ssh_config
rename to uwsgi/ssh_config
diff --git a/uwsgi/uwsgi.ini b/uwsgi/uwsgi.ini
new file mode 100644
index 00000000..40610735
--- /dev/null
+++ b/uwsgi/uwsgi.ini
@@ -0,0 +1,16 @@
+[uwsgi]
+wsgi-file = /l10n/damnedlies/damnedlies/wsgi.py
+chdir = /l10n/damnedlies
+
+master = true
+processes = 5
+
+buffer-size = 16384
+
+socket = :8000
+uid=l10n
+gid=l10n
+protocol = uwsgi
+vacuum = true
+
+die-on-term = true


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]