76 lines
2.1 KiB
Markdown
76 lines
2.1 KiB
Markdown
# LobeHub Self-Hosted Deployment
|
|
|
|
## Droplet: gothbreach-abuse-1 ([REDACTED-IP], sgp1, 8GB RAM)
|
|
|
|
## Docker Compose Stack
|
|
|
|
```yaml
|
|
# Services: lobehub, postgresql (paradedb/pg17), redis, rustfs, searxng
|
|
# Ports: 3210 (web), 9000 (S3), 9001 (S3 console), 5432 (PG), 6379 (Redis)
|
|
```
|
|
|
|
## Deployment Commands
|
|
|
|
```bash
|
|
# Initial setup
|
|
ssh -i ~/.ssh/do_access root@[REDACTED-IP]
|
|
mkdir /opt/lobehub && cd /opt/lobehub
|
|
bash <(curl -fsSL https://lobe.li/setup.sh) -l en
|
|
# Select: option 2 (port mode), enter IP [REDACTED-IP]
|
|
|
|
# Fix bucket.config.json (ID → Id)
|
|
python3 << 'EOF'
|
|
import json
|
|
with open("bucket.config.json") as f: data = json.load(f)
|
|
if "ID" in data: data["Id"] = data.pop("ID")
|
|
with open("bucket.config.json", "w") as f: json.dump(data, f, indent=2)
|
|
EOF
|
|
|
|
# Add Better Auth config
|
|
cat >> .env << 'EOF'
|
|
NEXT_PUBLIC_APP_URL=http://[REDACTED-IP]:3210
|
|
APP_URL=http://[REDACTED-IP]:3210
|
|
NEXT_PUBLIC_ENABLE_AUTH=true
|
|
AUTH_ENABLED=true
|
|
BETTER_AUTH_ENABLED=true
|
|
AUTH_DISABLE_EMAIL_PASSWORD=false
|
|
EOF
|
|
|
|
# Start
|
|
docker compose up -d
|
|
|
|
# Check
|
|
docker compose ps
|
|
curl http://[REDACTED-IP]:3210/signin -o /dev/null -w "%{http_code}"
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
| Endpoint | Method | Description |
|
|
|----------|--------|-------------|
|
|
| `/api/auth/sign-up/email` | POST | Register (email, password, name) |
|
|
| `/api/auth/sign-in/email` | POST | Login → returns token + user |
|
|
| `/api/auth/session` | GET | Get current session |
|
|
|
|
## Registration Request
|
|
|
|
```python
|
|
import httpx
|
|
r = httpx.post(
|
|
"http://[REDACTED-IP]:3210/api/auth/sign-up/email",
|
|
json={"email": "...", "password": "...", "name": "..."},
|
|
headers={
|
|
"Origin": "http://[REDACTED-IP]:3210",
|
|
"Referer": "http://[REDACTED-IP]:3210/signin",
|
|
"Content-Type": "application/json"
|
|
}
|
|
)
|
|
# Response: {"token": "...", "user": {"id": "user_...", "email": "...", ...}}
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
- **rustfs-init fails**: fix bucket.config.json (ID→Id), then `docker compose down && docker compose up -d`
|
|
- **Port conflict**: `netstat -ano | findstr :3210` → `taskkill //F //PID <pid>`
|
|
- **Docker not installed**: `curl -fsSL https://get.docker.com | sh`
|