Research-Stack/4-Infrastructure/infra/nixos-setup-cred-server.sh
Brandon Schneider d4603644d2 Add EC2 recovery backup: NixOS config, AppFlowy compose/env template, credential server bootstrap, recovery guide
- ec2-configuration.nix: full NixOS config for aws-nixos-node-1
- docker-compose.minimal.yml: AppFlowy Cloud compose with search_path fix
- .env.example: sanitized AppFlowy env template
- nixos-setup-cred-server.sh: credential server bootstrap
- RECOVERY.md: step-by-step rebuild instructions
- .gitignore: secrets dir excluded
- credential_provider.py reverted to repo HEAD (EC2 had hardcoded AWS creds)
- racknerd_root.txt removed from working tree
2026-05-18 10:44:23 -05:00

39 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -e
# Create unit file
cat > /etc/systemd/system/rs-credential-server.service << 'UNITEOF'
[Unit]
Description=Research Stack Credential Server
After=network-online.target tailscaled.service
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/rs-surface
ExecStart=/run/current-system/sw/bin/python3 /opt/rs-surface/credential_server.py --port 8444 --bind 0.0.0.0
Restart=always
RestartSec=5
Environment=RS_CREDENTIAL_CONFIG=/etc/rs-surface/credentials.json
Environment=RS_CREDENTIAL_SERVER=http://100.101.247.127:8444
Environment=RS_SURFACE_NODE_ID=aws-nixos-node-1
[Install]
WantedBy=multi-user.target
UNITEOF
systemctl daemon-reload
systemctl enable rs-credential-server
systemctl restart rs-credential-server
echo "Service status:"
systemctl status rs-credential-server --no-pager --lines=5
echo ""
echo "Testing health endpoint..."
curl -sf --connect-timeout 5 http://localhost:8444/health && echo "OK" || echo "FAIL"
# Test remote credential resolution
echo ""
echo "Testing remote credential resolution..."
curl -sf --connect-timeout 10 http://localhost:8444/credentials/deepseek | python3 -m json.tool