-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GEOIPUPDATE_ACCOUNT_ID=123456 | ||
GEOIPUPDATE_LICENSE_KEY=abcd12345 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<clickhouse> | ||
<logger> | ||
<level>warning</level> | ||
<console>true</console> | ||
</logger> | ||
|
||
<!-- 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"/> | ||
</clickhouse> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<clickhouse> | ||
<profiles> | ||
<default> | ||
<log_queries>0</log_queries> | ||
<log_query_threads>0</log_query_threads> | ||
</default> | ||
</profiles> | ||
</clickhouse> |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
version: "3.3" | ||
services: | ||
|
||
geoip: | ||
image: maxmindinc/geoipupdate | ||
restart: always | ||
environment: | ||
- 'GEOIPUPDATE_EDITION_IDS=GeoLite2-City GeoLite2-Country' | ||
- 'GEOIPUPDATE_FREQUENCY=72' | ||
env_file: | ||
- ./GeoIP/geoip.conf | ||
volumes: | ||
- ./GeoIP:/usr/share/GeoIP | ||
|
||
plausible_db: | ||
image: postgres:14-alpine | ||
restart: always | ||
volumes: | ||
- ./db-data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_PASSWORD=postgres | ||
|
||
plausible_events_db: | ||
image: clickhouse/clickhouse-server:22.6-alpine | ||
restart: always | ||
volumes: | ||
- ./clickhouse/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 run" | ||
depends_on: | ||
- plausible_db | ||
- plausible_events_db | ||
- geoip | ||
ports: | ||
- "127.0.0.1:8000:8000" | ||
env_file: | ||
- ./plausible-conf.env | ||
environment: | ||
- TZ=Asia/Shanghai | ||
volumes: | ||
- ./GeoIP:/geoip:ro | ||
- ./GeoIP/geonames.csv:/etc/app/geonames.csv:ro | ||
- ./GeoIP/GeoLite2-City.mmdb:/etc/app/GeoLite2-City.mmdb:ro | ||
- ./GeoIP/GeoLite2-Country.mmdb:/etc/app/GeoLite2-Country.mmdb:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DISABLE_REGISTRATION=true | ||
BASE_URL=https://plausible.yourdomain.com | ||
GOOGLE_CLIENT_ID= | ||
GOOGLE_CLIENT_SECRET= | ||
MAILER_EMAIL=[email protected] | ||
SMTP_HOST_ADDR=smtp.xxx.com | ||
SMTP_HOST_PORT=465 | ||
SMTP_USER_NAME=[email protected] | ||
SMTP_USER_PWD= | ||
SMTP_HOST_SSL_ENABLED=true | ||
SMTP_RETRIES=2 | ||
SECRET_KEY_BASE= | ||
GEOLITE2_COUNTRY_DB=/etc/app/GeoLite2-Country.mmdb | ||
IP_GEOLOCATION_DB=/etc/app/GeoLite2-City.mmdb | ||
GEONAMES_SOURCE_FILE=/etc/app/geonames.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo -e "本脚本将帮助您使用 Docker Compose 快速部署 Plausible\nAuthor: Dejavu Moe\nPost:https://dejavu.moe/posts/plausible-selfhosted-with-docker-complete-guide/" | ||
read -p "请按 Enter 键继续..." enter | ||
|
||
if [[ "$(command -v docker)" == "" && "$(command -v docker compose)" == "" ]]; then | ||
echo "您的机器上尚未安装最新版的 Docker 和 Docker Compose 插件,执行中止" | ||
exit 1 | ||
else | ||
echo "开始执行脚本" | ||
fi | ||
|
||
echo "Plausible 相关的持久化数据将会被保存在 $(pwd)/container/plausible/" | ||
|
||
if [ -d container ]; then | ||
echo "当前目录下已经存在 container 文件夹,跳过目录创建" | ||
else | ||
mkdir container | ||
echo "已创建 container 文件夹" | ||
fi | ||
|
||
cd container | ||
git init | ||
git remote add origin https://github.com/DejavuMoe/self-hosted.git | ||
git config --local core.sparsecheckout true | ||
echo "plausible" >> .git/info/sparse-checkout | ||
git pull --depth=1 origin master | ||
cd plausible | ||
echo "正在下载 geonames.csv.数据库..." | ||
wget https://s3.eu-central-1.wasabisys.com/plausible-application/geonames.csv -P GeoIP/ | ||
echo -e "Plausible 所需的环境已经初始化完成\n请完成环境变量的填写\n之后在当前目录使用下面命令完成部署\nsudo docker compose up -d\n按任意键退出..." | ||
read -n 1 -s -r -p "" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name plausible.yourdomain.com; | ||
|
||
return 301 https://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
listen [::]:443 ssl http2; | ||
server_name plausible.yourdomain.com; | ||
|
||
access_log /var/log/nginx/plausible.access.log; | ||
error_log /var/log/nginx/plausible.error.log; | ||
|
||
ssl_certificate /etc/nginx/cert/plausible.yourdomain.com.pem; | ||
ssl_certificate_key /etc/nginx/cert/plausible.yourdomain.com.key; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_prefer_server_ciphers on; | ||
ssl_session_cache shared:SSL:10m; | ||
ssl_session_timeout 5m; | ||
ssl_ciphers 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+AESGCM:EDH+AESGCM:EECDH+CHACHA20:EDH+CHACHA20:EECDH+AES128:EDH+AES128:EECDH+AES256:EDH+AES256:EECDH+3DES:EDH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS'; | ||
|
||
location / { | ||
proxy_pass http://localhost:8000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-Proto https; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_redirect off; | ||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; | ||
} | ||
} |