From 3158ebfbda26734623c6cdc8bff071757eaab9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Tue, 16 Dec 2025 15:36:21 +0100 Subject: [PATCH] chore: prep v2 self-hosting --- .../docs/migration/migrate-v1-to-v2.mdx | 101 ++++++++++++++++++ .../content/docs/self-hosting/changelog.mdx | 16 ++- .../docs/self-hosting/deploy-coolify.mdx | 4 +- .../self-hosting/deploy-docker-compose.mdx | 2 +- .../docs/self-hosting/deploy-dokploy.mdx | 20 ++-- .../self-hosting/environment-variables.mdx | 16 +-- .../docs/self-hosting/self-hosting.mdx | 2 +- self-hosting/docker-compose.template.yml | 8 +- sh/docker-build | 12 ++- 9 files changed, 152 insertions(+), 29 deletions(-) create mode 100644 apps/public/content/docs/migration/migrate-v1-to-v2.mdx diff --git a/apps/public/content/docs/migration/migrate-v1-to-v2.mdx b/apps/public/content/docs/migration/migrate-v1-to-v2.mdx new file mode 100644 index 00000000..4cec413f --- /dev/null +++ b/apps/public/content/docs/migration/migrate-v1-to-v2.mdx @@ -0,0 +1,101 @@ +--- +title: Migration from v1 to v2 +description: Finally we feel ready to release v2 for all self-hostings. This is a big one! +--- + +## What's New in v2 + +- **Redesigned dashboard** - New UI built with Tanstack +- **Revenue tracking** - Track revenue alongside your analytics +- **Sessions** - View individual user sessions +- **Real-time view** - Live event stream +- **Customizable dashboards** - Grafana-style widget layouts +- **Improved report builder** - Faster and more flexible +- **General improvements** - We have also made a bunch of bug fixes, minor improvements and much more + +## Migrating from v1 + +### Ensure you're on the self-hosting branch + +Sometimes we add new helper scripts and what not. Always make sure you're on the latest commit before continuing. + +```bash +cd ./self-hosting +git fetch origin +git checkout self-hosting +git pull origin self-hosting +``` + +### Envs + +Since we have migrated to tanstack from nextjs we first need to update our envs. We have added a dedicated page for the [environment variables here](/docs/self-hosting/environment-variables). + +```js title=".env" +NEXT_PUBLIC_DASHBOARD_URL="..." // [!code --] +NEXT_PUBLIC_API_URL="..." // [!code --] +NEXT_PUBLIC_SELF_HOSTED="..." // [!code --] + +DASHBOARD_URL="..." // [!code ++] +API_URL="..." // [!code ++] +SELF_HOSTED="..." // [!code ++] +``` + +### Clickhouse 24 -> 25 + +We have updated Clickhouse to 25, this is important to not skip, otherwise your OpenPanel instance wont work. + +You should edit your `./self-hosting/docker-compose.yml` + +```js title="./self-hosting/docker-compose.yml" +services: + op-ch: + image: clickhouse/clickhouse-server:24.3.2-alpine // [!code --] + image: clickhouse/clickhouse-server:25.10.2.65 // [!code ++] +``` + +Since version 25 clickhouse enabled default user setup, this means that we need to disable it to avoid connection issues. With this setting we can still access our clickhouse instance (internally) without having a user. + +``` +services: + op-ch: + environment: + - CLICKHOUSE_SKIP_USER_SETUP=1 +``` + +### Use our latest docker images + +Last thing to do is to start using our latest docker images. + +> Note: Before you might have been using the latest tag, which is not recommended. Change it to the actual latest version instead. + +```js title="./self-hosting/docker-compose.yml" +services: + op-api: + image: lindesvard/openpanel-api:latest // [!code --] + image: lindesvard/openpanel-api:2.0.0 // [!code ++] + + op-worker: + image: lindesvard/openpanel-worker:latest // [!code --] + image: lindesvard/openpanel-worker:2.0.0 // [!code ++] + + op-dashboard: + image: lindesvard/openpanel-dashboard:latest // [!code --] + image: lindesvard/openpanel-dashboard:2.0.0 // [!code ++] +``` + +### Done? + +When you're done with above steps you should need to restart all services. This will take quite some time depending on your hardware and how many events you have. Since we have made significant changes to the database schema and data we need to run migrations. + +```bash +./stop +./start +``` + +## Using Coolify? + +If you're using Coolify and running OpenPanel v1 you'll need to apply the above changes. You can take a look at our [Coolify PR](https://github.com/coollabsio/coolify/pull/7653) which shows what you need to change. + +## Any issues with migrations? + +If you stumble upon any issues during migrations, please reach out to us on [Discord](https://discord.gg/openpanel) and we'll try our best to help you out. \ No newline at end of file diff --git a/apps/public/content/docs/self-hosting/changelog.mdx b/apps/public/content/docs/self-hosting/changelog.mdx index 857d23da..c5c3cb56 100644 --- a/apps/public/content/docs/self-hosting/changelog.mdx +++ b/apps/public/content/docs/self-hosting/changelog.mdx @@ -3,6 +3,20 @@ title: Changelog for self-hosting description: This is a list of changes that have been made to the self-hosting setup. --- +## 2.0.0 + +We have released the first stable version of OpenPanel v2. This is a big one! + +Read more about it in our [migration guide](/docs/migration/migrate-v1-to-v2). + +TLDR; + +- Clickhouse upgraded from 24.3.2-alpine to 25.10.2.65 +- Add `CLICKHOUSE_SKIP_USER_SETUP=1` to op-ch service +- `NEXT_PUBLIC_DASHBOARD_URL` -> `DASHBOARD_URL` +- `NEXT_PUBLIC_API_URL` -> `API_URL` +- `NEXT_PUBLIC_SELF_HOSTED` -> `SELF_HOSTED` + ## 1.2.0 We have renamed `SELF_HOSTED` to `NEXT_PUBLIC_SELF_HOSTED`. It's important to rename this env before your upgrade to this version. @@ -30,7 +44,7 @@ If you upgrading from a previous version, you'll need to edit your `.env` file i ### Removed Clickhouse Keeper -In 0.0.6 we introduced a cluster mode for Clickhouse. This was a misstake and we have removed it. +In 0.0.6 we introduced a cluster mode for Clickhouse. This was a mistake and we have removed it. Remove op-zk from services and volumes diff --git a/apps/public/content/docs/self-hosting/deploy-coolify.mdx b/apps/public/content/docs/self-hosting/deploy-coolify.mdx index 6ab74766..720a9cb3 100644 --- a/apps/public/content/docs/self-hosting/deploy-coolify.mdx +++ b/apps/public/content/docs/self-hosting/deploy-coolify.mdx @@ -109,8 +109,8 @@ Coolify automatically handles these variables: - `DATABASE_URL`: PostgreSQL connection string - `REDIS_URL`: Redis connection string - `CLICKHOUSE_URL`: ClickHouse connection string -- `NEXT_PUBLIC_API_URL`: API endpoint URL (set via `SERVICE_FQDN_OPAPI`) -- `NEXT_PUBLIC_DASHBOARD_URL`: Dashboard URL (set via `SERVICE_FQDN_OPDASHBOARD`) +- `API_URL`: API endpoint URL (set via `SERVICE_FQDN_OPAPI`) +- `DASHBOARD_URL`: Dashboard URL (set via `SERVICE_FQDN_OPDASHBOARD`) - `COOKIE_SECRET`: Automatically generated secret You can configure optional variables like `ALLOW_REGISTRATION`, `RESEND_API_KEY`, `OPENAI_API_KEY`, etc. through Coolify's environment variable interface. diff --git a/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx b/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx index 028c6024..eeef8c23 100644 --- a/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx +++ b/apps/public/content/docs/self-hosting/deploy-docker-compose.mdx @@ -126,7 +126,7 @@ If you want to use specific image versions, edit the `docker-compose.yml` file a ```yaml op-api: - image: lindesvard/openpanel-api:v1.0.0 # Specify version + image: lindesvard/openpanel-api:2.0.0 # Specify version ``` ### Scaling Workers diff --git a/apps/public/content/docs/self-hosting/deploy-dokploy.mdx b/apps/public/content/docs/self-hosting/deploy-dokploy.mdx index a9def3eb..a17e9e15 100644 --- a/apps/public/content/docs/self-hosting/deploy-dokploy.mdx +++ b/apps/public/content/docs/self-hosting/deploy-dokploy.mdx @@ -54,8 +54,8 @@ Edit the `.env` file or environment variables in Dokploy. You **must** set these ```bash # Required: Set these to your actual domain -NEXT_PUBLIC_API_URL=https://yourdomain.com/api -NEXT_PUBLIC_DASHBOARD_URL=https://yourdomain.com +API_URL=https://yourdomain.com/api +DASHBOARD_URL=https://yourdomain.com # Database Configuration (automatically set by Dokploy) OPENPANEL_POSTGRES_DB=openpanel-db @@ -71,7 +71,7 @@ OPENPANEL_EMAIL_SENDER=noreply@yourdomain.com ``` -⚠️ **Critical**: Unlike Coolify, Dokploy does not support `SERVICE_FQDN_*` variables. You **must** hardcode `NEXT_PUBLIC_API_URL` and `NEXT_PUBLIC_DASHBOARD_URL` with your actual domain values. +⚠️ **Critical**: Unlike Coolify, Dokploy does not support `SERVICE_FQDN_*` variables. You **must** hardcode `API_URL` and `DASHBOARD_URL` with your actual domain values. @@ -133,8 +133,8 @@ If you're using Cloudflare in front of Dokploy, remember to purge the Cloudflare For Dokploy, you **must** hardcode these variables (unlike Coolify, Dokploy doesn't support `SERVICE_FQDN_*` variables): -- `NEXT_PUBLIC_API_URL` - Full API URL (e.g., `https://analytics.example.com/api`) -- `NEXT_PUBLIC_DASHBOARD_URL` - Full Dashboard URL (e.g., `https://analytics.example.com`) +- `API_URL` - Full API URL (e.g., `https://analytics.example.com/api`) +- `DASHBOARD_URL` - Full Dashboard URL (e.g., `https://analytics.example.com`) Dokploy automatically sets: - `OPENPANEL_POSTGRES_DB` - PostgreSQL database name @@ -166,9 +166,9 @@ If API requests fail after deployment: 1. **Verify environment variables**: ```bash - # Check that NEXT_PUBLIC_API_URL is set correctly - docker exec env | grep NEXT_PUBLIC_API_URL - docker exec env | grep NEXT_PUBLIC_API_URL + # Check that API_URL is set correctly + docker exec env | grep API_URL + docker exec env | grep API_URL ``` 2. **Check "Strip external path" setting**: @@ -188,7 +188,7 @@ If account creation fails: # In Dokploy, view logs for op-api service ``` -2. Verify `NEXT_PUBLIC_API_URL` matches your domain: +2. Verify `API_URL` matches your domain: - Should be `https://yourdomain.com/api` - Not `http://localhost:3000` or similar @@ -240,7 +240,7 @@ The Dokploy template differs from Coolify in these ways: 1. **Environment Variables**: - Dokploy does not support `SERVICE_FQDN_*` variables - - Must hardcode `NEXT_PUBLIC_API_URL` and `NEXT_PUBLIC_DASHBOARD_URL` + - Must hardcode `API_URL` and `DASHBOARD_URL` 2. **Domain Configuration**: - Must manually configure domain paths diff --git a/apps/public/content/docs/self-hosting/environment-variables.mdx b/apps/public/content/docs/self-hosting/environment-variables.mdx index 96298215..d175e0b7 100644 --- a/apps/public/content/docs/self-hosting/environment-variables.mdx +++ b/apps/public/content/docs/self-hosting/environment-variables.mdx @@ -116,7 +116,7 @@ Remove `convert_any_join` from ClickHouse settings. Used for compatibility with ## Application URLs -### NEXT_PUBLIC_API_URL +### API_URL **Type**: `string` **Required**: Yes @@ -126,10 +126,10 @@ Public API URL exposed to the browser. Used by the dashboard frontend and API se **Example**: ```bash -NEXT_PUBLIC_API_URL=https://analytics.example.com/api +API_URL=https://analytics.example.com/api ``` -### NEXT_PUBLIC_DASHBOARD_URL +### DASHBOARD_URL **Type**: `string` **Required**: Yes @@ -139,7 +139,7 @@ Public dashboard URL exposed to the browser. Used by the dashboard frontend and **Example**: ```bash -NEXT_PUBLIC_DASHBOARD_URL=https://analytics.example.com +DASHBOARD_URL=https://analytics.example.com ``` ### API_CORS_ORIGINS @@ -368,7 +368,7 @@ SLACK_STATE_SECRET=your-state-secret ## Self-hosting -### NEXT_PUBLIC_SELF_HOSTED +### SELF_HOSTED **Type**: `boolean` **Required**: No @@ -378,7 +378,7 @@ Enable self-hosted mode. Set to `true` or `1` to enable self-hosting features. U **Example**: ```bash -NEXT_PUBLIC_SELF_HOSTED=true +SELF_HOSTED=true ``` ## Worker & Queue @@ -784,8 +784,8 @@ For a basic self-hosted installation, these variables are required: - `DATABASE_URL` - PostgreSQL connection - `REDIS_URL` - Redis connection - `CLICKHOUSE_URL` - ClickHouse connection -- `NEXT_PUBLIC_API_URL` - API endpoint URL -- `NEXT_PUBLIC_DASHBOARD_URL` - Dashboard URL +- `API_URL` - API endpoint URL +- `DASHBOARD_URL` - Dashboard URL - `COOKIE_SECRET` - Session encryption secret ### Optional but Recommended diff --git a/apps/public/content/docs/self-hosting/self-hosting.mdx b/apps/public/content/docs/self-hosting/self-hosting.mdx index a20328bd..9a53825e 100644 --- a/apps/public/content/docs/self-hosting/self-hosting.mdx +++ b/apps/public/content/docs/self-hosting/self-hosting.mdx @@ -163,7 +163,7 @@ For complete AI configuration details, see the [Environment Variables documentat If you use a managed Redis service, you may need to set the `notify-keyspace-events` manually. -Without this setting we wont be able to listen for expired keys which we use for caluclating currently active vistors. +Without this setting we won't be able to listen for expired keys which we use for calculating currently active visitors. > You will see a warning in the logs if this needs to be set manually. diff --git a/self-hosting/docker-compose.template.yml b/self-hosting/docker-compose.template.yml index 12d9b828..ec9c1577 100644 --- a/self-hosting/docker-compose.template.yml +++ b/self-hosting/docker-compose.template.yml @@ -73,6 +73,8 @@ services: - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/op-config.xml:ro - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/op-user-config.xml:ro - ./clickhouse/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro + environment: + - CLICKHOUSE_SKIP_USER_SETUP=1 healthcheck: test: ["CMD-SHELL", 'clickhouse-client --query "SELECT 1"'] interval: 10s @@ -89,7 +91,7 @@ services: max-file: "3" op-api: - image: lindesvard/openpanel-api:latest + image: lindesvard/openpanel-api:2.0.0 restart: always command: > sh -c " @@ -119,7 +121,7 @@ services: max-file: "3" op-dashboard: - image: lindesvard/openpanel-dashboard:latest + image: lindesvard/openpanel-dashboard:2.0.0 restart: always depends_on: op-api: @@ -139,7 +141,7 @@ services: max-file: "3" op-worker: - image: lindesvard/openpanel-worker:latest + image: lindesvard/openpanel-worker:2.0.0 restart: always depends_on: op-api: diff --git a/sh/docker-build b/sh/docker-build index 45509b4c..821bc121 100755 --- a/sh/docker-build +++ b/sh/docker-build @@ -38,7 +38,13 @@ docker buildx create --name multi-arch-builder --use || true build_image() { local app=$1 local image_name="lindesvard/openpanel-$app" - local full_version="$image_name:$VERSION" + local full_version="$image_name:$VERSION-$PRERELEASE" + + # Use apps/start/Dockerfile for dashboard app + local dockerfile="apps/$app/Dockerfile" + if [ "$app" = "dashboard" ]; then + dockerfile="apps/start/Dockerfile" + fi if [ -n "$PRERELEASE" ]; then echo "(pre-release) Building multi-architecture image for $full_version" @@ -46,7 +52,7 @@ build_image() { --platform linux/amd64,linux/arm64 \ -t "$full_version" \ --build-arg DATABASE_URL="postgresql://p@p:5432/p" \ - -f "apps/$app/Dockerfile" \ + -f "$dockerfile" \ --push \ . else @@ -56,7 +62,7 @@ build_image() { -t "$full_version" \ -t "$image_name:latest" \ --build-arg DATABASE_URL="postgresql://p@p:5432/p" \ - -f "apps/$app/Dockerfile" \ + -f "$dockerfile" \ --push \ . fi