Plausible Analytics Docker部署教程

发布于 25 天前  102 次阅读


Requirements:

安装 Plausible Analytics 唯一需要的是安装了 Docker 的服务器。服务器必须具有 x86_64 架构的 CPU 并支持 SSE 4.2 指令。我们建议使用至少 4GB 的 RAM。

Up and running:

git clone https://github.com/plausible/hosting
cd hosting

获得两个文件 docker-compose.yml,plausible-conf.env。

plausible-conf.env 配置

ADMIN_USER_EMAIL=邮箱
ADMIN_USER_NAME=昵称
ADMIN_USER_PWD=密码
BASE_URL=https://analytics.lirica.cn
SECRET_KEY_BASE= 64位字符密钥
生成64位字符密钥
openssl rand -base64 64 | tr -d '\n' ; echo

docker-compose.yml 配置

version: "3.3"
services:
  mail:
    image: bytemark/smtp
    restart: always

  plausible_db:
    image: postgres:12
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres

  plausible_events_db:
    image: yandex/clickhouse-server:21.3.2.5
    restart: always
    volumes:
      - event-data:/var/lib/clickhouse
      - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
      - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144

  plausible:
    image: plausible/analytics:latest
    restart: always
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"
    depends_on:
      - plausible_db
      - plausible_events_db
      - mail
    ports:
      - 127.0.01:8000:8000
    env_file:
      - plausible-conf.env

volumes:
  db-data:
    driver: local
  event-data:
    driver: local
  geoip:
    driver: local

启动

docker-compose up -d

反向代理

127.0.0.1:8000


愛衣ちゃん大勝利