-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from zacharlie/develop
- Loading branch information
Showing
21 changed files
with
261 additions
and
199 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ | |
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.common.BrokenLinkEmailsMiddleware", | ||
# "django.middleware.common.BrokenLinkEmailsMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
"django_htmx.middleware.HtmxMiddleware", | ||
] | ||
|
@@ -249,7 +249,8 @@ | |
# Django Admin URL. | ||
ADMIN_URL = "admin/" | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#admins | ||
ADMINS = [("""Kartoza""", "[email protected]")] | ||
# ADMINS = [("""Kartoza""", "[email protected]")] | ||
ADMINS = [("""Charlie""", "[email protected]")] | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#managers | ||
MANAGERS = ADMINS | ||
|
||
|
@@ -302,11 +303,13 @@ | |
# ------------------------------------------------------------------------------ | ||
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True) | ||
# https://django-allauth.readthedocs.io/en/latest/configuration.html | ||
ACCOUNT_AUTHENTICATION_METHOD = "username" | ||
# ACCOUNT_AUTHENTICATION_METHOD = "username" | ||
ACCOUNT_AUTHENTICATION_METHOD = "username_email" | ||
# https://django-allauth.readthedocs.io/en/latest/configuration.html | ||
ACCOUNT_EMAIL_REQUIRED = True | ||
# https://django-allauth.readthedocs.io/en/latest/configuration.html | ||
ACCOUNT_EMAIL_VERIFICATION = "mandatory" | ||
# ACCOUNT_EMAIL_VERIFICATION = "mandatory" | ||
ACCOUNT_EMAIL_VERIFICATION = "none" | ||
# https://django-allauth.readthedocs.io/en/latest/configuration.html | ||
ACCOUNT_ADAPTER = "geodata_mart.users.adapters.AccountAdapter" | ||
# https://django-allauth.readthedocs.io/en/latest/forms.html | ||
|
@@ -345,7 +348,7 @@ | |
"SERVE_PERMISSIONS": ["rest_framework.permissions.AllowAny"], | ||
"SERVERS": [ | ||
{"url": "http://127.0.0.1:8000", "description": "Local Development server"}, | ||
{"url": "https://geodata.kartoza.com", "description": "Production server"}, | ||
{"url": "https://data.kartoza.com", "description": "Production server"}, | ||
], | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# ARG PYTHON_VERSION=3.9-slim-bullseye | ||
|
||
# define an alias for the specfic python version used in this file. | ||
# FROM python:${PYTHON_VERSION} as python | ||
|
||
FROM qgis/qgis:final-3_22_8 as python | ||
|
||
# Alias the python command with the interpreter used with qgis | ||
# note RUN alias python="/usr/bin/python3" will not work between build steps | ||
# https://github.com/docker-library/python/blob/master/Dockerfile-linux.template#L278 | ||
# https://stackoverflow.com/questions/60383262/setting-alias-in-dockerfile-not-working-command-not-found#60383287 | ||
RUN cd "$(dirname $(which python3))" \ | ||
&& ln -s python3 python \ | ||
&& ln -s python3-config python-config | ||
|
||
# Python build stage | ||
FROM python as python-build-stage | ||
|
||
ARG BUILD_ENVIRONMENT=production | ||
|
||
# Install apt packages | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# dependencies for building Python packages | ||
build-essential \ | ||
# psycopg2 dependencies | ||
libpq-dev | ||
|
||
# Requirements are installed here to ensure they will be cached. | ||
COPY ./requirements . | ||
|
||
# Create Python Dependency and Sub-Dependency Wheels. | ||
RUN python -m pip wheel --wheel-dir /usr/src/app/wheels \ | ||
-r ${BUILD_ENVIRONMENT}.txt | ||
|
||
|
||
# Python 'run' stage | ||
FROM python as python-run-stage | ||
|
||
ARG BUILD_ENVIRONMENT=production | ||
ARG APP_HOME=/app | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV BUILD_ENV ${BUILD_ENVIRONMENT} | ||
|
||
WORKDIR ${APP_HOME} | ||
|
||
RUN addgroup --system django \ | ||
&& adduser --system --ingroup django django | ||
|
||
|
||
# Install required system dependencies | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# psycopg2 dependencies | ||
libpq-dev \ | ||
# Translations dependencies | ||
gettext \ | ||
# install additional app dependencies | ||
libmagic1 \ | ||
# cleaning up unused files | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction | ||
# copy python dependency wheels from python-build-stage | ||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/ | ||
|
||
# use wheels to install python dependencies | ||
RUN python -m pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ | ||
&& rm -rf /wheels/ | ||
|
||
|
||
COPY --chown=django:django ./docker/production/entrypoint /entrypoint | ||
RUN sed -i 's/\r$//g' /entrypoint | ||
RUN chmod +x /entrypoint | ||
|
||
|
||
COPY --chown=django:django ./docker/production/start /start | ||
RUN sed -i 's/\r$//g' /start | ||
RUN chmod +x /start | ||
COPY --chown=django:django ./docker/production/celery/worker/start /start-celeryworker | ||
RUN sed -i 's/\r$//g' /start-celeryworker | ||
RUN chmod +x /start-celeryworker | ||
|
||
|
||
COPY --chown=django:django ./docker/production/celery/beat/start /start-celerybeat | ||
RUN sed -i 's/\r$//g' /start-celerybeat | ||
RUN chmod +x /start-celerybeat | ||
|
||
|
||
COPY ./docker/production/celery/flower/start /start-flower | ||
RUN sed -i 's/\r$//g' /start-flower | ||
RUN chmod +x /start-flower | ||
|
||
|
||
# copy application code to WORKDIR | ||
COPY --chown=django:django . ${APP_HOME} | ||
|
||
# make django owner of the WORKDIR directory as well. | ||
RUN chown django:django ${APP_HOME} | ||
|
||
ENTRYPOINT ["/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.