Fix management .env to include CENTRAL_AUTH_SECRET/AUTH_URL; update add-app summary
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
53caeea318
commit
ac846670f3
2 changed files with 17 additions and 9 deletions
21
add-app.sh
21
add-app.sh
|
|
@ -219,13 +219,16 @@ pct push "$LXC_ID" "$ENV_TMP" "/opt/${APP_NAME}/.env" 2>/dev/null
|
|||
rm -f "$ENV_TMP"
|
||||
msg_ok ".env written"
|
||||
|
||||
# ── Register app in auth service ──────────────────────────────────────────────
|
||||
msg_warn "Remember to register '${APP_NAME}' in the auth service DB:"
|
||||
printf " docker exec hotel-manage-auth-1 node -e \"\n"
|
||||
printf " const db = require('./src/db.js');\n"
|
||||
printf " db.query(\\\"INSERT INTO apps (slug,name,base_path) VALUES ('%s','%s','%s') ON CONFLICT DO NOTHING\\\");\n" \
|
||||
"$APP_NAME" "$APP_NAME" "$APP_PATH"
|
||||
printf " \"\n\n"
|
||||
# ── Register app in auth service DB ──────────────────────────────────────────
|
||||
msg_info "Registering ${APP_NAME} in auth service"
|
||||
pct exec 100 -- docker exec hotel-manage-postgres psql -U postgres -d auth_db -c \
|
||||
"INSERT INTO apps (slug, name, description, base_path, icon, theme_color, internal_host, internal_port)
|
||||
VALUES ('${APP_NAME}', '${APP_NAME^}', '', '${APP_PATH%/}', 'ClipboardList', '#1e3a5f', '10.10.10.${LAST_OCTET}', ${APP_PORT})
|
||||
ON CONFLICT (slug) DO UPDATE SET
|
||||
internal_host = '10.10.10.${LAST_OCTET}',
|
||||
internal_port = ${APP_PORT};" &>/dev/null \
|
||||
&& msg_ok "${APP_NAME} registered in auth DB (visible in portal after next login)" \
|
||||
|| msg_warn "Auto-register failed — add ${APP_NAME} to the apps table in auth_db manually"
|
||||
|
||||
# ── NPM route reminder ────────────────────────────────────────────────────────
|
||||
NPM_LAN="${NPM_LAN_IP:-<npm-lan-ip>}"
|
||||
|
|
@ -246,7 +249,7 @@ cat <<SUMMARY
|
|||
http://10.10.10.${LAST_OCTET}:${APP_PORT}${APP_PATH}health
|
||||
4. Add Forgejo webhook:
|
||||
http://10.10.10.105:9000/webhook (secret in /root/hotel-manage-credentials.txt)
|
||||
5. Add deploy entry to the management repo: updater/deploy-map.js:
|
||||
'${APP_NAME}': { host: '10.10.10.${LAST_OCTET}', path: '/opt/${APP_NAME}' }
|
||||
5. App is auto-registered in auth DB — management picks it up within 5 minutes
|
||||
(or immediately on next Forgejo webhook push)
|
||||
|
||||
SUMMARY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue