-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
117 changed files
with
6,078 additions
and
966 deletions.
There are no files selected for viewing
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,12 @@ | ||
.editorconfig | ||
.gitattributes | ||
.github | ||
.gitignore | ||
.gitlab-ci.yml | ||
.idea | ||
.pre-commit-config.yaml | ||
.readthedocs.yml | ||
.travis.yml | ||
venv | ||
.git | ||
.envs/ |
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,4 @@ | ||
# General | ||
# ------------------------------------------------------------------------------ | ||
USE_DOCKER=yes | ||
IPYTHONDIR=/app/.ipython |
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,7 @@ | ||
# PostgreSQL | ||
# ------------------------------------------------------------------------------ | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DB=feedback_linker | ||
POSTGRES_USER=debug | ||
POSTGRES_PASSWORD=debug |
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,34 @@ | ||
# General | ||
# ------------------------------------------------------------------------------ | ||
# DJANGO_READ_DOT_ENV_FILE=True | ||
DJANGO_SETTINGS_MODULE=config.settings.production | ||
DJANGO_SECRET_KEY=rzB5Sl2LAHyQOR5SAKqc0KeJTyUjNYVhd0ovG6H1dGrdvpd2FtZ9phEacFvFcbd0 | ||
DJANGO_ADMIN_URL=Rz4fpz5g02YMT9VXPQ4QMu8J3hoXOIBa/ | ||
DJANGO_ALLOWED_HOSTS=.https://opensciencelabs.github.io/feedback-linker | ||
|
||
# Security | ||
# ------------------------------------------------------------------------------ | ||
# TIP: better off using DNS, however, redirect is OK too | ||
DJANGO_SECURE_SSL_REDIRECT=False | ||
|
||
# ------------------------------------------------------------------------------ | ||
DJANGO_SERVER_EMAIL= | ||
|
||
|
||
# django-allauth | ||
# ------------------------------------------------------------------------------ | ||
DJANGO_ACCOUNT_ALLOW_REGISTRATION=True | ||
|
||
# Gunicorn | ||
# ------------------------------------------------------------------------------ | ||
WEB_CONCURRENCY=4 | ||
|
||
# Sentry | ||
# ------------------------------------------------------------------------------ | ||
SENTRY_DSN= | ||
|
||
|
||
# Redis | ||
# ------------------------------------------------------------------------------ | ||
REDIS_URL=redis://redis:6379/0 |
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,7 @@ | ||
# PostgreSQL | ||
# ------------------------------------------------------------------------------ | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DB=feedback_linker | ||
POSTGRES_USER=debug | ||
POSTGRES_PASSWORD=debug |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.makim.yaml | ||
docs/changelog.md | ||
*.html |
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,51 @@ | ||
version: "3" | ||
|
||
volumes: | ||
feedback_linker_local_postgres_data: {} | ||
feedback_linker_local_postgres_data_backups: {} | ||
|
||
services: | ||
django: | ||
build: | ||
context: . | ||
dockerfile: ./compose/local/django/Dockerfile | ||
image: feedback_linker_local_django | ||
container_name: feedback_linker_local_django | ||
depends_on: | ||
- postgres | ||
volumes: | ||
- .:/app:z | ||
env_file: | ||
- ./.envs/.local/.django | ||
- ./.envs/.local/.postgres | ||
ports: | ||
- "8000:8000" | ||
command: /start | ||
|
||
postgres: | ||
build: | ||
context: . | ||
dockerfile: ./compose/production/postgres/Dockerfile | ||
image: feedback_linker_production_postgres | ||
container_name: feedback_linker_local_postgres | ||
volumes: | ||
- feedback_linker_local_postgres_data:/var/lib/postgresql/data | ||
- feedback_linker_local_postgres_data_backups:/backups | ||
env_file: | ||
- ./.envs/.local/.postgres | ||
|
||
docs: | ||
image: feedback_linker_local_docs | ||
container_name: feedback_linker_local_docs | ||
build: | ||
context: . | ||
dockerfile: ./compose/local/docs/Dockerfile | ||
env_file: | ||
- ./.envs/.local/.django | ||
volumes: | ||
- ./docs:/docs:z | ||
- ./config:/app/config:z | ||
- ./feedback_linker:/app/feedback_linker:z | ||
ports: | ||
- "9000:9000" | ||
command: /start-docs |
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,61 @@ | ||
version: "3" | ||
|
||
volumes: | ||
production_postgres_data: {} | ||
production_postgres_data_backups: {} | ||
production_traefik: {} | ||
production_django_media: {} | ||
|
||
services: | ||
django: | ||
build: | ||
context: . | ||
dockerfile: ./compose/production/django/Dockerfile | ||
|
||
image: feedback_linker_production_django | ||
volumes: | ||
- production_django_media:/app/feedback_linker/media | ||
depends_on: | ||
- postgres | ||
- redis | ||
env_file: | ||
- ./.envs/.production/.django | ||
- ./.envs/.production/.postgres | ||
command: /start | ||
|
||
postgres: | ||
build: | ||
context: . | ||
dockerfile: ./compose/production/postgres/Dockerfile | ||
image: feedback_linker_production_postgres | ||
volumes: | ||
- production_postgres_data:/var/lib/postgresql/data | ||
- production_postgres_data_backups:/backups | ||
env_file: | ||
- ./.envs/.production/.postgres | ||
|
||
traefik: | ||
build: | ||
context: . | ||
dockerfile: ./compose/production/traefik/Dockerfile | ||
image: feedback_linker_production_traefik | ||
depends_on: | ||
- django | ||
volumes: | ||
- production_traefik:/etc/traefik/acme | ||
ports: | ||
- "0.0.0.0:80:80" | ||
- "0.0.0.0:443:443" | ||
|
||
redis: | ||
image: docker.io/redis:6 | ||
|
||
nginx: | ||
build: | ||
context: . | ||
dockerfile: ./compose/production/nginx/Dockerfile | ||
image: feedback_linker_local_nginx | ||
depends_on: | ||
- django | ||
volumes: | ||
- production_django_media:/usr/share/nginx/media:ro |
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,82 @@ | ||
|
||
# define an alias for the specific python version used in this file. | ||
FROM docker.io/python:3.11.8-slim-bookworm as python | ||
|
||
# Python build stage | ||
FROM docker.io/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 pip wheel --wheel-dir /usr/src/app/wheels \ | ||
-r ${BUILD_ENVIRONMENT}.txt | ||
|
||
|
||
# Python 'run' stage | ||
FROM docker.io/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 \ | ||
# 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 pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ | ||
&& rm -rf /wheels/ | ||
|
||
|
||
COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint | ||
RUN sed -i 's/\r$//g' /entrypoint | ||
RUN chmod +x /entrypoint | ||
|
||
|
||
COPY --chown=django:django ./compose/production/django/start /start | ||
RUN sed -i 's/\r$//g' /start | ||
RUN chmod +x /start | ||
|
||
|
||
# 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} | ||
|
||
USER django | ||
|
||
RUN DATABASE_URL="" \ | ||
DJANGO_SETTINGS_MODULE="config.settings.test" \ | ||
python manage.py compilemessages | ||
|
||
ENTRYPOINT ["/entrypoint"] |
Oops, something went wrong.