Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Copy to .env and customize for your environment.

# ── Server ─────────────────────────────────────────────────────────────
# HTTP listen address (default: 0.0.0.0:3000)
TRAPFALL_LISTEN=0.0.0.0:3000
# HTTP listen address (default: 0.0.0.0:9090)
TRAPFALL_LISTEN=0.0.0.0:9090

# Log level: trace, debug, info, warn, error (default: info)
RUST_LOG=trapfall=info
Expand Down Expand Up @@ -45,8 +45,8 @@ TRAPFALL_CORS_ORIGINS=
# ── Sentry SDK Compatibility ──────────────────────────────────────────
# When using Sentry SDKs, point them to your TrapFall instance:
#
# Python: sentry_sdk.init(dsn="http://<key>@localhost:3000/0")
# Node.js: Sentry.init({ dsn: "http://<key>@localhost:3000/0" })
# Rust: sentry::init(("http://<key>@localhost:3000/0", sentry::ClientOptions::default()))
# Python: sentry_sdk.init(dsn="http://<key>@localhost:9090/0")
# Node.js: Sentry.init({ dsn: "http://<key>@localhost:9090/0" })
# Rust: sentry::init(("http://<key>@localhost:9090/0", sentry::ClientOptions::default()))
#
# The DSN key is generated per-project via the dashboard.
2 changes: 1 addition & 1 deletion crates/trapfall-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ pub fn generate_dsn_with(host: &str, project_id: &str) -> String {
/// When creating projects via CLI (no request context), we use a generic DSN.
/// Note: project_id is set to "1" as placeholder — should be regenerated with real project ID.
pub fn generate_dsn() -> String {
generate_dsn_with("localhost:3000", "1")
generate_dsn_with("localhost:9090", "1")
}
4 changes: 2 additions & 2 deletions crates/trapfall-db/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ pub fn extract_dsn_key(dsn: &str) -> String {
pub fn extract_dsn_host(dsn: &str) -> String {
dsn.split('@')
.nth(1)
.map(|s| s.split('/').next().unwrap_or("localhost:3000"))
.unwrap_or("localhost:3000")
.map(|s| s.split('/').next().unwrap_or("localhost:9090"))
.unwrap_or("localhost:9090")
.to_string()
}

Expand Down
2 changes: 1 addition & 1 deletion crates/trapfall-db/src/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Database for PostgresBackend {
// ── Projects ───────────────────────────────────────────────────────

async fn create_project(&self, slug: &str, name: &str) -> Result<Project> {
self.create_project_with_host(slug, name, "localhost:3000").await
self.create_project_with_host(slug, name, "localhost:9090").await
}

async fn create_project_with_host(&self, slug: &str, name: &str, host: &str) -> Result<Project> {
Expand Down
6 changes: 3 additions & 3 deletions crates/trapfall-db/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Database for SqliteBackend {
// ── Projects ───────────────────────────────────────────────────────

async fn create_project(&self, slug: &str, name: &str) -> Result<Project> {
self.create_project_with_host(slug, name, "localhost:3000").await
self.create_project_with_host(slug, name, "localhost:9090").await
}

async fn create_project_with_host(&self, slug: &str, name: &str, host: &str) -> Result<Project> {
Expand Down Expand Up @@ -114,8 +114,8 @@ impl Database for SqliteBackend {
.dsn
.split('@')
.nth(1)
.map(|s| s.split('/').next().unwrap_or("localhost:3000"))
.unwrap_or("localhost:3000");
.map(|s| s.split('/').next().unwrap_or("localhost:9090"))
.unwrap_or("localhost:9090");
let new_dsn = generate_dsn_with(host, project_id);
let new_dsn_key = extract_dsn_key(&new_dsn);
sqlx::query("UPDATE projects SET dsn = ?, dsn_key = ? WHERE id = ?")
Expand Down
2 changes: 1 addition & 1 deletion crates/trapfalld/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub async fn setup(
let host = state
.config
.dsn_host()
.unwrap_or_else(|| headers.get("host").and_then(|v| v.to_str().ok()).unwrap_or("localhost:3000").to_string());
.unwrap_or_else(|| headers.get("host").and_then(|v| v.to_str().ok()).unwrap_or("localhost:9090").to_string());
let project = store
.create_project_with_host("default", "Default Project", &host)
.await
Expand Down
2 changes: 1 addition & 1 deletion crates/trapfalld/src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ info:
name: Apache-2.0

servers:
- url: http://localhost:3000
- url: http://localhost:9090
description: Local development

tags:
Expand Down
4 changes: 2 additions & 2 deletions crates/trapfalld/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ async fn create_project(
let slug = req.slug.unwrap_or_else(|| req.name.to_lowercase().replace(' ', "-"));
// Prefer configured `public_url` (TRAPFALL_PUBLIC_URL) for DSN generation.
// Fall back to the request Host header so local dev keeps working without
// extra config (e.g. user accesses via http://localhost:3000).
// extra config (e.g. user accesses via http://localhost:9090).
let host = state
.config
.dsn_host()
.unwrap_or_else(|| headers.get("host").and_then(|v| v.to_str().ok()).unwrap_or("localhost:3000").to_string());
.unwrap_or_else(|| headers.get("host").and_then(|v| v.to_str().ok()).unwrap_or("localhost:9090").to_string());
let project = store.create_project_with_host(&slug, &req.name, &host).await.map_err(|e| {
tracing::warn!("Create project failed: {e}");
StatusCode::CONFLICT
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Quick start:
# 1. Copy .env.production to .env, edit values
# 2. docker compose up -d
# 3. Open http://YOUR_VPS_IP:3000 → setup wizard
# 3. Open http://YOUR_VPS_IP:9090 → setup wizard
#
# SQLite mode (default, single file, zero extra deps):
# docker compose up -d
Expand All @@ -21,7 +21,7 @@ services:
container_name: trapfall
restart: unless-stopped
ports:
- "${TRAPFALL_PORT:-3000}:3000"
- "${TRAPFALL_PORT:-9090}:9090"
volumes:
- trapfall-data:/data
environment:
Expand All @@ -31,7 +31,7 @@ services:
- TRAPFALL_CORS_ORIGINS=${TRAPFALL_CORS_ORIGINS:-}
command: >
serve
--listen 0.0.0.0:3000
--listen 0.0.0.0:9090
healthcheck:
test: ["CMD", "/trapfall", "healthcheck"]
interval: 30s
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
container_name: trapfall
restart: unless-stopped
ports:
- "${TRAPFALL_PORT:-3000}:3000"
- "${TRAPFALL_PORT:-9090}:9090"
volumes:
- trapfall-data:/data
environment:
Expand All @@ -17,7 +17,7 @@ services:
- TRAPFALL_DATABASE_URL=${TRAPFALL_DATABASE_URL:-sqlite:/data/trapfall.db}
command: >
serve
--listen 0.0.0.0:3000
--listen 0.0.0.0:9090
healthcheck:
test: ["CMD", "/trapfall", "healthcheck"]
interval: 30s
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ Conditions are JSON objects. Currently supports:

```bash
# List rules
curl -b cookie http://localhost:3000/api/0/projects/my-app/rules
curl -b cookie http://localhost:9090/api/0/projects/my-app/rules

# Create rule
curl -b cookie -X POST http://localhost:3000/api/0/projects/my-app/rules \
curl -b cookie -X POST http://localhost:9090/api/0/projects/my-app/rules \
-H "Content-Type: application/json" \
-d '{"name":"Fatal Alert","conditions":{"level":"fatal"},"action_type":"webhook","action_config":{"url":"https://hooks.slack.com/..."}}'

# Toggle rule
curl -b cookie -X POST http://localhost:3000/api/0/rules/<id>/toggle
curl -b cookie -X POST http://localhost:9090/api/0/rules/<id>/toggle

# Delete rule
curl -b cookie -X DELETE http://localhost:3000/api/0/rules/<id>
curl -b cookie -X DELETE http://localhost:9090/api/0/rules/<id>
```
4 changes: 2 additions & 2 deletions docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ services:
trapfall:
image: ghcr.io/codecoradev/trapfall:0.0.5
ports:
- "3000:3000"
- "9090:9090"
volumes:
- trapfall-data:/data
environment:
- RUST_LOG=trapfall=debug
- TRAPFALL_SECURE_COOKIE=false
- TRAPFALL_DATABASE_URL=sqlite:/data/trapfall.db
command: serve --listen 0.0.0.0:3000
command: serve --listen 0.0.0.0:9090
```

## Database
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bash
docker pull ghcr.io/codecoradev/trapfall:latest
docker run -d -p 3000:3000 -v trapfall-data:/data ghcr.io/codecoradev/trapfall:latest
docker run -d -p 9090:9090 -v trapfall-data:/data ghcr.io/codecoradev/trapfall:latest
```

## Image Details
Expand Down Expand Up @@ -36,7 +36,7 @@ services:
container_name: trapfall
restart: unless-stopped
ports:
- "3000:3000"
- "9090:9090"
volumes:
- trapfall-data:/data
environment:
Expand All @@ -45,7 +45,7 @@ services:
- TRAPFALL_DATABASE_URL=sqlite:/data/trapfall.db
command: >
serve
--listen 0.0.0.0:3000
--listen 0.0.0.0:9090
healthcheck:
test: ["CMD", "/trapfall", "healthcheck"]
interval: 30s
Expand Down Expand Up @@ -86,7 +86,7 @@ server {
ssl_certificate_key /path/to/key.pem;

location / {
proxy_pass http://127.0.0.1:3000;
proxy_pass http://127.0.0.1:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
20 changes: 10 additions & 10 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ docker pull ghcr.io/codecoradev/trapfall:latest
# Run (SQLite, zero-config)
docker run -d \
--name trapfall \
-p 3000:3000 \
-p 9090:9090 \
-v trapfall-data:/data \
ghcr.io/codecoradev/trapfall:latest
```

Open `http://localhost:3000` → setup wizard.
Open `http://localhost:9090` → setup wizard.

### Docker Compose

Expand Down Expand Up @@ -54,10 +54,10 @@ chmod +x trapfall

```bash
# Start server
./trapfall serve --listen 0.0.0.0:3000
./trapfall serve --listen 0.0.0.0:9090

# Or with custom database path
./trapfall --db /var/lib/trapfall.db serve --listen 0.0.0.0:3000
./trapfall --db /var/lib/trapfall.db serve --listen 0.0.0.0:9090
```

## From Source
Expand All @@ -70,14 +70,14 @@ cd trapfall
cd web && npm ci && npm run build && cd ..

# Build + run
cargo run --release -p trapfalld -- serve --listen 0.0.0.0:3000
cargo run --release -p trapfalld -- serve --listen 0.0.0.0:9090
```

## Quick Start

1. **Start the server** (any method above)

2. **Open `http://localhost:3000`** → setup wizard appears on first run
2. **Open `http://localhost:9090`** → setup wizard appears on first run

3. **Create admin account** (email, name, password)

Expand All @@ -89,24 +89,24 @@ cargo run --release -p trapfalld -- serve --listen 0.0.0.0:3000

```js
// JavaScript / Node.js
Sentry.init({ dsn: "https://<key>@localhost:3000/<project_id>" });
Sentry.init({ dsn: "https://<key>@localhost:9090/<project_id>" });
```

```python
# Python
import sentry_sdk
sentry_sdk.init(dsn: "https://<key>@localhost:3000/<project_id>")
sentry_sdk.init(dsn: "https://<key>@localhost:9090/<project_id>")
```

```rust
// Rust
sentry::init(("https://<key>@localhost:3000/<project_id>", sentry::ClientOptions::default()));
sentry::init(("https://<key>@localhost:9090/<project_id>", sentry::ClientOptions::default()));
```

```dart
// Flutter / Dart
await SentryFlutter.init((options) => {
options.dsn = "https://<key>@localhost:3000/<project_id>",
options.dsn = "https://<key>@localhost:9090/<project_id>",
});
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Update your deployment to use the Postgres URL:

```bash
TRAPFALL_DATABASE_URL=postgres://user:password@localhost:5432/trapfall \
trapfall serve --listen 0.0.0.0:3000
trapfall serve --listen 0.0.0.0:9090
```

## Notes
Expand Down
10 changes: 5 additions & 5 deletions docs/guide/sdk-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TrapFall is compatible with the Sentry envelope protocol. Any Sentry SDK can sen

fn main() {
let _guard = sentry::init((
"https://<key>@your-server:3000/<project_id>",
"https://<key>@your-server:9090/<project_id>",
sentry::ClientOptions {
release: Some(env!("CARGO_PKG_VERSION").into()),
..Default::default()
Expand All @@ -38,7 +38,7 @@ fn main() {
import sentry_sdk

sentry_sdk.init(
dsn="https://<key>@your-server:3000/<project_id>",
dsn="https://<key>@your-server:9090/<project_id>",
traces_sample_rate=0.0, # TrapFall is error-only, no tracing
)

Expand All @@ -57,7 +57,7 @@ except Exception:
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://<key>@your-server:3000/<project_id>",
dsn: "https://<key>@your-server:9090/<project_id>",
});

// Capture manually
Expand All @@ -74,7 +74,7 @@ try {
// npm install @sentry/browser

Sentry.init({
dsn: "https://<key>@your-server:3000/<project_id>",
dsn: "https://<key>@your-server:9090/<project_id>",
});
```

Expand All @@ -84,7 +84,7 @@ Sentry.init({
// pubspec.yaml: sentry_flutter: ^8.0.0

await SentryFlutter.init((options) {
options.dsn = 'https://<key>@your-server:3000/<project_id>';
options.dsn = 'https://<key>@your-server:9090/<project_id>';
});

// Capture manually
Expand Down
10 changes: 5 additions & 5 deletions docs/guide/vps-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ nano .env

Yang perlu diubah di `.env`:
```bash
TRAPFALL_PORT=3000 # port yang dibuka
TRAPFALL_PORT=9090 # port yang dibuka
TRAPFALL_DATABASE_URL=sqlite:/data/trapfall.db
TRAPFALL_SECURE_COOKIE=false # false jika belum HTTPS, true jika sudah
TRAPFALL_CORS_ORIGINS= # kosongkan jika single-server
Expand All @@ -39,7 +39,7 @@ docker compose -f docker-compose.prod.yml up -d

### 3. Setup Wizard

Buka `http://VPS_IP:3000` → buat admin account → selesai.
Buka `http://VPS_IP:9090` → buat admin account → selesai.

### 4. Cek status

Expand All @@ -51,7 +51,7 @@ docker compose -f docker-compose.prod.yml ps
docker compose -f docker-compose.prod.yml logs -f

# Health check
curl http://localhost:3000/health
curl http://localhost:9090/health
```

---
Expand Down Expand Up @@ -93,7 +93,7 @@ Postgres container otomatis start bersama TrapFall.
docker compose -f docker-compose.prod.yml ps postgres

# Check metrics
curl http://localhost:3000/metrics
curl http://localhost:9090/metrics
```

---
Expand Down Expand Up @@ -122,7 +122,7 @@ Buat `Caddyfile`:

```text
trapfall.yourdomain.com {
reverse_proxy trapfall:3000
reverse_proxy trapfall:9090
}
```

Expand Down
Loading