[damned-lies/oscp] Generate statics in httpd image



commit 7ef0d62cb7732d0ca0da73bc5c4463279d91ef3e
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Mar 24 10:44:56 2020 +0100

    Generate statics in httpd image

 httpd/Dockerfile        | 24 +++++++++++++++++---
 httpd/entrypoint.sh     | 23 ++++++++++++++++++++
 httpd/local_settings.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 3 deletions(-)
---
diff --git a/httpd/Dockerfile b/httpd/Dockerfile
index 20fdf6f0..79a799d6 100644
--- a/httpd/Dockerfile
+++ b/httpd/Dockerfile
@@ -1,9 +1,27 @@
 FROM centos/httpd-24-centos7
 
 USER root
+
+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 gcc-c++ \
+        uwsgi uwsgi-plugin-python36 python36-devel wget" && \
+    yum install -y epel-release && \
+    yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS
+
+RUN groupadd l10n -g 1000660000 && \
+    useradd l10n -g 1000660000 -u 1000660000 -r -l -m && \
+    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
+RUN chown -R l10n:l10n /l10n
+
+WORKDIR /l10n/damnedlies
+RUN pip3 install -r requirements.txt
+
+ADD entrypoint.sh /entrypoint.sh
 COPY app_data /opt/app-root/src
 RUN chown -R 1000660000:1000660000 /opt/app-root/src
 
-EXPOSE 8080
-
-ENTRYPOINT ["/usr/bin/run-httpd"]
+USER 1000660000
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/httpd/entrypoint.sh b/httpd/entrypoint.sh
new file mode 100755
index 00000000..779168de
--- /dev/null
+++ b/httpd/entrypoint.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+sed -i "s/\$DB_NAME/${DB_NAME}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$DB_USER/${DB_USER}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$DB_PASSWORD/${DB_PASSWORD}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$DB_HOST/${DB_HOST}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$SECRET_KEY/${SECRET_KEY}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$SENTRY_DSN/${SENTRY_DSN}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$GITLAB_TOKEN/${GITLAB_TOKEN}/" /l10n/damnedlies/damnedlies/local_settings.py
+
+echo 'Populating .ssh for the l10n user'
+mkdir -p /home/l10n/.ssh
+ln -s /home/l10n/.ssh_secret/ssh-privatekey /home/l10n/.ssh/ssh-privatekey
+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'
+python3 manage.py collectstatic
+
+echo 'Compiling translations'
+python3 manage.py compile-trans
+
+exec /usr/bin/run-httpd
diff --git a/httpd/local_settings.py b/httpd/local_settings.py
new file mode 100644
index 00000000..82648ca7
--- /dev/null
+++ b/httpd/local_settings.py
@@ -0,0 +1,58 @@
+import os
+
+DEBUG = False
+STATIC_SERVE = False
+USE_DJANGO_OPENID = False
+
+ADMINS = (
+    ('Claude Paroz', 'claude 2xlibre net'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.mysql',
+        'NAME'  : '$DB_NAME',
+        'USER'  : '$DB_USER',
+        'PASSWORD': '$DB_PASSWORD',
+        'HOST'  : '$DB_HOST',
+        'CONN_MAX_AGE': 300,
+        'OPTIONS': {
+            'charset': 'utf8mb4',
+        }
+    }
+}
+SECRET_KEY = '$SECRET_KEY'
+#ALLOWED_HOSTS=['l10n.gnome.org', '8.43.85.13', '8.43.85.14']
+ALLOWED_HOSTS = ['*']
+SESSION_COOKIE_SECURE = True
+CSRF_COOKIE_SECURE = True
+
+EMAIL_HOST = 'smtp-int.gnome.org'
+EMAIL_SUBJECT_PREFIX = '[DL]'
+DEFAULT_FROM_EMAIL = 'noreply gnome org'
+SERVER_EMAIL = 'gnomeweb gnome org'
+
+TIME_ZONE = 'UTC'
+
+MEDIA_ROOT = '/var/www/djamnedlies/data/media'
+# Local directory path for VCS checkout
+SCRATCHDIR = "/var/www/djamnedlies/data/scratchdir"
+POTDIR = os.path.join(SCRATCHDIR, "POT")
+LOCK_DIR = '/var/www/djamnedlies/data/locks'
+
+ADMIN_GROUP = "coordination_team"
+
+UPLOAD_ARCHIVED_DIR = 'upload-backup'
+FILE_UPLOAD_PERMISSIONS = 0o644
+
+#ITSTOOL_PATH = '/usr/local/www/gnomeweb/local/bin/'
+
+# Sentry configuration (needs pip install raven)
+RAVEN_CONFIG = {
+    "dsn": "$SENTRY_DSN"
+}
+
+GITLAB_TOKEN = "$GITLAB_TOKEN"
+VCS_HOME_REGEX = "gitlab\.gnome\.org"


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