Skip to content

Commit 28f6b80

Browse files
version 1.2.1
1 parent a4f548a commit 28f6b80

64 files changed

Lines changed: 5889 additions & 4097 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/.env.destination

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
DB_HOST="db-destination"
2+
PORT=8001
3+
EURYDICE_API=destination
4+
ALLOWED_HOSTS=destination.localhost,backend-destination
5+
CSRF_TRUSTED_ORIGINS=""
6+
DJANGO_MANAGEPY_MIGRATE="on"
7+
METRICS_SLIDING_WINDOW=${METRICS_SLIDING_WINDOW:-60min}
8+
UI_BADGE_CONTENT="Guichet destination"
9+
UI_BADGE_COLOR=${UI_BADGE_COLOR:-#01426a}
10+
PACKET_RECEIVER_HOST="0.0.0.0"
11+
PACKET_RECEIVER_PORT="7000"
12+
RECEIVER_BUFFER_MAX_ITEMS="4"
13+
DBTRIMMER_TRIM_TRANSFERABLES_AFTER="2h"
14+
DBTRIMMER_RUN_EVERY="6h"
15+
DBTRIMMER_POLL_EVERY="200ms"
16+
VITE_PORT="8081"
17+
VITE_EURYDICE_GUICHET="destination"
18+
TRANSFERABLE_STORAGE_DIR="/home/abc/workdir/data/data-storage-destination"

.devcontainer/.env.devcontainer

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# devcontainer env variables
2+
TZ="Europe/Paris"
3+
PATH="/home/abc/workdir/backend/.venv/bin:/home/abc/workdir/frontend/node_modules/.bin:$PATH"
4+
5+
# Docker images configuration
6+
LOCAL_DOCKER_REGISTRY=docker.io
7+
REMOTE_DOCKER_REGISTRY=docker.io
8+
EURYDICE_VERSION=devcontainer
9+
LIDI_VERSION=1.3.5
10+
ELK_VERSION=7.17.11
11+
12+
# Backend configuration
13+
GUNICORN_CONFIGURATION=
14+
CSRF_TRUSTED_ORIGINS=
15+
EURYDICE_TRANSFERABLE_MAX_SIZE=54975581388800
16+
DJANGO_SECRET_KEY=django_secret_key
17+
USER_ASSOCIATION_TOKEN_SECRET_KEY=user_association_token_secret_key
18+
USER_ASSOCIATION_TOKEN_EXPIRES_AFTER=30min
19+
METRICS_SLIDING_WINDOW=60min
20+
REMOTE_USER_HEADER_AUTHENTICATION_ENABLED=true
21+
REMOTE_USER_HEADER=HTTP_X_REMOTE_USER
22+
23+
# Autentication configuration
24+
REMOTE_USER_HEADER=HTTP_X_REMOTE_USER
25+
26+
NODE_ENV=${NODE_ENV:-development}
27+
28+
# Database configuration
29+
DB_NAME=eurydice
30+
DB_USER=eurydice
31+
DB_PASSWORD=eurydice
32+
SHM_SIZE_DATABASE=1g
33+
DB_HOST=db-origin
34+
DB_PORT=5432
35+
36+
# Hostnames configuration
37+
FRONTEND_HOSTNAMES=localhost
38+
BACKEND_HOSTNAMES=localhost
39+
40+
# Server configuration
41+
HTTP_SERVICES_BIND_HOST=127.0.0.1
42+
43+
# Lidi configuration
44+
LIDIR_PORT=6000
45+
LIDIS_PORT=5000
46+
LIDIR_NB_DECODING_THREADS=2
47+
LIDI_UDP_MTU=1500
48+
LIDI_ENCODING_BLOCK_SIZE=60000
49+
LIDI_REPAIR_BLOCK_SIZE=6000
50+
LIDIS_NB_ENCODING_THREADS=2
51+
52+
# Network configuration
53+
EURYDICE_IPV4_SUBNET=172.42.0.0/24
54+
55+
# Backend logging configuration
56+
LOG_TO_FILE=true
57+
LOG_LEVEL=INFO
58+
RUST_LOG=INFO
59+
60+
# File remover configuration
61+
FILE_REMOVER_RUN_EVERY=1min
62+
FILE_REMOVER_EXPIRE_TRANSFERABLES_AFTER=7days
63+
FILE_REMOVER_POLL_EVERY=200ms
64+
65+
# DB trimmer configuration
66+
DBTRIMMER_RUN_EVERY=6h
67+
DBTRIMMER_TRIM_TRANSFERABLES_AFTER=7days
68+
DBTRIMMER_POLL_EVERY=200ms
69+
70+
# Filebeat configuration
71+
FILEBEAT_CONFIG_PATH="./filebeat/filebeat.yml"
72+
ELASTICSEARCH_CERT_PATH="/etc/ssl/certs/ca-certificates.crt"
73+
ELASTICSEARCH_API_KEY=
74+
ELASTICSEARCH_HOSTS=elasticsearch:9200
75+
76+
# Sender configuration
77+
SENDER_RANGE_FILLER_CLASS=UserRotatingTransferableRangeFiller
78+
79+
# Receiver configuration
80+
RECEIVER_BUFFER_MAX_ITEMS=4
81+
82+
# CPU and memory configuration
83+
CPUS_BACKEND=4
84+
CPUS_DBTRIMMER=2
85+
CPUS_FRONTEND=4
86+
CPUS_FILEBEAT=2
87+
CPUS_DATABASE=4
88+
CPUS_SENDER=2
89+
CPUS_LIDIS=4
90+
CPUS_LIDIR=4
91+
CPUS_RECEIVER=2
92+
CPUS_FILE_REMOVER=2
93+
MEM_LIMIT_BACKEND=8GB
94+
MEM_LIMIT_DBTRIMMER=2GB
95+
MEM_LIMIT_FRONTEND=500M
96+
MEM_LIMIT_FILEBEAT=500M
97+
MEM_LIMIT_DATABASE=8GB
98+
MEM_LIMIT_SENDER=6GB
99+
MEM_LIMIT_LIDIS=4GB
100+
MEM_LIMIT_LIDIR=4GB
101+
MEM_LIMIT_RECEIVER=6GB
102+
MEM_LIMIT_FILE_REMOVER=1GB
103+
104+
# Folder configuration
105+
DB_DATA_DIR="./data/db-data"
106+
DB_LOGS_DIR="./data/db-logs"
107+
ORIGIN_TRANSFERABLE_STORAGE_DIR="./data/data-storage-origin"
108+
DESTINATION_TRANSFERABLE_STORAGE_DIR="./data/data-storage-destination"
109+
ORIGIN_DB_DATA_DIR="./data/db-data-origin"
110+
DESTINATION_DB_DATA_DIR="./data/db-data-destination"
111+
ORIGIN_DB_LOGS_DIR="./data/db-logs-origin"
112+
DESTINATION_DB_LOGS_DIR="./data/db-logs-destination"
113+
PYTHON_LOGS_DIR="./data/python-logs"
114+
FILEBEAT_LOGS_DIR="./data/filebeat-logs"
115+
FILEBEAT_DATA_DIR="./data/filebeat-data"
116+
117+
# Transferable history
118+
TRANSFERABLE_HISTORY_DURATION=15min
119+
TRANSFERABLE_HISTORY_SEND_EVERY=1min
120+
121+
# Other
122+
EURYDICE_CONTACT="by mail"
123+
EURYDICE_CONTACT_FR="par mail"
124+
UI_BADGE_CONTENT="Local → Local"
125+
UI_BADGE_COLOR="#01426a"
126+
127+
# backend
128+
DEBUG="True"
129+
DJANGO_ENV=DEV
130+
DJANGO_MANAGEPY_MIGRATE="off"
131+
SECURE_COOKIES="false"
132+
133+
VOLUME_PATHS="/var/log/app"

.devcontainer/.env.origin

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
DB_HOST=db-origin
2+
TRANSFERABLE_MAX_SIZE="54975581388800"
3+
PORT=8000
4+
EURYDICE_API=origin
5+
ALLOWED_HOSTS="origin.localhost,backend-origin"
6+
CSRF_TRUSTED_ORIGINS=""
7+
DJANGO_MANAGEPY_MIGRATE="on"
8+
METRICS_SLIDING_WINDOW=${METRICS_SLIDING_WINDOW:-60min}
9+
UI_BADGE_CONTENT="Guichet origine"
10+
UI_BADGE_COLOR=${UI_BADGE_COLOR:-#01426a}
11+
LIDIS_HOST="lidis.docker.host"
12+
LIDIS_PORT="5000"
13+
SENDER_RANGE_FILLER_CLASS="UserRotatingTransferableRangeFiller"
14+
DBTRIMMER_TRIM_TRANSFERABLES_AFTER="2h"
15+
DBTRIMMER_RUN_EVERY="6h"
16+
DBTRIMMER_POLL_EVERY="200ms"
17+
VITE_PORT="8080"
18+
VITE_EURYDICE_GUICHET="origin"
19+
TRANSFERABLE_STORAGE_DIR="/home/abc/workdir/data/data-storage-origin"

.devcontainer/Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
ARG REGISTRY="docker.io/"
2+
ARG DEBIAN_RELEASE="bullseye"
3+
ARG PYTHON_VERSION="3.10"
4+
5+
FROM ${REGISTRY}python:${PYTHON_VERSION}-${DEBIAN_RELEASE} AS devcontainer
6+
7+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
8+
9+
ARG RUN_PACKAGES="make"
10+
ARG DEV_PACKAGES="shellcheck"
11+
12+
# hadolint ignore=DL3008,DL3013,DL3003
13+
RUN apt-get update \
14+
&& apt-get --no-install-recommends --no-install-suggests --yes --quiet install ${RUN_PACKAGES} ${DEV_PACKAGES} \
15+
&& wget -q -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 \
16+
&& chmod +x /usr/local/bin/hadolint \
17+
&& mkdir /var/log/app \
18+
&& apt-get clean \
19+
&& apt-get --yes --quiet autoremove --purge \
20+
&& rm -rf \
21+
/var/lib/apt/lists/* \
22+
/tmp/* \
23+
/var/tmp/* \
24+
/usr/share/doc/* \
25+
/usr/share/groff/* \
26+
/usr/share/info/* \
27+
/usr/share/linda/* \
28+
/usr/share/lintian/* \
29+
/usr/share/locale/* \
30+
/usr/share/man/*
31+
32+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
33+
34+
COPY .devcontainer/abc.sh /tmp/abc.sh
35+
# hadolint ignore=SC1091
36+
RUN source /tmp/abc.sh && rm -f /tmp/abc.sh
37+
COPY .devcontainer/matchown.sh /usr/local/bin/matchown
38+
RUN chmod +x /usr/local/bin/matchown
39+
COPY .devcontainer/matchown_volumes.sh /usr/local/bin/matchown_volumes
40+
RUN chmod +x /usr/local/bin/matchown_volumes
41+
42+
COPY .devcontainer/nodejs.sh /tmp/nodejs.sh
43+
# hadolint ignore=SC1091
44+
RUN source /tmp/nodejs.sh && rm -f /tmp/nodejs.sh
45+
46+
COPY .devcontainer/devcontainer.sh /tmp/devcontainer.sh
47+
# hadolint ignore=SC1091
48+
RUN source /tmp/devcontainer.sh && rm -f /tmp/devcontainer.sh
49+
50+
COPY .devcontainer/entrypoint.sh /entrypoint
51+
RUN chmod +x /entrypoint
52+
53+
WORKDIR /home/abc/workdir
54+
55+
ENTRYPOINT ["/entrypoint"]
56+
CMD ["sleep", "infinity"]
57+
58+
# backend-origin
59+
EXPOSE 8000
60+
# frontend-origin
61+
EXPOSE 8080
62+
# backend-destination
63+
EXPOSE 8001
64+
# frontend-destination
65+
EXPOSE 8081
66+
# receiver
67+
EXPOSE 7000

.devcontainer/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Devcontainer
2+
3+
<https://containers.dev/implementors/json_reference/>
4+
5+
## Getting started
6+
7+
- run `make clean` to remove old `venv` and `node_modules`
8+
- copy `.env.dev.example` to `.env`
9+
- specify the `PUID` and `PGID` manually, or with this command : `printf "PUID=$(id -u)\nPGID=$(id -g)" >> .env`
10+
- run `make create-dev-volumes`
11+
- then open the devcontainer (`Ctrl + Shift + P` then `Dev Containers: ...`)
12+
- please run the `migrations` tasks before running the services

.devcontainer/abc.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
set -o nounset
6+
# set -o xtrace
7+
8+
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
10+
groupadd --system --gid 1029 abc
11+
useradd --uid 1029 --gid abc --no-log-init --create-home --shell /bin/bash abc
12+
mkdir -p /home/abc/workdir
13+
chown abc:abc /home/abc/workdir
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
include:
2+
- ../compose.dev.yml
3+
4+
services:
5+
devcontainer:
6+
build:
7+
context: ..
8+
dockerfile: .devcontainer/Dockerfile
9+
target: devcontainer
10+
image: eurydice:devcontainer
11+
env_file: ".env.devcontainer"
12+
volumes:
13+
- "../:/home/abc/workdir/"
14+
- "/var/run/docker.sock:/var/run/docker.sock:ro"
15+
labels:
16+
traefik.enable: "true"
17+
# origin backend
18+
traefik.http.routers.backend_origin.rule: Host(`origin.localhost`) && PathPrefix(`/api`, `/admin`, `/static`)
19+
traefik.http.routers.backend_origin.entrypoints: web
20+
traefik.http.routers.backend_origin.service: backend_origin_service
21+
traefik.http.services.backend_origin_service.loadbalancer.server.port: 8000
22+
# origin frontend
23+
traefik.http.routers.frontend_origin.rule: Host(`origin.localhost`)
24+
traefik.http.routers.frontend_origin.entrypoints: web
25+
traefik.http.routers.frontend_origin.service: frontend_origin_service
26+
traefik.http.services.frontend_origin_service.loadbalancer.server.port: 8080
27+
# destination backend
28+
traefik.http.routers.backend_destination.rule: Host(`destination.localhost`) && PathPrefix(`/api`, `/admin`, `/static`)
29+
traefik.http.routers.backend_destination.entrypoints: web
30+
traefik.http.routers.backend_destination.service: backend_destination_service
31+
traefik.http.services.backend_destination_service.loadbalancer.server.port: 8001
32+
# destination frontend
33+
traefik.http.routers.frontend_destination.rule: Host(`destination.localhost`)
34+
traefik.http.routers.frontend_destination.entrypoints: web
35+
traefik.http.routers.frontend_destination.service: frontend_destination_service
36+
traefik.http.services.frontend_destination_service.loadbalancer.server.port: 8081
37+
extra_hosts:
38+
- "lidis.docker.host:${LIDIS_DOCKER_HOST:-host-gateway}"
39+
networks:
40+
- eurydice

.devcontainer/devcontainer.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "Eurydice",
3+
"dockerComposeFile": ["compose.devcontainer.yml"],
4+
"service": "devcontainer",
5+
"initializeCommand": "bash .devcontainer/init.sh",
6+
"postCreateCommand": "bash .devcontainer/setup.sh",
7+
"workspaceFolder": "/home/abc/workdir/",
8+
"remoteUser": "abc",
9+
"forwardPorts": [7000, 8000, 8001, 8080, 8081],
10+
"mounts": [
11+
"source=${localEnv:NPM_CONFIG_USERCONFIG:~/.npmrc},target=/home/abc/.npmrc,type=bind,consistency=cached"
12+
],
13+
"customizations": {
14+
"vscode": {
15+
"settings": {
16+
"python.defaultInterpreterPath": "backend/.venv/bin/python",
17+
"terminal.integrated.defaultProfile.linux": "bash",
18+
"terminal.integrated.shell.linux": "/bin/bash",
19+
"files.exclude": {
20+
"**/__pycache__": true,
21+
"**/.pytest_cache": true,
22+
"**/.coverage": true,
23+
"**/coverage.xml": true,
24+
"**/.venv": true
25+
},
26+
"remote.autoForwardPorts": false,
27+
"dev.containers.mountWaylandSocket": false
28+
},
29+
"extensions": [
30+
"davidanson.vscode-markdownlint",
31+
"dbaeumer.vscode-eslint",
32+
"editorconfig.editorconfig",
33+
"esbenp.prettier-vscode",
34+
"foxundermoon.shell-format",
35+
"gitlab.gitlab-workflow",
36+
"gruntfuggly.todo-tree",
37+
"iulian-radu-at.vscode-tasks-sidebar",
38+
"ms-azuretools.vscode-containers",
39+
"ms-python.black-formatter",
40+
"ms-python.mypy-type-checker",
41+
"ms-python.python",
42+
"ms-python.vscode-pylance",
43+
"ms-toolsai.jupyter",
44+
"ms-vscode.makefile-tools",
45+
"timonwong.shellcheck",
46+
"vue.volar",
47+
"wholroyd.jinja",
48+
"exiasr.hadolint"
49+
]
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)