community-edition

community-edition

Plausible Analytics自托管版 - 简洁高效的网站统计工具

Plausible Analytics社区版是一款轻量级的开源自托管网站分析工具,采用Docker快速部署,支持HTTPS和反向代理。它能帮助网站运营者追踪和分析流量数据,同时特别注重用户隐私保护。该工具提供简便的安装配置流程、完整的版本管理、升级指南以及丰富的自定义选项,可满足不同用户的个性化需求。

Plausible Community Edition自托管Docker配置升级Github开源项目
<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./images/logo_dark.svg" width="300"> <source media="(prefers-color-scheme: light)" srcset="./images/logo_light.svg" width="300"> <img src="./images/logo_light.svg" width="300"> </picture> </p> <p align="center"> <strong>A getting started guide to self-hosting <a href="https://plausible.io/blog/community-edition">Plausible Community Edition</a></strong> </p> <!-- TODO latest version, current version, requirements -->

Contact:


<p align="center"> <a href="#install">Install</a> &bull; <a href="#upgrade">Upgrade</a> &bull; <a href="#configure">Configure</a> &bull; <a href="#integrate">Integrate</a> &bull; <a href="#faq">FAQ</a> </p>

Install

Plausible Community Edition (or CE for short) is designed to be self-hosted through Docker. You don't have to be a Docker expert to launch your own instance, but you should have a basic understanding of the command-line and networking to successfully set it up.

Requirements

The only thing you need to install Plausible CE is a server with Docker. The server must have a CPU with x86_64 or arm64 architecture and support for SSE 4.2 or equivalent NEON instructions. We recommend using a minimum of 4GB of RAM but the requirements will depend on your site traffic.

We've tested this on Digital Ocean (affiliate link) but any hosting provider works. If your server doesn't come with Docker pre-installed, you can follow their docs to install it.

To make your Plausible CE instance accessible on a (sub)domain, you also need to be able to edit your DNS. Plausible CE isn't currently designed for subfolder installations.

Quick start

To get started quickly, clone the plausible/community-edition repo. It has everything you need to boot up your own Plausible CE server.

<sub><kbd>console</kbd></sub>

$ git clone https://github.com/plausible/community-edition hosting Cloning into 'community-edition'... remote: Enumerating objects: 280, done. remote: Counting objects: 100% (146/146), done. remote: Compressing objects: 100% (74/74), done. remote: Total 280 (delta 106), reused 86 (delta 71), pack-reused 134 Receiving objects: 100% (280/280), 69.44 KiB | 7.71 MiB/s, done. Resolving deltas: 100% (136/136), done. $ ls hosting README.md clickhouse/ docker-compose.yml images/ plausible-conf.env reverse-proxy/ upgrade/

In the downloaded directory you'll find two important files:

  • docker-compose.yml — installs and orchestrates networking between your Plausible CE server, Postgres database, and Clickhouse database for stats.
  • plausible-conf.env — configures the Plausible server itself. Full configuration options are documented below.

Right now the latter looks like this:

<sub><kbd>plausible-conf.env</kbd></sub>

BASE_URL=replace-me SECRET_KEY_BASE=replace-me TOTP_VAULT_KEY=replace-me

Let's do as it asks and populate these required environment variables with our own values.

Required configuration

First we generate the secret key base and TOTP vault key using OpenSSL:

<sub><kbd>console</kbd></sub>

$ openssl rand -base64 48 GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz $ openssl rand -base64 32 dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=

And then we decide on the base URL where the instance would be accessible:

<sub><kbd>plausible-conf.env</kbd></sub>

- BASE_URL=replace-me + BASE_URL=http://plausible.example.com - SECRET_KEY_BASE=replace-me + SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz - TOTP_VAULT_KEY=replace-me + TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=

We can start our instance now but the requests would be served over HTTP. Not cool! Let's configure Caddy to enable HTTPS.

Caddy

[!TIP] For other reverse-proxy setups please see reverse-proxy docs.

<details> <summary>Don't need reverse proxy?</summary>

If you're opting out of a reverse proxy and HTTPS, you'll need to adjust the Plausible service configuration to ensure it's not limited to localhost (127.0.0.1). This change allows the service to be accessible from any network interface:

<sub><kbd>docker-compose.yml</kbd></sub>

plausible: ports: - - 127.0.0.1:8000:8000 + - 8000:8000

</details>

First we need to point DNS records for our base URL to the IP address of the instance. This is needed for Caddy to issue the TLS certificates.

Then we need to let Caddy know the domain name for which to issue the TLS certificate and the service to redirect the requests to.

<sub><kbd>reverse-proxy/docker-compose.caddy-gen.yml</kbd></sub>

plausible: labels: - virtual.host: "example.com" # change to your domain name + virtual.host: "plausible.example.com" virtual.port: "8000" - virtual.tls-email: "admin@example.com" # change to your email + virtual.tls-email: "admin@plausible.example.com"

Finally we need to update the base URL to use HTTPS scheme.

<sub><kbd>plausible-conf.env</kbd></sub>

- BASE_URL=http://plausible.example.com + BASE_URL=https://plausible.example.com SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=

Now we can start everything together.

Launch

<sub><kbd>console</kbd></sub>

$ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up -d [+] Running 19/19 ✔ plausible_db 9 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled ✔ plausible_events_db 7 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled ✔ plausible 7 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled ✔ caddy-gen 8 layers [⣿⣿⣿⣿⣿⣿⣿⣿] Pulled [+] Running 5/5 ✔ Network hosting_default Created ✔ Container hosting-plausible_db-1 Started ✔ Container hosting-plausible_events_db-1 Started ✔ Container hosting-plausible-1 Started ✔ Container caddy-gen Started

It takes some time to start PostgreSQL and ClickHouse, create the databases, and run the migrations. After about fifteen seconds you should be able to access your instance at the base URL and see the registration screen for the admin user.

[!TIP] If something feels off, make sure to check out the logs with <kbd>docker compose logs</kbd> and start a GitHub discussion.

🎉 Happy hosting! 🚀

Next we'll go over how to upgrade the instance when a new release comes out, more things to configure, and how to integrate with Google and others!

Upgrade

Each new release contains information on how to upgrade to it from the previous version. This section outlines the general steps and explains the versioning.

Version management

Plausible CE follows semantic versioning: MAJOR.MINOR.PATCH

You can find available Plausible versions on Github packages. The default latest tag refers to the latest stable release tag. You can also pin your version:

  • <kbd>ghcr.io/plausible/community-edition:v2</kbd> pins the major version to 2 but allows minor and patch version upgrades
  • <kbd>ghcr.io/plausible/community-edition:v2.1</kbd> pins the minor version to 2.1 but allows only patch upgrades

None of the functionality is backported to older versions. If you wish to get the latest bug fixes and security updates you need to upgrade to a newer version.

New versions are published on the releases page and their changes are documented in our Changelog. Please note that database schema changes require running migrations when you're upgrading. However, we consider the schema as an internal API and therefore schema changes aren't considered a breaking change.

We recommend to pin the major version instead of using latest. Either way the general flow for upgrading between minor version would look like this:

<sub><kbd>console</kbd></sub>

$ cd hosting # or wherever you cloned this repo $ docker compose stop plausible [+] Running 1/1 ✔ Container hosting-plausible-1 Stopped $ docker compose rm plausible ? Going to remove hosting-plausible-1 Yes [+] Running 1/0 ✔ Container hosting-plausible-1 Removed $ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up -d [+] Running 8/8 ✔ plausible 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 6.4s ✔ 96526aa774ef Pull complete 0.4s ✔ 93631fa7258d Pull complete 0.6s ✔ 06afbc05374b Pull complete 1.6s ✔ 7ddeeadcce1e Pull complete 1.2s ✔ 724ddb9b523f Pull complete 2.8s ✔ 32581b0068b9 Pull complete 1.7s ✔ 4f4fb700ef54 Pull complete 2.0s [+] Running 4/4 ✔ Container hosting-plausible_events_db-1 Running 0.0s ✔ Container hosting-plausible_db-1 Running 0.0s ✔ Container hosting-plausible-1 Started 1.2s ✔ Container caddy-gen Running 0.0s $ docker images --filter=reference='ghcr.io/plausible/community-edition:*' REPOSITORY TAG IMAGE ID CREATED SIZE ghcr.io/plausible/community-edition v2.1 63f7c8708294 6 days ago 83.4MB ghcr.io/plausible/community-edition v2.1.0-rc.0 2b2735265a65 7 months ago 163MB $ docker rmi 2b2735265a65 Untagged: ghcr.io/plausible/community-edition:v2.1.0-rc.0 ...

[!TIP] You can omit <kbd>-f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml</kbd> if you are not using Caddy.

Changes in major versions would involve performing a data migration (e.g. v2.0.0) or some other extra step.

Configure

Plausible is configured with environment variables, by default supplied via plausible-conf.env env_file.

[!WARNING] Note that if you start a container with one set of ENV vars and then update the ENV vars and restart the container, they won't take effect due to the immutable nature of the containers. The container needs to be recreated.

Example configurations

Here's the minimal configuration file we got from the quick start:

<sub><kbd>plausible-conf.env</kbd></sub>

BASE_URL=https://plausible.example.com SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=

And here's a configuration with some extra options provided:

<sub><kbd>plausible-conf.env</kbd></sub>

BASE_URL=https://plausible.example.com SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I= MAXMIND_LICENSE_KEY=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 MAXMIND_EDITION=GeoLite2-City GOOGLE_CLIENT_ID=140927866833-002gqg48rl4iku76lbkk0qhu0i0m7bia.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 MAILER_NAME=Plausible MAILER_EMAIL=somebody+plausible@gmail.com MAILER_ADAPTER=Bamboo.Mua SMTP_HOST_ADDR=smtp.gmail.com SMTP_HOST_PORT=587 SMTP_USER_NAME=somebody@gmail.com SMTP_USER_PWD="wnqj fkbn jcwc byxk" DISABLE_REGISTRATION=invite_only

Here're the currently supported ENV vars:

Required

BASE_URL

Configures the base URL to use in link generation, doesn't have any defaults and needs to be provided in the ENV vars

<sub><kbd>plausible-conf.env</kbd></sub>

BASE_URL=https://plausible.example.com

[!NOTE] In production systems, this should be your ingress host (CDN or proxy).


SECRET_KEY_BASE

Configures the secret used for sessions in the dashboard, doesn't have any defaults and needs to be provided in the ENV vars, can be generated with OpenSSL:

<sub><kbd>console</kbd></sub>

$ openssl rand -base64 48 GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz

<sub><kbd>plausible-conf.env</kbd></sub>

SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz

[!WARNING] Don't use this exact value or someone would be able to sign a cookie with user_id=1 and log in as the admin!


TOTP_VAULT_KEY

Configures the secret used for encrypting TOTP secrets at rest using AES256-GCM, doesn't have any defaults and needs to be provided in the ENV vars, can be generated with OpenSSL:

<sub><kbd>console</kbd></sub>

$ openssl rand -base64

编辑推荐精选

酷表ChatExcel

酷表ChatExcel

大模型驱动的Excel数据处理工具

基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。

AI工具酷表ChatExcelAI智能客服AI营销产品使用教程
DeepEP

DeepEP

DeepSeek开源的专家并行通信优化框架

DeepEP是一个专为大规模分布式计算设计的通信库,重点解决专家并行模式中的通信瓶颈问题。其核心架构采用分层拓扑感知技术,能够自动识别节点间物理连接关系,优化数据传输路径。通过实现动态路由选择与负载均衡机制,系统在千卡级计算集群中维持稳定的低延迟特性,同时兼容主流深度学习框架的通信接口。

DeepSeek

DeepSeek

全球领先开源大模型,高效智能助手

DeepSeek是一家幻方量化创办的专注于通用人工智能的中国科技公司,主攻大模型研发与应用。DeepSeek-R1是开源的推理模型,擅长处理复杂任务且可免费商用。

问小白

问小白

DeepSeek R1 满血模型上线

问小白是一个基于 DeepSeek R1 模型的智能对话平台,专为用户提供高效、贴心的对话体验。实时在线,支持深度思考和联网搜索。免费不限次数,帮用户写作、创作、分析和规划,各种任务随时完成!

AI主流办公工具有哪些办公热门AI 助手
KnowS

KnowS

AI医学搜索引擎 整合4000万+实时更新的全球医学文献

医学领域专用搜索引擎整合4000万+实时更新的全球医学文献,通过自主研发AI模型实现精准知识检索。系统每日更新指南、中英文文献及会议资料,搜索准确率较传统工具提升80%,同时将大模型幻觉率控制在8%以下。支持临床建议生成、文献深度解析、学术报告制作等全流程科研辅助,典型用户反馈显示每周可节省医疗工作者70%时间。

Windsurf Wave 3

Windsurf Wave 3

Windsurf Editor推出第三次重大更新Wave 3

新增模型上下文协议支持与智能编辑功能。本次更新包含五项核心改进:支持接入MCP协议扩展工具生态,Tab键智能跳转提升编码效率,Turbo模式实现自动化终端操作,图片拖拽功能优化多模态交互,以及面向付费用户的个性化图标定制。系统同步集成DeepSeek、Gemini等新模型,并通过信用点数机制实现差异化的资源调配。

AI IDE
腾讯元宝

腾讯元宝

腾讯自研的混元大模型AI助手

腾讯元宝是腾讯基于自研的混元大模型推出的一款多功能AI应用,旨在通过人工智能技术提升用户在写作、绘画、翻译、编程、搜索、阅读总结等多个领域的工作与生活效率。

AI助手AI对话AI工具腾讯元宝智能体热门 AI 办公助手
Grok3

Grok3

埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型

Grok3 是由埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型,常被马斯克称为“地球上最聪明的 AI”。它不仅是在前代产品 Grok 1 和 Grok 2 基础上的一次飞跃,还在多个关键技术上实现了创新突破。

OmniParser

OmniParser

帮助AI理解电脑屏幕 纯视觉GUI元素的自动化解析方案

开源工具通过计算机视觉技术实现图形界面元素的智能识别与结构化处理,支持自动化测试脚本生成和辅助功能开发。项目采用模块化设计,提供API接口与多种输出格式,适用于跨平台应用场景。核心算法优化了元素定位精度,在动态界面和复杂布局场景下保持稳定解析能力。

OmniParser界面解析交互区域检测Github开源项目
流畅阅读

流畅阅读

AI网页翻译插件 双语阅读工具,还原母语级体验

流畅阅读是一款浏览器翻译插件,通过上下文智能分析提升翻译准确性,支持中英双语对照显示。集成多翻译引擎接口,允许用户自定义翻译规则和快捷键配置,操作数据全部存储在本地设备保障隐私安全。兼容Chrome、Edge、Firefox等主流浏览器,基于GPL-3.0开源协议开发,提供持续的功能迭代和社区支持。

AI翻译AI翻译引擎AI翻译工具
下拉加载更多