Skip to content
Open
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
138 changes: 138 additions & 0 deletions blueprints/flarepanel/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# FlarePanel: open-source web and product analytics.
# One `app` container runs the API and background jobs (ROLE=all), so the
# SQLite metadata file has a single writer. ClickHouse holds events, Redis the
# buffers and queues, Redpanda the event stream. `migrate` applies database
# changes before the app starts, on every deploy.

x-app-env: &app-env
NODE_ENV: production
SELF_HOSTED: "true"
DATABASE_URL: file:/data/flarepanel.db
CLICKHOUSE_URL: http://clickhouse:8123/flarepanel
REDIS_URL: redis://redis:6379
KAFKA_BROKERS: redpanda:9092
API_URL: ${API_URL}
DASHBOARD_URL: ${DASHBOARD_URL}
COOKIE_SECRET: ${COOKIE_SECRET}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
TRUSTED_IP_HEADER_ORDER: x-forwarded-for
ALLOW_REGISTRATION: ${ALLOW_REGISTRATION}
ALLOW_INVITATION: "true"
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USER: ${SMTP_USER}
SMTP_PASS: ${SMTP_PASS}
EMAIL_SENDER: ${EMAIL_SENDER}

services:
redis:
image: redis:7.2.5-alpine
restart: unless-stopped
command: ["redis-server", "--maxmemory-policy", "noeviction", "--appendonly", "yes"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20

clickhouse:
image: clickhouse/clickhouse-server:26.1.3.52
restart: unless-stopped
environment:
CLICKHOUSE_DB: flarepanel
CLICKHOUSE_SKIP_USER_SETUP: 1
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- clickhouse-data:/var/lib/clickhouse
- ../files/clickhouse_config:/etc/clickhouse-server/config.d
- ../files/clickhouse_users:/etc/clickhouse-server/users.d
healthcheck:
test: ["CMD-SHELL", "clickhouse-client -q 'SELECT 1'"]
interval: 5s
timeout: 3s
retries: 30

redpanda:
image: redpandadata/redpanda:v25.1.4
restart: unless-stopped
command:
- redpanda
- start
- --kafka-addr=internal://0.0.0.0:9092
- --advertise-kafka-addr=internal://redpanda:9092
- --rpc-addr=0.0.0.0:33145
- --advertise-rpc-addr=redpanda:33145
- --smp=1
- --memory=1G
- --mode=dev-container
- --default-log-level=warn
volumes:
- redpanda-data:/var/lib/redpanda/data
- ../files/redpanda/bootstrap.yaml:/etc/redpanda/.bootstrap.yaml:ro
healthcheck:
test: ["CMD-SHELL", "rpk cluster health -X admin.hosts=localhost:9644 | grep -q 'Healthy:.*true'"]
interval: 5s
timeout: 3s
retries: 30

migrate:
image: ghcr.io/flarepanel-dev/flarepanel-api:1.0.0
restart: "no"
environment: *app-env
working_dir: /app/packages/db
command: ["sh", "-c", "bun ./scripts/migrate-sqlite.ts && bun ./scripts/migrate-code.ts"]
volumes:
- app-data:/data
depends_on:
clickhouse:
condition: service_healthy

app:
image: ghcr.io/flarepanel-dev/flarepanel-api:1.0.0
restart: unless-stopped
environment:
<<: *app-env
ROLE: all
volumes:
- app-data:/data
expose:
- 3000
depends_on:
migrate:
condition: service_completed_successfully
redis:
condition: service_healthy
redpanda:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:3000/healthcheck >/dev/null"]
interval: 10s
timeout: 5s
retries: 12

dashboard:
image: ghcr.io/flarepanel-dev/flarepanel-dashboard:1.0.0
restart: unless-stopped
environment:
NODE_ENV: production
SELF_HOSTED: "true"
API_URL: ${API_URL}
# The dashboard's server reaches the API inside the compose network.
API_URL_SSR: http://app:3000
DASHBOARD_URL: ${DASHBOARD_URL}
expose:
- 3000
depends_on:
app:
condition: service_healthy

volumes:
app-data:
redis-data:
clickhouse-data:
redpanda-data:
1 change: 1 addition & 0 deletions blueprints/flarepanel/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions blueprints/flarepanel/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "flarepanel",
"name": "FlarePanel",
"version": "1.0.0",
"description": "Open-source web and product analytics: realtime, funnels, retention, session replay, AI crawler tracking and an AI chat for your data. No cookies.",
"logo": "logo.svg",
"links": {
"github": "https://github.com/flarepanel-dev/flarepanel",
"website": "https://flarepanel.dev/",
"docs": "https://docs.flarepanel.dev/self-hosting/server"
},
"tags": [
"analytics",
"self-hosted"
]
}
107 changes: 107 additions & 0 deletions blueprints/flarepanel/template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[variables]
main_domain = "${domain}"
cookie_secret = "${hash:32}"
encryption_key = "${hash:32}"

[config]
# The dashboard on the domain, the API under /api on the same domain.
[[config.domains]]
serviceName = "dashboard"
port = 3000
host = "${main_domain}"

[[config.domains]]
serviceName = "app"
port = 3000
host = "${main_domain}"
path = "/api"
stripPath = true

[config.env]
DASHBOARD_URL = "http://${main_domain}"
API_URL = "http://${main_domain}/api"
COOKIE_SECRET = "${cookie_secret}"
# Keep a copy: stored AI and integration keys cannot be read without it.
ENCRYPTION_KEY = "${encryption_key}"
# The first account can always sign up; after that only invited people,
# unless this is "true".
ALLOW_REGISTRATION = "false"
# Optional: SMTP for verification, invitation and password-reset emails.
SMTP_HOST = ""
SMTP_PORT = ""
SMTP_USER = ""
SMTP_PASS = ""
EMAIL_SENDER = ""

[[config.mounts]]
filePath = "./clickhouse_config/flarepanel.xml"
content = """
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
<!-- Disable file logging entirely; rely on docker's json-file driver for stdout capture + rotation.
See https://github.com/ClickHouse/clickhouse-docs/issues/4255 — <console>true</console> alone
does NOT disable the inherited <log>/<errorlog> file paths, which can spin-loop on inode loss. -->
<log remove="remove" />
<errorlog remove="remove" />
</logger>

<keep_alive_timeout>10</keep_alive_timeout>

<!-- Stop all the unnecessary logging -->
<query_thread_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<part_log remove="remove"/>

<listen_host>0.0.0.0</listen_host>
<interserver_listen_host>0.0.0.0</interserver_listen_host>
<interserver_http_host>clickhouse</interserver_http_host>

<!-- Not used anymore, but kept for backwards compatibility -->
<macros>
<shard>1</shard>
<replica>replica1</replica>
<cluster>flarepanel_cluster</cluster>
</macros>
</clickhouse>
"""

[[config.mounts]]
filePath = "./clickhouse_users/flarepanel.xml"
content = """
<clickhouse>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
</default>
</profiles>

<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
</users>
</clickhouse>
"""

[[config.mounts]]
filePath = "./redpanda/bootstrap.yaml"
content = """
default_topic_partitions: 24
default_topic_replications: 1
auto_create_topics_enabled: true
log_compression_type: lz4
log_retention_ms: 172800000
"""
Loading