mirror of
https://github.com/IliesAllali/parenthese.git
synced 2026-11-06 23:32:08 +00:00
Docker : le front lit l'adresse de l'API dans API_UPSTREAM
Le conteneur web relayait l'API vers `api:4000`, écrit en dur. Sur un réseau partagé entre plusieurs applications (Umbrel), ce nom peut appartenir à une autre. L'adresse vient maintenant de API_UPSTREAM, `api:4000` par défaut : rien ne change pour les installations existantes. L'image tout-en-un garde sa propre configuration. La CI lance un second front qui joint l'API par le nom de son conteneur et repasse le test de fumée. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b774b1dff8
commit
333a11e84b
5 files changed
+26
-4
No files matched your search
@@ -182,15 +182,29 @@ jobs:
|
|||||||
- name: Test de fumée par le port web
|
- name: Test de fumée par le port web
|
||||||
run: bash tools/docker-smoke.sh http://localhost:8080
|
run: bash tools/docker-smoke.sh http://localhost:8080
|
||||||
|
|
||||||
|
# Un second front qui joint l'API par le nom de son conteneur (API_UPSTREAM), comme sur Umbrel.
|
||||||
|
- name: Front avec une autre adresse d'API
|
||||||
|
run: |
|
||||||
|
WEB_IMAGE="$(docker compose config --images | grep parenthese-web)"
|
||||||
|
API_CONTAINER="$(docker compose ps -q api | xargs docker inspect -f '{{.Name}}' | tr -d /)"
|
||||||
|
docker run -d --name web-upstream --network parenthese_default -p 8081:80 \
|
||||||
|
-e API_UPSTREAM="$API_CONTAINER:4000" "$WEB_IMAGE"
|
||||||
|
sleep 3
|
||||||
|
docker exec web-upstream grep -q "http://$API_CONTAINER:4000" /etc/nginx/conf.d/default.conf
|
||||||
|
bash tools/docker-smoke.sh http://localhost:8081
|
||||||
|
|
||||||
- name: État et journaux en cas d'échec
|
- name: État et journaux en cas d'échec
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
docker compose ps -a
|
docker compose ps -a
|
||||||
docker compose logs --no-color --timestamps
|
docker compose logs --no-color --timestamps
|
||||||
|
docker logs web-upstream || true
|
||||||
|
|
||||||
- name: Arrêt et suppression des volumes
|
- name: Arrêt et suppression des volumes
|
||||||
if: always()
|
if: always()
|
||||||
run: docker compose down -v --remove-orphans
|
run: |
|
||||||
|
docker rm -f web-upstream || true
|
||||||
|
docker compose down -v --remove-orphans
|
||||||
|
|
||||||
docker-aio:
|
docker-aio:
|
||||||
name: Docker tout-en-un (Unraid, NAS)
|
name: Docker tout-en-un (Unraid, NAS)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Notable changes to Parenthèse. Dates are in YYYY-MM-DD format.
|
|||||||
### Self-hosting
|
### Self-hosting
|
||||||
|
|
||||||
- Single-container image `ghcr.io/iliesallali/parenthese-aio` (PostgreSQL, API and front end), for Unraid and NAS systems that install one container per app. It needs no configuration: the database, its password and the session key are created in `/data` on first start. Tested in CI by a fresh start, a restart and the smoke test.
|
- Single-container image `ghcr.io/iliesallali/parenthese-aio` (PostgreSQL, API and front end), for Unraid and NAS systems that install one container per app. It needs no configuration: the database, its password and the session key are created in `/data` on first start. Tested in CI by a fresh start, a restart and the smoke test.
|
||||||
|
- The `parenthese-web` image reads the API address from `API_UPSTREAM` (`api:4000` by default, unchanged for existing installs). Set it when the name `api` is already taken on the Docker network, for example on Umbrel where apps share one network.
|
||||||
|
|
||||||
## 1.0.2 (2026-10-09)
|
## 1.0.2 (2026-10-09)
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -19,7 +19,14 @@ RUN npm run build
|
|||||||
|
|
||||||
FROM nginx:1.30-alpine
|
FROM nginx:1.30-alpine
|
||||||
|
|
||||||
COPY deploy/nginx.docker.conf /etc/nginx/conf.d/default.conf
|
# Adresse de l'API lue au démarrage du conteneur, `api:4000` par défaut (le service de docker-compose.yml).
|
||||||
|
# À changer quand le nom `api` est déjà pris sur le réseau, comme sur Umbrel où les apps partagent un réseau.
|
||||||
|
# L'image nginx passe les fichiers de /etc/nginx/templates par envsubst et n'y remplace que les variables
|
||||||
|
# d'environnement définies : $host, $uri et les autres variables de nginx restent telles quelles.
|
||||||
|
ENV API_UPSTREAM=api:4000
|
||||||
|
COPY deploy/nginx.docker.conf /etc/nginx/templates/default.conf.template
|
||||||
|
RUN sed -i 's|http://api:4000|http://${API_UPSTREAM}|g' /etc/nginx/templates/default.conf.template \
|
||||||
|
&& ! grep -q 'api:4000' /etc/nginx/templates/default.conf.template
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
+1
-1
@@ -53,7 +53,7 @@ docker compose up -d
|
|||||||
|
|
||||||
Le premier démarrage télécharge les images (ou les construit depuis les sources si elles sont introuvables), applique les migrations de la base, puis sert l'application sur [http://localhost](http://localhost). Créez votre compte depuis l'écran d'accueil : le premier compte est un compte comme les autres, il n'y a pas d'administrateur global.
|
Le premier démarrage télécharge les images (ou les construit depuis les sources si elles sont introuvables), applique les migrations de la base, puis sert l'application sur [http://localhost](http://localhost). Créez votre compte depuis l'écran d'accueil : le premier compte est un compte comme les autres, il n'y a pas d'administrateur global.
|
||||||
|
|
||||||
Trois conteneurs tournent : `db` (PostgreSQL 16), `api` (l'API Node) et `web` (nginx qui sert le front et relaie l'API). Seul `web` est exposé, sur le port choisi par `WEB_PORT` (80 par défaut). Si ce port est déjà pris, changez `WEB_PORT` dans `.env` et adaptez `CORS_ORIGIN` en conséquence.
|
Trois conteneurs tournent : `db` (PostgreSQL 16), `api` (l'API Node) et `web` (nginx qui sert le front et relaie l'API). Seul `web` est exposé, sur le port choisi par `WEB_PORT` (80 par défaut). Si ce port est déjà pris, changez `WEB_PORT` dans `.env` et adaptez `CORS_ORIGIN` en conséquence. Le conteneur `web` trouve l'API à `api:4000` ; si vous lancez les images sous d'autres noms de service, donnez `API_UPSTREAM` à `web` (par exemple `API_UPSTREAM=monapi:4000`).
|
||||||
|
|
||||||
Pour ouvrir l'instance à la famille depuis Internet, placez un reverse proxy HTTPS devant le port `web` (Caddy, Traefik, nginx) et mettez l'adresse publique dans `CORS_ORIGIN`, par exemple `https://arbre.votre-domaine.fr`.
|
Pour ouvrir l'instance à la famille depuis Internet, placez un reverse proxy HTTPS devant le port `web` (Caddy, Traefik, nginx) et mettez l'adresse publique dans `CORS_ORIGIN`, par exemple `https://arbre.votre-domaine.fr`.
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ docker compose up -d
|
|||||||
|
|
||||||
The first start downloads the images (or builds them from the source when they can't be pulled), applies the database migrations, then serves the app on [http://localhost](http://localhost). Create your account from the home screen. The first account is an account like any other, there is no global administrator.
|
The first start downloads the images (or builds them from the source when they can't be pulled), applies the database migrations, then serves the app on [http://localhost](http://localhost). Create your account from the home screen. The first account is an account like any other, there is no global administrator.
|
||||||
|
|
||||||
Three containers run: `db` (PostgreSQL 16), `api` (the Node API) and `web` (nginx, which serves the front end and proxies the API). Only `web` is exposed, on the port set by `WEB_PORT` (80 by default). If that port is taken, change `WEB_PORT` in `.env` and update `CORS_ORIGIN` to match.
|
Three containers run: `db` (PostgreSQL 16), `api` (the Node API) and `web` (nginx, which serves the front end and proxies the API). Only `web` is exposed, on the port set by `WEB_PORT` (80 by default). If that port is taken, change `WEB_PORT` in `.env` and update `CORS_ORIGIN` to match. The `web` container finds the API at `api:4000`; if you run the images under other service names, set `API_UPSTREAM` on `web` (for example `API_UPSTREAM=myapi:4000`).
|
||||||
|
|
||||||
To open the instance to your family over the Internet, put an HTTPS reverse proxy in front of the `web` port (Caddy, Traefik, nginx) and set the public address in `CORS_ORIGIN`, for example `https://tree.your-domain.com`.
|
To open the instance to your family over the Internet, put an HTTPS reverse proxy in front of the `web` port (Caddy, Traefik, nginx) and set the public address in `CORS_ORIGIN`, for example `https://tree.your-domain.com`.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user