diff --git a/compose.yml b/compose.yml index 2ded4b24..9a571408 100644 --- a/compose.yml +++ b/compose.yml @@ -169,6 +169,15 @@ services: migration: condition: service_completed_successfully + neodb-web-api: + <<: *neodb-service + command: ${NEODB_VENV:-/neodb-venv}/bin/gunicorn boofilsic.wsgi -w ${NEODB_API_WORKER_NUM:-4} --preload --max-requests 2000 -b 0.0.0.0:8000 + healthcheck: + test: ['CMD', 'wget', '-qO/tmp/test', '--header', 'X-Forwarded-Proto: https', 'http://127.0.0.1:8000/nodeinfo/2.0/'] + depends_on: + migration: + condition: service_completed_successfully + neodb-worker: <<: *neodb-service command: neodb-manage rqworker --with-scheduler import export mastodon fetch crawl ap cron @@ -205,6 +214,7 @@ services: command: nginx-start environment: NEODB_WEB_SERVER: neodb-web:8000 + NEODB_API_SERVER: neodb-web-api:8000 TAKAHE_WEB_SERVER: takahe-web:8000 NGINX_CONF: /neodb/misc/nginx.conf.d/neodb.conf depends_on: diff --git a/misc/bin/nginx-start b/misc/bin/nginx-start index d2148be7..9905ccb9 100755 --- a/misc/bin/nginx-start +++ b/misc/bin/nginx-start @@ -1,4 +1,4 @@ #!/bin/sh chown app:app /www/media /www/m -envsubst '${NEODB_WEB_SERVER} ${TAKAHE_WEB_SERVER}' < $NGINX_CONF > /etc/nginx/conf.d/neodb.conf +envsubst '${NEODB_WEB_SERVER} ${NEODB_API_SERVER} ${TAKAHE_WEB_SERVER}' < $NGINX_CONF > /etc/nginx/conf.d/neodb.conf nginx -g 'daemon off;' diff --git a/misc/nginx.conf.d/neodb-dev.conf b/misc/nginx.conf.d/neodb-dev.conf index 28f29bd2..12885de3 100644 --- a/misc/nginx.conf.d/neodb-dev.conf +++ b/misc/nginx.conf.d/neodb-dev.conf @@ -4,6 +4,10 @@ upstream neodb { server ${NEODB_WEB_SERVER}; } +upstream neodb-api { + server ${NEODB_API_SERVER}; +} + upstream takahe { server ${TAKAHE_WEB_SERVER}; } @@ -97,6 +101,9 @@ server { location ~* ^/(static|@|\.well-known|actor|inbox|api/v1|api/v2|oauth|tags|settings|media|proxy|admin|djadmin) { proxy_pass http://takahe; } + location /api { + proxy_pass http://neodb-api; + } location / { proxy_pass http://neodb; }