Updating with the latest images
The latest images don't have a bash/sh anymore, so it needs node to initialise it.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Set any config versions here
|
||||
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
|
||||
export ABRA_ENTRYPOINT_VERSION=v6
|
||||
export NGINX_CONF_VERSION=v4
|
||||
export NGINX_CONF_VERSION=v5
|
||||
export PG_BACKUP_VERSION=v5
|
||||
export MINIO_INITIALIZE_VERSION=v2
|
||||
export MIGRATE_VERSION=v1
|
||||
|
||||
+18
-4
@@ -214,10 +214,24 @@ services:
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
# The server never creates its schema: run the idempotent init-db before every start
|
||||
entrypoint: >
|
||||
sh -c "export POSTGRES=\"postgres://docs:$$(node -e 'process.stdout.write(encodeURIComponent(require(\"fs\").readFileSync(\"/run/secrets/postgres_p\",\"utf8\").trim()))')@db:5432/yhub\" && node node_modules/@y/hub/bin/init-db.js && exec /usr/local/bin/entrypoint \"$$@\"" --
|
||||
command: ["node", "--import", "./dist/sentry.js", "dist/server.js"]
|
||||
# Since v6.1.0 the image is distroless (no shell), so this is plain node:
|
||||
# - POSTGRES has no _FILE variant: build it from the postgres_p secret
|
||||
# - the server never creates its schema: run the idempotent init-db
|
||||
# (dist/init-db.js retries while postgres isn't up yet) before every start
|
||||
# - then load sentry and the server in this process, like the image's
|
||||
# `node --import ./dist/sentry.js dist/server.js`
|
||||
# No `$` in here, or compose would interpolate it.
|
||||
entrypoint:
|
||||
- node
|
||||
- -e
|
||||
- >-
|
||||
const fs = require('fs'), cp = require('child_process');
|
||||
const pw = encodeURIComponent(fs.readFileSync('/run/secrets/postgres_p', 'utf8').trim());
|
||||
process.env.POSTGRES = 'postgres://docs:' + pw + '@db:5432/yhub';
|
||||
const r = cp.spawnSync(process.execPath, ['/app/dist/init-db.js'], { stdio: 'inherit' });
|
||||
if (r.status !== 0) process.exit(r.status ?? 1);
|
||||
import('/app/dist/sentry.js').then(() => import('/app/dist/server.js'));
|
||||
# The image's CMD gets appended to `node -e` as extra argv and is ignored
|
||||
secrets:
|
||||
- postgres_p
|
||||
- y_api_key
|
||||
|
||||
+8
-2
@@ -13,6 +13,12 @@ server {
|
||||
# Disables server version feedback on pages and in headers
|
||||
server_tokens off;
|
||||
|
||||
# Docker's embedded DNS. Used to resolve yhub per request (via a variable
|
||||
# in proxy_pass) so nginx doesn't refuse to start while yhub isn't healthy
|
||||
# yet: swarm only publishes a service's DNS name once it has a healthy task.
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
set $yhub_upstream http://{{ env "STACK_NAME" }}_yhub:3002;
|
||||
|
||||
location @proxy_to_docs_backend {
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header Host $http_host;
|
||||
@@ -62,7 +68,7 @@ server {
|
||||
proxy_set_header Connection "Upgrade";
|
||||
|
||||
# Collaboration server
|
||||
proxy_pass http://{{ env "STACK_NAME" }}_yhub:3002;
|
||||
proxy_pass $yhub_upstream;
|
||||
|
||||
# Set appropriate timeout for WebSocket
|
||||
proxy_read_timeout 86400;
|
||||
@@ -76,7 +82,7 @@ server {
|
||||
|
||||
# Document routes (http fallback, history) and the public keys of yhub
|
||||
location ~ ^/collaboration/(ydoc|activity|changeset|rollback|jwks)/ {
|
||||
proxy_pass http://{{ env "STACK_NAME" }}_yhub:3002;
|
||||
proxy_pass $yhub_upstream;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header Origin $http_origin;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
Reference in New Issue
Block a user