diff --git a/containers/lgr-django/files/requirements.txt b/containers/lgr-django/files/requirements.txt index 159c4ad3..3152d302 100644 --- a/containers/lgr-django/files/requirements.txt +++ b/containers/lgr-django/files/requirements.txt @@ -2,7 +2,6 @@ Django==3.1.7 django-widget-tweaks==1.4.8 celery[redis]==5.0.5 -#django-redis==4.12.1 django-redis @ git+https://github.com/jazzband/django-redis.git@683ebcf16a5c342d9794552c9897c8baa2d6b0be django-autocomplete-light==3.5.1 vine==5.0.0 @@ -14,5 +13,9 @@ django-celery-beat==2.2.0 picu==1.2 munidata==2.1.0 lgr-core @ git+https://github.com/icann/lgr-core.git@v4.0.2 + # Natural sorting implementation natsort==7.1.1 + +# OAuth support +social-auth-app-django==5.0.0 diff --git a/dev/README.md b/dev/README.md new file mode 100644 index 00000000..9dd84577 --- /dev/null +++ b/dev/README.md @@ -0,0 +1,82 @@ +# LGR-Tool local development deployment + +## About + +This tool will permit to recreate mostly fatefully the ICANN production +environement in local container deploy with docker-compose instead of helm. + +Of course as it is not a K8S environement many ajustement had to be made to +make everything possible. There is the exaustive list of change: + +- No daily manage.py cronjob for DB cleanup +- No Helm/K8S deployement (Obviously) +- Use a MariaDB container instead of a localy shared sqlite DB +- Use a Redis container instead of a Redis Sentinel Cluster + +## Warning + +To permit a simple local deployment for developement purpose, spoof password +have been put in plain text inside the configuration files. This is NOT a good +production pratice and therefore THIS DEPLOYEMENT SCRIPT SHOULD NEVER BE USE IN +A PRODUCTION ENVIRONEMENT. At least not without removing plain text password +before hand. + +## Requirement + +Everything run in docker containers and is manage with the docker-compose +script so the requirement are: + +- Docker service (accesible by the user) +- docker-compose script + +## Use + +The deployment process is very simple and is actualy pretty easy to use. + +``` +#Execute the lgr container build script +./dockerbuild.sh +#This step should take around 30 minutes and 1 hour the first time. +#The subsequent build should be about a minute as docker had now a build cache + +#Start all the lgr microservice +docker-compose up -d + +# The startup process can take about a minute the first time + +#Create SuperUser (only on the first time) +docker exec lgr-gunicorn ../manage.py createsuperuser --noinput --email=eng@viagenie.ca +``` + +Open a browser to http://localhost:8080 and log in with: +- email: eng@viagenie.ca +- password: 1234 + +## Update container code + +When new code need to be push inside de container, they need to be rebuild with +the new code and the currently running container change with the new image. +``` +#Rebuild container (Should be fast if docker build cache still intact) +./dockerbuild.sh + +#Reload the new container +docker-compose up -d +``` + +## Cleanup + +Once finish some step are needed to remove all trace on the host computer +``` +#Stop and destroy lgr container +docker-compose down + +#Remove lgr images +docker image rm lgr-base lgr-django lgr-celery lgr-gunicorn lgr-static + +#Remove dependancy images +docker image rm centos:8 redis traefik mariadb + +#Remove persitants volumes +docker volume rm dev_lgr-redis dev_lgr-maria dev_lgr-storage +``` diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml new file mode 100644 index 00000000..0f547cf3 --- /dev/null +++ b/dev/docker-compose.yml @@ -0,0 +1,110 @@ +version: '3.9' +services: + + lgr-reverseproxy: + container_name: lgr-reverseproxy + image: traefik:latest + restart: unless-stopped + command: + - "--providers.docker=true" + - "--api.dashboard=true" + - "--entrypoints.http.address=:8080" + ports: + - "8080:8080" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + labels: + - "traefik.http.routers.lgr-reverseproxy.entrypoints=http" + - "traefik.http.routers.lgr-reverseproxy.rule=(Host(`localhost`) && PathPrefix(`/reverseproxy`))" + - "traefik.http.routers.lgr-reverseproxy.service=api@internal" + + lgr-maria: + container_name: lgr-maria + image: mariadb:latest + restart: unless-stopped + volumes: + - lgr-maria:/var/lib/mysql + environment: + MARIADB_RANDOM_ROOT_PASSWORD: 'yes' + MARIADB_DATABASE: lgr + MARIADB_USER: lgr + #Please don't use Plain password in any kind of production environement + MARIADB_PASSWORD: UNSECURE_DEV_PWD + + lgr-redis: + container_name: lgr-redis + image: redis:latest + restart: unless-stopped + volumes: + - lgr-redis:/data + command: + - "redis-server" + - "--appendonly yes" + + lgr-gunicorn: + container_name: lgr-gunicorn + image: lgr-gunicorn:latest + restart: unless-stopped + volumes: + - lgr-storage:/var/www/lgr/src/lgr_web/storage + environment: + lgrURL: localhost + lgrMariaDB: lgr + #The email system won't work in dev, but value must be set + lgrEmail: not@working.org + lgrMariaUser: lgr + #Please don't use Plain password in any kind of production environement + lgrMariaPwd: UNSECURE_DEV_PWD + lgrMariaHost: lgr-maria + lgrRedisHost: lgr-redis + lgrRedisPort: 6379 + #Again, don't use Plain password in any kind of production environement + lgrSecretKey: UNSECURE_SECRET_KEY + labels: + - "traefik.http.routers.lgr-gunicorn.entrypoints=http" + - "traefik.http.routers.lgr-gunicorn.rule=Host(`localhost`)" + + lgr-celery: + container_name: lgr-celery + image: lgr-celery:latest + restart: unless-stopped + volumes: + - lgr-storage:/var/www/lgr/src/lgr_web/storage + environment: + lgrURL: localhost + lgrMariaDB: lgr + #The email system won't work in dev, but value must be set + lgrEmail: not@working.org + lgrMariaUser: lgr + #Please don't use Plain password in any kind of production environement + lgrMariaPwd: UNSECURE_DEV_PWD + lgrMariaHost: lgr-maria + lgrRedisHost: lgr-redis + lgrRedisPort: 6379 + #Again, don't use Plain password in any kind of production environement + lgrSecretKey: UNSECURE_SECRET_KEY + + lgr-static: + container_name: lgr-static + image: lgr-static:latest + restart: unless-stopped + environment: + lgrURL: localhost + lgrMariaDB: lgr + #The email system won't work in dev, but value must be set + lgrEmail: not@working.org + lgrMariaUser: lgr + #Please don't use Plain password in any kind of production environement + lgrMariaPwd: UNSECURE_DEV_PWD + lgrMariaHost: lgr-maria + lgrRedisHost: lgr-redis + lgrRedisPort: 6379 + #Again, don't use Plain password in any kind of production environement + lgrSecretKey: UNSECURE_SECRET_KEY + labels: + - "traefik.http.routers.lgr-static.entrypoints=http" + - "traefik.http.routers.lgr-static.rule=(Host(`localhost`) && PathPrefix(`/static`))" +volumes: + lgr-storage: + lgr-maria: + lgr-redis: diff --git a/dev/dockerbuild.sh b/dev/dockerbuild.sh new file mode 100755 index 00000000..bebde720 --- /dev/null +++ b/dev/dockerbuild.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +#Build container and follow logical link in the build process +Containers="lgr-base lgr-django lgr-gunicorn lgr-celery lgr-static" +#Containers="lgr-django lgr-gunicorn lgr-celery lgr-static" + +for it in $Containers +do + #So the logical links files are followed + tar -ch -C $it . | docker build -t $it - +done diff --git a/dev/lgr-base/Dockerfile b/dev/lgr-base/Dockerfile new file mode 100644 index 00000000..5354ca22 --- /dev/null +++ b/dev/lgr-base/Dockerfile @@ -0,0 +1,6 @@ +FROM centos:8 +LABEL MAINTAINER marc.blanchet@viagenie.ca +USER root + +COPY lgr-base.sh . +RUN ./lgr-base.sh && rm lgr-base.sh diff --git a/dev/lgr-base/lgr-base.sh b/dev/lgr-base/lgr-base.sh new file mode 100755 index 00000000..01bc5c0c --- /dev/null +++ b/dev/lgr-base/lgr-base.sh @@ -0,0 +1,213 @@ +#!/bin/sh + +# As lgr-django is a complex installation process. A shell script is more easy +# to read and modify + +# Criticaly exit script if one command in error +set -e + +# VARIABLE DECLARATION +## pythonMinor version set the python minor version (ex.: 3.7) +pythonMinorVersion='3.7' +## unicodeURL set the repository git use for cloning +unicodeURL='https://github.com/unicode-org/icu.git' +lgrBaseDir='/var/www/lgr' +lgrPersistantDir='storage' + +## Get the last patch version for the specify python version +pythonPatchVersion=$( curl -s https://www.python.org/ftp/python/ | \ + cut -d \" -f 2 | \ + sed 's|/||g' | \ + grep $pythonMinorVersion. | \ + sort -V | \ + tail -1 ) + +## pythonURL is the URL where the python source file are located +pythonURL="https://www.python.org/ftp/python/$pythonPatchVersion/Python-$pythonPatchVersion.tar.xz" + +## buildDir will contain all file needed to compile application +buildDir=$(mktemp -d) + + +# INTALLATION & CONFIGURATION +printf "Phase1: Install required applications\n" + +printf "\tInstall basic tools of the ICANN image\t" + +dnf -qy install \ + wget \ + git + +printf "OK\n" + +printf "\tInstall compilation tools\t" +# Install compilation tools for django and icu4c +dnf -qy install --enablerepo powertools \ + "@development tools" \ + bzip2-devel \ + ncurses-devel \ + sqlite-devel \ + readline-devel \ + tk-devel \ + gdbm-devel \ + libdb-devel \ + libpcap-devel \ + xz-devel \ + expat-devel \ + zlib-devel \ + openssl-devel \ + mysql-devel \ + python3-devel \ + libffi-devel + +printf "OK\n" + + +printf "\tInstall the various lgr-django dependancies\t" +# Install various dependancies for lg-django +dnf -qy install \ + libxml2 \ + libicu \ + tcl + +printf "OK\n" + + +printf "\tInstall lgr-django python dependancy\t" +# Download latest path for the define minor version of python +wget $pythonURL -qO $buildDir/python.tar.xz + +# Unpack the tar file +tar -xf $buildDir/python.tar.xz -C $buildDir + +# Compile & install python +cd $buildDir/Python-$pythonPatchVersion +./configure -q --enable-optimizations +make -s altinstall &>/dev/null +cd ~ + +# Create genericly named link to execute python +ln -s /usr/local/bin/python$pythonMinorVersion /usr/local/bin/python + +# Validate python installation +/usr/local/bin/python -V | grep -q $pythonPatchVersion + +printf "OK\n" + +printf "\tFix xlocale.h library\t" +# Link the locale.h library to the xlocale.h +ln -sf /usr/include/locale.h /usr/include/xlocale.h +printf "OK\n" + +printf "\tInstall lgr-django unicodes dependancies\n" +# Clone unicode repository +git clone -q $unicodeURL $buildDir/icu + +# unicodeVersions define all unicode version use in LGR +unicodeVersion=" + 6.3.0 + 6.0.0 + 6.1.0 + 6.2.0 + 7.0.0 + 8.0.0 + 9.0.0 + 10.0.0" + +# Compile every icu4c version from the local LGR git repo +for i in $unicodeVersion +do + #Clean previous build + git -C $buildDir/icu clean --quiet -d -fx + case $i in + 6.0.0) + icu4cBuildPath="$buildDir/icu/build" + unicodeTag=46 + unicodeRelease='icu-maint/maint-4-6' + ;; + 6.1.0) + icu4cBuildPath="$buildDir/icu/build" + unicodeTag=49 + unicodeRelease='icu-maint/maint-49' + ;; + 6.2.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=50 + unicodeRelease='release-50-1-2' + ;; + 6.3.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=52 + unicodeRelease='release-52-1' + ;; + 7.0.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=54 + unicodeRelease='release-54-1' + ;; + 8.0.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=56 + unicodeRelease='release-56-1' + ;; + 9.0.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=58 + unicodeRelease='release-58-2' + ;; + 10.0.0) + icu4cBuildPath="$buildDir/icu/icu4c/build" + unicodeTag=60 + unicodeRelease='release-60-2' + ;; + *) + # Should never happend as no external input is used + exit 1 + ;; + esac + printf "\t\tBuild icu4c-$i\t" + # Checkout in the good branch + git -C $buildDir/icu checkout --quiet $unicodeRelease + # Create the build directory and ... + mkdir $icu4cBuildPath + cd $icu4cBuildPath + # Build inside it + ../source/runConfigureICU Linux &>/dev/null + make &>/dev/null + make install &>/dev/null + #../source/runConfigureICU Linux + #make + #make install + # Return to the home directory + cd ~ + printf "OK\n" +done + +printf "\tAdd Unicode shared library path\t" +# So that LGR can use the icu4c library +echo '/usr/local/lib' > /etc/ld.so.conf.d/lgr.conf +printf "OK\n" + +printf "\nPhase2: Cleanup files and unused production application\n" +# Clean up unuse file and application to lower the docker size +printf "\tRemove Build Directory\t" +rm -fr $buildDir +printf "OK\n" +printf "\tRemove compilation tools\t" +dnf -qy remove --enablerepo powertools \ + bzip2-devel \ + ncurses-devel \ + sqlite-devel \ + readline-devel \ + tk-devel \ + gdbm-devel \ + libdb-devel \ + libpcap-devel \ + xz-devel \ + expat-devel \ + libffi-devel +printf "OK\n" +printf "\tClean up dnf cache files\t" +dnf -qy clean all +rm -fr /var/cache/dnf +printf "OK\n" diff --git a/dev/lgr-celery/Dockerfile b/dev/lgr-celery/Dockerfile new file mode 100644 index 00000000..d175ae05 --- /dev/null +++ b/dev/lgr-celery/Dockerfile @@ -0,0 +1,11 @@ +FROM lgr-django:latest +LABEL MAINTAINER marc.blanchet@viagenie.ca + +# Set gunicorn configuration +ENV APP="lgr_web" + +COPY celeryInit.sh /usr/local/bin/ + +WORKDIR $BASE_DIR/src +ENTRYPOINT ["celeryInit.sh"] +CMD ["worker", "-c", "2", "--time-limit=300000", "--soft-time-limit=300000"] diff --git a/dev/lgr-celery/celeryInit.sh b/dev/lgr-celery/celeryInit.sh new file mode 120000 index 00000000..342f5b0d --- /dev/null +++ b/dev/lgr-celery/celeryInit.sh @@ -0,0 +1 @@ +../../containers/lgr-celery/celeryInit.sh \ No newline at end of file diff --git a/dev/lgr-django/Dockerfile b/dev/lgr-django/Dockerfile new file mode 100644 index 00000000..f63c7bb5 --- /dev/null +++ b/dev/lgr-django/Dockerfile @@ -0,0 +1,42 @@ +FROM lgr-base:latest +LABEL MAINTAINER marc.blanchet@viagenie.ca + +# Set used variables +ENV BASE_DIR=/var/www/lgr +ENV LOG_DIR=/var/log/lgr + +# Create lgr user and base directory +USER root +RUN useradd -r -d $BASE_DIR -M -g 0 -u 30404 lgr +RUN mkdir -p $BASE_DIR && chown lgr:0 $BASE_DIR +RUN mkdir -p $LOG_DIR && chown lgr:0 $LOG_DIR + +# Copy files directory +COPY files $BASE_DIR +RUN mkdir $BASE_DIR/src/lgr_web/storage; chown -R lgr:0 $BASE_DIR + +# Start LGR installation + +USER lgr +WORKDIR $BASE_DIR + +# Copy local setting +RUN mv 'local.py' 'src/lgr_web/settings' + +# Prepare python virtual environement +RUN /usr/local/bin/python -m venv venv +ENV PATH="$BASE_DIR/venv/bin:$PATH" +ENV LD_LIBRARY_PATH="/usr/local/lib" + +# Install/upgrade pip +RUN python -m pip install --upgrade pip + +# Install lgr-django requirements +RUN pip install -r requirements.txt && rm requirements.txt + +# Install mysql requirement +RUN pip install mysqlclient + +# Set Django SUPERUSER password +# NEVER DO THIS IN PRODUCTION ENVIRONMENT +ENV DJANGO_SUPERUSER_PASSWORD=1234 diff --git a/dev/lgr-django/files/local.py b/dev/lgr-django/files/local.py new file mode 100644 index 00000000..ffb5c376 --- /dev/null +++ b/dev/lgr-django/files/local.py @@ -0,0 +1,139 @@ +from .default import * + +# Template for deployment configuration +# Contains sensible default for production use + +DEBUG = True + +# TODO: Set this list to hosts/domains served by this app +# See https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-ALLOWED_HOSTS +ALLOWED_HOSTS = [ os.environ.get('lgrURL') ] + +# Uncomment if you are not using HTTPS +SESSION_COOKIE_SECURE = False +CSRF_COOKIE_SECURE = False + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +MEDIA_ROOT = os.path.join(BASE_DIR, 'storage', 'media') +TOOLS_OUTPUT_STORAGE_LOCATION = os.path.join(BASE_DIR, 'storage', 'output', 'tools') +IDN_REVIEW_USER_OUTPUT_STORAGE_LOCATION = os.path.join(BASE_DIR, 'storage', 'output', 'idn_review', 'user') +IDN_REVIEW_ICANN_OUTPUT_STORAGE_LOCATION = os.path.join(BASE_DIR, 'storage', 'output', 'idn_review', 'icann') + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': os.environ.get('lgrMariaDB'), + 'USER': os.environ.get('lgrMariaUser'), + 'PASSWORD': os.environ.get('lgrMariaPwd'), + 'HOST': os.environ.get('lgrMariaHost'), + 'PORT': os.environ.get('lgrMariaPort'), + } +} + +CACHES = { + 'default': { + "BACKEND": "django_redis.cache.RedisCache", + # DB 0 is used for Celery broker + 'LOCATION': 'redis://' + os.environ.get('lgrRedisHost') + ':' + os.environ.get('lgrRedisPort') + '/1', + } +} + +BROKER_URL = 'redis://' + os.environ.get('lgrRedisHost') + ':' + os.environ.get('lgrRedisPort') + '/0' + +##### e-mail settings ##### +# The host for the use of sending email (default: localhost) +#EMAIL_HOST = 'localhost' + +# Port to use for the SMTP server defined above (default: 25) +#EMAIL_PORT = 25 + +# Username to use for the SMTP server defined in EMAIL_HOST +#EMAIL_HOST_USER + +# Password to use for the SMTP server defined in EMAIL_HOST +#EMAIL_HOST_PASSWORD + +# Whether to use a TLS (secure) connection when talking to the SMTP server +#EMAIL_USE_TLS = True +# Whether to use an implicit TLS (secure) connection when talking to the SMTP server +#EMAIL_USE_SSL = True + +# Default email address to use (default: 'webmaster@localhost') +DEFAULT_FROM_EMAIL = os.environ.get('lgrEmail') +##### /e-mail settings ##### + +##### LGR Toolset Project-specific settings ##### +SUPPORTED_UNICODE_VERSIONS = ( + '6.3.0', + '6.0.0', + '6.1.0', + '6.2.0', + '7.0.0', + '8.0.0', + '9.0.0', + '10.0.0' +) + +# UNICODE_DATABASES tells munidata how to instantiate the implementation of each Unicode version that we support. +# Keys are the Unicode version, like '6.3.0' +# Values are a dict of the kwargs to pass to the munidata.manager.register function along with the version. +# Currently, we assume that the underlying implementation is "picu", so the value should have the following keys: +# - icu_uc_lib: full path to the libicuuc.so file +# - icu_i18n_lib': full path to the libicui18n.so file +# - version_tag: version tag used in the function symbols in the above libraries (usually the ICU major version) +# See picu.loader.KNOWN_ICU_VERSIONS + +UNICODE_DATABASES = { + '6.3.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.52', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.52', + 'version_tag': 52, + }, + '6.0.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.46', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.46', + 'version_tag': 46, + }, + '6.1.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.49', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.49', + 'version_tag': 49, + }, + '6.2.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.50', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.50', + 'version_tag': 50, + }, + '7.0.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.54', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.54', + 'version_tag': 54, + }, + '8.0.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.56', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.56', + 'version_tag': 56, + }, + '9.0.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.58', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.58', + 'version_tag': 58, + }, + '10.0.0': { + 'icu_uc_lib': '/usr/local/lib/libicuuc.so.60', + 'icu_i18n_lib': '/usr/local/lib/libicui18n.so.60', + 'version_tag': 60, + } +} +##### /LGR Toolset Project-specific settings ##### + +# DELETE_FROM_HERE_AFTER_GENERATION +#if SECRET_KEY == 'PLEASE GENERATE ONE': +# import os +# thisfile = __file__[:-1] if __file__.endswith('pyc') else __file__ +# path = os.path.join(os.path.dirname(thisfile), '..', '..', '..', 'bin', 'gen_secret_key') +# exec(open(path).read()) +# secret_key = write_secret_key(thisfile) # overwrite me +# SECRET_KEY = secret_key +# DELETE_TO_HERE_AFTER_GENERATION +SECRET_KEY = os.environ.get('lgrSecretKey') diff --git a/dev/lgr-django/files/manage.py b/dev/lgr-django/files/manage.py new file mode 120000 index 00000000..0cbfd272 --- /dev/null +++ b/dev/lgr-django/files/manage.py @@ -0,0 +1 @@ +../../../manage.py \ No newline at end of file diff --git a/dev/lgr-django/files/requirements.txt b/dev/lgr-django/files/requirements.txt new file mode 120000 index 00000000..258b80d9 --- /dev/null +++ b/dev/lgr-django/files/requirements.txt @@ -0,0 +1 @@ +../../../containers/lgr-django/files/requirements.txt \ No newline at end of file diff --git a/dev/lgr-django/files/src b/dev/lgr-django/files/src new file mode 120000 index 00000000..dabb0e15 --- /dev/null +++ b/dev/lgr-django/files/src @@ -0,0 +1 @@ +../../../src \ No newline at end of file diff --git a/dev/lgr-gunicorn/Dockerfile b/dev/lgr-gunicorn/Dockerfile new file mode 100644 index 00000000..47719298 --- /dev/null +++ b/dev/lgr-gunicorn/Dockerfile @@ -0,0 +1,18 @@ +FROM lgr-django:latest +LABEL MAINTAINER marc.blanchet@viagenie.ca + +# Install gunicorn +RUN pip install gunicorn + +# Set gunicorn configuration +ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0" +ENV GUNICORN_CMD_ARGS="$GUNICORN_CMD_ARGS -w 3" +ENV GUNICORN_CMD_ARGS="$GUNICORN_CMD_ARGS -t 300" +ENV GUNICORN_CMD_ARGS="$GUNICORN_CMD_ARGS --max-requests 100" + +COPY gunicornInit.sh /usr/local/bin/ + +EXPOSE 8000 +WORKDIR $BASE_DIR/src +ENTRYPOINT ["gunicornInit.sh"] +CMD ["lgr_web.wsgi:application"] diff --git a/dev/lgr-gunicorn/gunicornInit.sh b/dev/lgr-gunicorn/gunicornInit.sh new file mode 120000 index 00000000..a08272ad --- /dev/null +++ b/dev/lgr-gunicorn/gunicornInit.sh @@ -0,0 +1 @@ +../../containers/lgr-gunicorn/gunicornInit.sh \ No newline at end of file diff --git a/dev/lgr-static/Dockerfile b/dev/lgr-static/Dockerfile new file mode 100644 index 00000000..d604e66e --- /dev/null +++ b/dev/lgr-static/Dockerfile @@ -0,0 +1,18 @@ +FROM lgr-django:latest +LABEL MAINTAINER marc.blanchet@viagenie.ca + +USER root +# Install nginx +RUN yum -y update; yum install -y nginx + +# Set output to the stdout for easy grab for easy loggin +RUN sed -i 's|error_log /var/log/nginx/error.log;|error_log /dev/stdout info;|' /etc/nginx/nginx.conf +RUN sed -i 's|access_log /var/log/nginx/access.log main;|access_log /dev/stdout;|' /etc/nginx/nginx.conf + +COPY staticInit.sh /usr/local/bin/ +COPY lgr-static.conf /etc/nginx/default.d/ + +EXPOSE 80 +WORKDIR $BASE_DIR/src +ENTRYPOINT ["staticInit.sh"] +CMD ["-g", "daemon off;"] diff --git a/dev/lgr-static/lgr-static.conf b/dev/lgr-static/lgr-static.conf new file mode 120000 index 00000000..70e49b78 --- /dev/null +++ b/dev/lgr-static/lgr-static.conf @@ -0,0 +1 @@ +../../containers/lgr-static/lgr-static.conf \ No newline at end of file diff --git a/dev/lgr-static/staticInit.sh b/dev/lgr-static/staticInit.sh new file mode 120000 index 00000000..cb15944f --- /dev/null +++ b/dev/lgr-static/staticInit.sh @@ -0,0 +1 @@ +../../containers/lgr-static/staticInit.sh \ No newline at end of file