From 08735a229661ed8fcd8efda04cb6566aaeb11e6d Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 1 Oct 2025 16:44:36 +0200 Subject: [PATCH] add inspector and gradido node routes to nginx --- .gitmodules | 3 ++ deployment/bare_metal/.env.dist | 3 +- .../sites-available/gradido.conf.ssl.template | 47 +++++++++++++++++++ deployment/bare_metal/start.sh | 19 ++++++++ inspector | 1 + 5 files changed, 72 insertions(+), 1 deletion(-) create mode 160000 inspector diff --git a/.gitmodules b/.gitmodules index 8b1378917..8bc8740e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1 +1,4 @@ +[submodule "inspector"] + path = inspector + url = https://github.com/gradido/inspector.git diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 11f5e1d76..f9a111feb 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -86,8 +86,9 @@ FEDERATION_COMMUNITY_APIS=1_0 GDT_ACTIVE=false # DLT-Connector (still in develop) -DLT_CONNECTOR=false +DLT_CONNECTOR=true DLT_CONNECTOR_PORT=6010 +NODE_SERVER_URL=http://localhost:8340/api # used for combining a newsletter on klicktipp with this gradido community # if used, user will be subscribed on register and can unsubscribe in his account diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 3bc911d39..fd54a27cc 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -101,6 +101,22 @@ server { error_log $GRADIDO_LOG_PATH/nginx-error.backend.log warn; } + # Gradido-Node + location /dlt { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + + proxy_pass http://127.0.0.1:8340/api/; + proxy_redirect off; + + access_log $GRADIDO_LOG_PATH/nginx-access.dlt.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.dlt.log warn; + } + # Backend webhooks location /hook { limit_req zone=backend burst=20 nodelay; @@ -196,6 +212,37 @@ server { access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; error_log $GRADIDO_LOG_PATH/nginx-error.admin.log warn; } + + # Admin Frontend + location /inspector { + limit_req zone=frontend burst=30 nodelay; + limit_conn addr 20; + alias $PROJECT_ROOT/inspector/build/; + index index.html; + + # caching rules for assets + # static assets + location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ { + # keep assets for a week + add_header Cache-Control "public, max-age=604800"; + try_files $uri =404; + } + # hashed assets + location ~* \.(?:js|css|json)$ { + add_header Cache-Control "public, max-age=31536000, immutable"; + try_files $uri =404; + } + + try_files $uri $uri/ /index.html = 404; + + # don't cache index.html + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires 0; + + access_log $GRADIDO_LOG_PATH/nginx-access.inspector.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.inspector.log warn; + } # Federation $FEDERATION_NGINX_CONF diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 19cafc077..ca9f7c57a 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -287,6 +287,17 @@ bun install log_step 'build all modules' turbo build --env-mode=loose --concurrency=$(nproc) +# build inspector and dlt-connector +log_step 'build inspector' +cd $PROJECT_ROOT/inspector +bun install +bun run build + +log_step 'build dlt-connector' +cd $PROJECT_ROOT/dlt-connector +bun install +bun run build + # database log_step 'Updating database' if [ "$DEPLOY_SEED_DATA" = "true" ]; then @@ -306,6 +317,14 @@ pm2 start --name gradido-backend \ -l $GRADIDO_LOG_PATH/pm2.backend.$TODAY.log \ --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' +if [ "$DLT_CONNECTOR" = true ] ; then + pm2 start --name dlt-connector \ + "env TZ=UTC NODE_ENV=production bun ./build/index.js" \ + --cwd $PROJECT_ROOT/dlt-connector \ + -l $GRADIDO_LOG_PATH/pm2.dlt-connector.$TODAY.log \ + --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' +fi + pm2 save if [ ! -z $FEDERATION_DHT_TOPIC ]; then pm2 start --name gradido-dht-node \ diff --git a/inspector b/inspector new file mode 160000 index 000000000..ab1fcc035 --- /dev/null +++ b/inspector @@ -0,0 +1 @@ +Subproject commit ab1fcc03546a1e98e4f236243d6cef1ae4a566d6