mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-23 10:05:10 +02:00
📦️(yhub) switch yhub-server to yarn
Every other package in this repository is installed with yarn; yhub-server was the only one on npm, with its own package-lock.json. To ensure consistency it now uses yarn like the rest of the project. package-lock.json is replaced by yarn.lock, a packageManager field is added, and the Dockerfile, CI workflow, Makefile, helm init-db job and the documentation move from `npm ci` / `npm run init-db` to `yarn install --frozen-lockfile` / `yarn init-db`.
This commit is contained in:
@@ -14,7 +14,7 @@ REDIS: redis://{redis-host}:6379/0
|
||||
POSTGRES: postgres://{user}:{password}@{postgres-host}:5432/yhub
|
||||
```
|
||||
|
||||
Nothing creates that schema at startup: the server never runs DDL. Run the script yhub ships (`npm run init-db`, which the helm chart runs as a job) once before starting it, and again after every upgrade that adds a table. It creates the database when it is missing, it is idempotent, and until it has run every document read fails with `relation "..." does not exist`.
|
||||
Nothing creates that schema at startup: the server never runs DDL. Run the script yhub ships (`yarn init-db`, which the helm chart runs as a job) once before starting it, and again after every upgrade that adds a table. It creates the database when it is missing, it is idempotent, and until it has run every document read fails with `relation "..." does not exist`.
|
||||
|
||||
The Django backend reads and writes document content there too, so point it at the service:
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ documents what each of them changes.
|
||||
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- |
|
||||
| PORT | Port the server listens on | 3002 |
|
||||
| REDIS | **Required.** Redis/Valkey url holding the live state of the documents. Not a cache: it holds what no worker has persisted yet | |
|
||||
| POSTGRES | **Required.** Url of the yhub database. Created by `npm run init-db`, never by the server | |
|
||||
| POSTGRES | **Required.** Url of the yhub database. Created by `yarn init-db`, never by the server | |
|
||||
| REDIS_PREFIX | Namespace of the redis keys, when the instance is shared | yhub |
|
||||
| COLLABORATION_BACKEND_BASE_URL | Base url of the Docs backend, which answers who a user is and what they may do with a document | http://app-dev:8000 |
|
||||
| COLLABORATION_SERVER_ORIGIN | Comma separated list of the origins allowed to open a websocket | http://localhost:3000 |
|
||||
|
||||
@@ -62,7 +62,7 @@ services:
|
||||
|
||||
# The collaboration server: it serves everything under /collaboration/, the
|
||||
# websocket included, and holds the content of the documents. Its schema is
|
||||
# not created when it starts — run `docker compose run --rm yhub npm run
|
||||
# not created when it starts — run `docker compose run --rm yhub yarn
|
||||
# init-db` once before the first start, and again after every upgrade.
|
||||
yhub:
|
||||
image: lasuite/impress-yhub:latest
|
||||
|
||||
@@ -260,7 +260,7 @@ The collaboration server never runs DDL itself, so its schema has to be created
|
||||
before it starts:
|
||||
|
||||
```bash
|
||||
docker compose run --rm yhub npm run init-db
|
||||
docker compose run --rm yhub yarn init-db
|
||||
```
|
||||
|
||||
It creates the `yhub` database when it is missing, and every table the version
|
||||
@@ -319,7 +319,7 @@ docker compose run --rm backend python manage.py migrate
|
||||
```
|
||||
and the collaboration server's, which is the same command as at install time:
|
||||
```bash
|
||||
docker compose run --rm yhub npm run init-db
|
||||
docker compose run --rm yhub yarn init-db
|
||||
```
|
||||
|
||||
## Upgrading from a release without the collaboration server
|
||||
|
||||
@@ -133,7 +133,7 @@ The collaboration server needs a key of its own (`YHUB_JWT_PRIVATE_KEY`), the
|
||||
backend it calls (`COLLABORATION_BACKEND_BASE_URL`), the origins a browser may
|
||||
open a websocket from (`COLLABORATION_SERVER_ORIGIN`), and its two stores
|
||||
(`POSTGRES`, `REDIS`). Its schema is created by the script it ships,
|
||||
`npm run init-db`, which has to run once before it starts and again after every
|
||||
`yarn init-db`, which has to run once before it starts and again after every
|
||||
upgrade. Its variables are listed in [env.md](../env.md), and
|
||||
`src/yhub-server/README.md` documents what each of them changes.
|
||||
|
||||
@@ -250,7 +250,7 @@ scalingo logs --tail
|
||||
3. **Static files not served**: Ensure the buildpack post-frontend script ran successfully
|
||||
4. **OIDC errors**: Verify your OIDC provider configuration and callback URLs
|
||||
5. **Theme not updating**: Clear Redis cache with `scalingo run python -c "from django.core.cache import cache; cache.clear()"`
|
||||
6. **Collaboration not working, or documents opening empty**: the collaboration server is a separate deployment. Verify it is running, that `COLLABORATION_WS_URL` and `YHUB_API_BASE_URL` point at it, that `JWT_PRIVATE_KEY` is set on this app and `YHUB_JWT_PRIVATE_KEY` on that one, and that its `npm run init-db` has been run
|
||||
6. **Collaboration not working, or documents opening empty**: the collaboration server is a separate deployment. Verify it is running, that `COLLABORATION_WS_URL` and `YHUB_API_BASE_URL` point at it, that `JWT_PRIVATE_KEY` is set on this app and `YHUB_JWT_PRIVATE_KEY` on that one, and that its `yarn init-db` has been run
|
||||
7. **Conversion not working** (export, markdown import): verify the y-provider process is running and `Y_PROVIDER_API_BASE_URL` points at it
|
||||
|
||||
### Useful Commands
|
||||
|
||||
Reference in New Issue
Block a user