用Docker自建Plausible

git clone https://github.com/plausible/community-edition/

修改配置,这里我外面还要套一层Caddy

echo "BASE_URL=https://plausible.yourdomain.com" >> .env
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
echo "HTTP_PORT=80" >> .env

修改配置,这里我自定义了docker存储,方便备份迁移

# ./compose.override.yml 
services:
    plausible:
        ports:
            - 8989:80
    plausible_db:
      volumes:
        - /your_path/plausible/postgres:/var/lib/postgresql/data

    plausible_events_db:
      volumes:
        - /your_path/plausible/clickhouse:/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

启动

docker compose up -d

caddy配置

plausible.yourdomain.com {
    reverse_proxy 127.0.0.1:8989
}

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *