Point SKATE_RELAY, the default relay pools, the DM/CVM/zap relay arrays, the cvm-server + push-service defaults, and the archive default at wss://relay.skate-spots.org, keeping the legacy hosted relay as a fallback during the client-update window. Restored 115/115 archived events; the relay runs behind Caddy with TLS. Docs + AGENTS.md updated.
210 lines
4.6 KiB
Markdown
210 lines
4.6 KiB
Markdown
# SkateSpots CVM Server — VPS Deploy Guide
|
|
|
|
Everything below runs on your LNVPS server over SSH.
|
|
Shakespeare prepared all the files. You just copy-paste.
|
|
|
|
---
|
|
|
|
## 1. SSH into your VPS
|
|
|
|
```bash
|
|
ssh root@YOUR_VPS_IP
|
|
```
|
|
|
|
LNVPS will email/show you the IP and root password after purchase.
|
|
|
|
---
|
|
|
|
## 2. Run the bootstrap script (one command)
|
|
|
|
This installs Bun, Node, PM2, firewall, fail2ban, creates the `skate` user,
|
|
and generates your CVM server Nostr keypair.
|
|
|
|
```bash
|
|
bash <(curl -fsSL https://raw.githubusercontent.com/YOUR_REPO/main/cvm-server/bootstrap.sh)
|
|
```
|
|
|
|
**Or** if you haven't pushed to git yet, paste the contents of `bootstrap.sh`
|
|
directly into your SSH terminal.
|
|
|
|
---
|
|
|
|
## 3. Note down your keys
|
|
|
|
The bootstrap script prints something like:
|
|
|
|
```
|
|
PRIVATE KEY (hex) — goes in .env as CVM_SERVER_NSEC_HEX
|
|
a1b2c3d4e5f6...
|
|
|
|
NPUB (bech32) — share this so agents can find you
|
|
npub1abc123...
|
|
```
|
|
|
|
**Copy both somewhere safe** (password manager, notes). You need the hex key in step 4.
|
|
|
|
---
|
|
|
|
## 4. Switch to the skate user and set up the project
|
|
|
|
```bash
|
|
su - skate
|
|
cd ~/skatespots-cvm
|
|
```
|
|
|
|
Copy the project files (one of these options):
|
|
|
|
**Option A — clone from git (after you push):**
|
|
```bash
|
|
git clone YOUR_REPO_URL .
|
|
```
|
|
|
|
**Option B — create files manually:**
|
|
```bash
|
|
# Copy server.ts, package.cvm.json contents from your local machine
|
|
# Easiest: use scp from your local terminal
|
|
# scp -r ./cvm-server/* root@YOUR_VPS_IP:/home/skate/skatespots-cvm/
|
|
```
|
|
|
|
---
|
|
|
|
## 5. Rename package file and install dependencies
|
|
|
|
```bash
|
|
cd ~/skatespots-cvm
|
|
cp package.cvm.json package.json
|
|
bun install
|
|
```
|
|
|
|
---
|
|
|
|
## 6. Create your .env file
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
nano .env
|
|
```
|
|
|
|
Fill in:
|
|
```env
|
|
CVM_SERVER_NSEC_HEX=PASTE_YOUR_HEX_KEY_FROM_STEP_3_HERE
|
|
NOSTR_RELAYS=wss://relay.skate-spots.org,wss://relay.ditto.pub
|
|
CVM_RELAY=wss://relay.contextvm.org
|
|
LOG_LEVEL=info
|
|
```
|
|
|
|
Save: `Ctrl+X` → `Y` → `Enter`
|
|
|
|
---
|
|
|
|
## 7. Test it runs
|
|
|
|
```bash
|
|
bun run server.ts
|
|
```
|
|
|
|
You should see:
|
|
```
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
🛹 SkateSpots CVM Server
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
Data relays : wss://relay.skate-spots.org, ...
|
|
Server npub : abc123...
|
|
✅ Server running — listening for agents on Nostr
|
|
Verify discovery:
|
|
nak req -k 11316 -a abc123... wss://relay.contextvm.net
|
|
```
|
|
|
|
Press `Ctrl+C` to stop, then move to step 8.
|
|
|
|
---
|
|
|
|
## 8. Install as a systemd service (runs forever, survives reboots)
|
|
|
|
```bash
|
|
# Back to root for this
|
|
exit # leaves skate user, back to root
|
|
|
|
sudo cp /home/skate/skatespots-cvm/skatespots-cvm.service /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable skatespots-cvm
|
|
sudo systemctl start skatespots-cvm
|
|
|
|
# Check it started
|
|
sudo systemctl status skatespots-cvm
|
|
```
|
|
|
|
You should see `● skatespots-cvm.service — active (running)` ✅
|
|
|
|
---
|
|
|
|
## 9. Watch the live logs
|
|
|
|
```bash
|
|
sudo journalctl -u skatespots-cvm -f
|
|
```
|
|
|
|
---
|
|
|
|
## 10. Verify it's discoverable on Nostr
|
|
|
|
Install `nak` (Nostr Army Knife):
|
|
|
|
```bash
|
|
# Option A — go binary (fastest)
|
|
apt install -y golang-go
|
|
go install github.com/fiatjaf/nak@latest
|
|
export PATH=$PATH:~/go/bin
|
|
|
|
# Option B — npx (no install needed)
|
|
npx @nostr-army-knife/nak req -k 11316 -a YOUR_SERVER_PUBKEY wss://relay.contextvm.net
|
|
```
|
|
|
|
Run the discovery query:
|
|
```bash
|
|
nak req -k 11316 -a YOUR_SERVER_PUBKEY wss://relay.contextvm.net
|
|
```
|
|
|
|
If you get back a JSON event listing your server's tools → **it works!** 🎉
|
|
|
|
Any AI agent anywhere in the world can now call:
|
|
- `find_spots` — query skate spots
|
|
- `find_events` — query upcoming events
|
|
- `find_coaches` — find coaches/filmers/editors
|
|
- `find_gear` — browse the marketplace
|
|
- `get_community_stats` — live counts
|
|
|
|
---
|
|
|
|
## Useful commands after deploy
|
|
|
|
```bash
|
|
# Check service status
|
|
sudo systemctl status skatespots-cvm
|
|
|
|
# Restart after code changes
|
|
sudo systemctl restart skatespots-cvm
|
|
|
|
# Live logs
|
|
sudo journalctl -u skatespots-cvm -f
|
|
|
|
# Stop
|
|
sudo systemctl stop skatespots-cvm
|
|
|
|
# Update server.ts and restart
|
|
scp server.ts root@YOUR_VPS_IP:/home/skate/skatespots-cvm/
|
|
ssh root@YOUR_VPS_IP "systemctl restart skatespots-cvm"
|
|
```
|
|
|
|
---
|
|
|
|
## File layout on the VPS
|
|
|
|
```
|
|
/home/skate/skatespots-cvm/
|
|
├── server.ts ← the CVM server (main file)
|
|
├── package.json ← dependencies
|
|
├── .env ← your secret key + relay config (never commit!)
|
|
├── node_modules/ ← installed by bun install
|
|
└── skatespots-cvm.service ← systemd unit (copied to /etc/systemd/system/)
|
|
```
|