Reconcile explorer service and nginx ownership
This commit is contained in:
@@ -83,6 +83,26 @@ rm -f /tmp/explorer-ai-docs.tar.gz
|
||||
mv /usr/local/bin/explorer-config-api.new /usr/local/bin/explorer-config-api
|
||||
chmod 0755 /usr/local/bin/explorer-config-api
|
||||
|
||||
cat > /etc/systemd/system/explorer-config-api.service <<EOF
|
||||
[Unit]
|
||||
Description=Explorer Config API (MetaMask networks and token list)
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/usr/local/bin
|
||||
Environment=PORT=8081
|
||||
Environment=CHAIN_ID=138
|
||||
ExecStart=/usr/local/bin/explorer-config-api
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat > /etc/systemd/system/explorer-config-api.service.d/ai.conf <<EOF
|
||||
[Service]
|
||||
Environment=TOKEN_AGGREGATION_API_BASE=http://127.0.0.1:3001
|
||||
@@ -125,6 +145,7 @@ set -euo pipefail
|
||||
|
||||
pct exec "$VMID" -- python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import re
|
||||
path = Path('/etc/nginx/sites-available/blockscout')
|
||||
text = path.read_text()
|
||||
explorer_block = ''' # Explorer backend API (auth, features, AI, explorer-owned v1 helpers)
|
||||
@@ -146,6 +167,14 @@ escaped_explorer_block = explorer_block.replace('$', '\\$')
|
||||
if escaped_explorer_block in text:
|
||||
text = text.replace(escaped_explorer_block, explorer_block)
|
||||
|
||||
legacy_patterns = [
|
||||
r"\n\s*# Explorer AI endpoints on the explorer backend service \(HTTP\)\n\s*location /api/v1/ai/ \{.*?\n\s*\}\n",
|
||||
r"\n\s*location = /api/v1/features \{.*?\n\s*\}\n",
|
||||
r"\n\s*# Explorer AI endpoints on the explorer backend service\n\s*location /api/v1/ai/ \{.*?\n\s*\}\n",
|
||||
]
|
||||
for pattern in legacy_patterns:
|
||||
text = re.sub(pattern, "\n", text, flags=re.S)
|
||||
|
||||
http_needle = ' # Blockscout API endpoint - MUST come before the redirect location\n'
|
||||
legacy_http_needle = ' # API endpoint - MUST come before the redirect location\n'
|
||||
if explorer_block not in text:
|
||||
|
||||
Reference in New Issue
Block a user