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"
|
rm -f "$ENV_TMP"
|
||||||
msg_ok ".env written"
|
msg_ok ".env written"
|
||||||
|
|
||||||
# ── Register app in auth service ──────────────────────────────────────────────
|
# ── Register app in auth service DB ──────────────────────────────────────────
|
||||||
msg_warn "Remember to register '${APP_NAME}' in the auth service DB:"
|
msg_info "Registering ${APP_NAME} in auth service"
|
||||||
printf " docker exec hotel-manage-auth-1 node -e \"\n"
|
pct exec 100 -- docker exec hotel-manage-postgres psql -U postgres -d auth_db -c \
|
||||||
printf " const db = require('./src/db.js');\n"
|
"INSERT INTO apps (slug, name, description, base_path, icon, theme_color, internal_host, internal_port)
|
||||||
printf " db.query(\\\"INSERT INTO apps (slug,name,base_path) VALUES ('%s','%s','%s') ON CONFLICT DO NOTHING\\\");\n" \
|
VALUES ('${APP_NAME}', '${APP_NAME^}', '', '${APP_PATH%/}', 'ClipboardList', '#1e3a5f', '10.10.10.${LAST_OCTET}', ${APP_PORT})
|
||||||
"$APP_NAME" "$APP_NAME" "$APP_PATH"
|
ON CONFLICT (slug) DO UPDATE SET
|
||||||
printf " \"\n\n"
|
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 route reminder ────────────────────────────────────────────────────────
|
||||||
NPM_LAN="${NPM_LAN_IP:-<npm-lan-ip>}"
|
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
|
http://10.10.10.${LAST_OCTET}:${APP_PORT}${APP_PATH}health
|
||||||
4. Add Forgejo webhook:
|
4. Add Forgejo webhook:
|
||||||
http://10.10.10.105:9000/webhook (secret in /root/hotel-manage-credentials.txt)
|
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:
|
5. App is auto-registered in auth DB — management picks it up within 5 minutes
|
||||||
'${APP_NAME}': { host: '10.10.10.${LAST_OCTET}', path: '/opt/${APP_NAME}' }
|
(or immediately on next Forgejo webhook push)
|
||||||
|
|
||||||
SUMMARY
|
SUMMARY
|
||||||
|
|
|
||||||
|
|
@ -741,6 +741,9 @@ deploy_management() {
|
||||||
|
|
||||||
push_file 105 /opt/management/.env <<EOF
|
push_file 105 /opt/management/.env <<EOF
|
||||||
FORGEJO_WEBHOOK_SECRET=${WEBHOOK_SECRET}
|
FORGEJO_WEBHOOK_SECRET=${WEBHOOK_SECRET}
|
||||||
|
WEBHOOK_SECRET=${WEBHOOK_SECRET}
|
||||||
|
CENTRAL_AUTH_SECRET=${CENTRAL_AUTH_SECRET}
|
||||||
|
AUTH_URL=http://10.10.10.101:3001
|
||||||
BACKUP_REMOTE=${BACKUP_REMOTE}
|
BACKUP_REMOTE=${BACKUP_REMOTE}
|
||||||
BACKUP_PG_HOST=10.10.10.100
|
BACKUP_PG_HOST=10.10.10.100
|
||||||
BACKUP_PG_USER=postgres
|
BACKUP_PG_USER=postgres
|
||||||
|
|
@ -859,6 +862,8 @@ NODE_ENV=production
|
||||||
APP_SLUG=cashup
|
APP_SLUG=cashup
|
||||||
DATABASE_URL=postgresql://cashup:${CASHUP_DB_PASS}@10.10.10.100:5432/cashup_db
|
DATABASE_URL=postgresql://cashup:${CASHUP_DB_PASS}@10.10.10.100:5432/cashup_db
|
||||||
CENTRAL_AUTH_SECRET=${CENTRAL_AUTH_SECRET}
|
CENTRAL_AUTH_SECRET=${CENTRAL_AUTH_SECRET}
|
||||||
|
SETTINGS_URL=http://10.10.10.116:3080
|
||||||
|
SETTINGS_SECRET=${SETTINGS_SECRET}
|
||||||
OFFICE_IP_CHECK=${OFFICE_IP_CHECK:-${OFFICE_IP:-disabled}}
|
OFFICE_IP_CHECK=${OFFICE_IP_CHECK:-${OFFICE_IP:-disabled}}
|
||||||
FRONTEND_PORT=3083
|
FRONTEND_PORT=3083
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue