网站统计工具Umami

Umami是干什么的

Umami 是一个开源免费,可自托管,用途类似 Google Analytics。网站数据收集访问量(PV、UV)、流量来源等基本信息,试用了一段时间,觉得确实简单易用,值得关注。

官网地址

安装使用

推荐docker或Railway部署

docker版本

这里以mysql为例:

#1. 拉取镜像
docker pull docker.umami.dev/umami-software/umami:mysql-latest
#2. 运行容器,先确保存在umami 
docker run -d \
--name umami \
-p 3000:3000 \
-e DATABASE_URL=mysql://<username>:<password>@<host>:3306/umami \
-e DATABASE_TYPE=mysql \
-e HASH_SALT=Umami-yunong \
--restart always \
docker.umami.dev/umami-software/umami:mysql-latest

容器启动后在浏览器访问:http://ip:3000

a. 登录

file

b. 添加站点

file

c. 编辑->跟踪代码

file
将这段粘贴到网站的头部信息中,就可以实现跟踪效果

d. 效果

file

Railway 部署(推荐)

umami 官方文档中介绍了多种部署方法,包括部署到 Vercel、Railway 等方法。我一开始是使用 docker 部署在自己的服务器上,但后来发现使用 Railway 托管似乎更简单,且它每个月有5美元免费额度应该足够支持我的用量了,于是便又迁移到了 Railway。具体参考官网在Railway部署的文档
file
部署完成后,效果跟docker版本一样,参考上图

踩坑指南

**切记不能自己执行sql语句**,无论docker版还是Railway中,都报错,显示数据库能正常连接,却无法启动,最终的原因是:因为在我创建好数据库后,又在官网github源码中找了sql先自行初始化,导致启动报错。

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.19
$ npm-run-all check-db update-tracker start-server
$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✓ Database connection successful.
✓ Database version check successful.
Error: P3005
The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
✗ Command failed: prisma migrate deploy
Error: P3005
The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

博客地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值