docker + Umami + Postgresql 网站访问分析
1 # docker + Umami + Postgresql
2 # 官方安装文档:https://umami.is/docs/install
3 # 一、创建数据库
4 # 1.创建用户
5 CREATE ROLE umami PASSWORD 'xxx' login;
6 # 2.创建数据库
7 create database umami_db;
8 # 3.修改数据库的拥有者
9 alter database umami_db owner to "umami";
10 # 4.创建数据库表-如果你想从官方下载的话就得克隆(博客后面会提供sql窗表语句)
11 先克隆:git clone https://github.com/mikecao/umami.git
12 创建表sql语句文件路劲在:umami/sql/schema.postgresql.sql
13 执行语句:psql -h locahost -p 5432 -d umami_db -U umami -W -f ~/umami/sql/schema.postgresql.sql
14 # 5.数据库的URL
15 postgresql://umami:xxx@localhost:5432/umami_db
16 # 二、运行docker
17 docker container run --name umami-odoo -p 3000:3000 -e DATABASE_URL="postgresql://umami:xxx@localhost:5432/umami_db" -e DATABASE_TYPE="postgresql" -d ghcr.io/mikecao/umami:postgresql-latest
18 # 三、访问http://localhost:3000
19 # 1.进入设置界面
20 # 2.添加你的网站(共享勾上)
21 # 3.然后生成的网站记录右边有几个按钮,点击“获取跟踪代码”
22 # 4.将跟踪代码复制到你的网站的head元素里就行(这就查看网站的点击量了)
23 # 5.再点击“获取共享链接”,那就可以吧网站分析的内容显示在你的网站里边了
24 <iframe style="width: 100%; height: 1200px;" scrolling="no" frameborder="0" src="http://localhost:3000/share/79eDmaOf/test"></iframe>
创建表的语句
drop table if exists event;
drop table if exists pageview;
drop table if exists session;
drop table if exists website;
drop table if exists account; create table account (
user_id serial primary key,
username varchar(255) unique not null,
password varchar(60) not null,
is_admin bool not null default false,
created_at timestamp with time zone default current_timestamp,
updated_at timestamp with time zone default current_timestamp
); create table website (
website_id serial primary key,
website_uuid uuid unique not null,
user_id int not null references account(user_id) on delete cascade,
name varchar(100) not null,
domain varchar(500),
share_id varchar(64) unique,
created_at timestamp with time zone default current_timestamp
); create table session (
session_id serial primary key,
session_uuid uuid unique not null,
website_id int not null references website(website_id) on delete cascade,
created_at timestamp with time zone default current_timestamp,
hostname varchar(100),
browser varchar(20),
os varchar(20),
device varchar(20),
screen varchar(11),
language varchar(35),
country char(2)
); create table pageview (
view_id serial primary key,
website_id int not null references website(website_id) on delete cascade,
session_id int not null references session(session_id) on delete cascade,
created_at timestamp with time zone default current_timestamp,
url varchar(500) not null,
referrer varchar(500)
); create table event (
event_id serial primary key,
website_id int not null references website(website_id) on delete cascade,
session_id int not null references session(session_id) on delete cascade,
created_at timestamp with time zone default current_timestamp,
url varchar(500) not null,
event_type varchar(50) not null,
event_value varchar(50) not null
); create index website_user_id_idx on website(user_id); create index session_created_at_idx on session(created_at);
create index session_website_id_idx on session(website_id); create index pageview_created_at_idx on pageview(created_at);
create index pageview_website_id_idx on pageview(website_id);
create index pageview_session_id_idx on pageview(session_id);
create index pageview_website_id_created_at_idx on pageview(website_id, created_at);
create index pageview_website_id_session_id_created_at_idx on pageview(website_id, session_id, created_at); create index event_created_at_idx on event(created_at);
create index event_website_id_idx on event(website_id);
create index event_session_id_idx on event(session_id); insert into account (username, password, is_admin) values ('admin', '$2b$10$BUli0c.muyCW1ErNJc3jL.vFRFtFJWrT8/GcR4A.sUdCznaXiqFXa', true);
docker + Umami + Postgresql 网站访问分析的更多相关文章
- 网站访问分析对SEO的好处
统计剖析,应该说是每个SEO都必需要擅长的技艺.至于网站统计的剖析,根据自己的一些经验,与大家分享一下相关技巧.(发表于 2012-3-24 23:12) 申请一个统计帐号很容易,现在有很多的统计服务 ...
- 对Oracle 、SQL Server、MySQL、PostgreSQL数据库优缺点分析
对Oracle .SQL Server.MySQL.PostgreSQL数据库优缺点分析 Oracle Database Oracle Database,又名Oracle RDBMS,或简称Oracl ...
- Hadoop学习笔记—20.网站日志分析项目案例(一)项目介绍
网站日志分析项目案例(一)项目介绍:当前页面 网站日志分析项目案例(二)数据清洗:http://www.cnblogs.com/edisonchou/p/4458219.html 网站日志分析项目案例 ...
- Hadoop学习笔记—20.网站日志分析项目案例(二)数据清洗
网站日志分析项目案例(一)项目介绍:http://www.cnblogs.com/edisonchou/p/4449082.html 网站日志分析项目案例(二)数据清洗:当前页面 网站日志分析项目案例 ...
- Hadoop学习笔记—20.网站日志分析项目案例(三)统计分析
网站日志分析项目案例(一)项目介绍:http://www.cnblogs.com/edisonchou/p/4449082.html 网站日志分析项目案例(二)数据清洗:http://www.cnbl ...
- Flickr 网站架构分析
Flickr 网站架构分析 Flickr.com 是网上最受欢迎的照片共享网站之一,还记得那位给Windows Vista拍摄壁纸的Hamad Darwish吗?他就是将照片上传到Flickr,后而被 ...
- 如何使用ping和tracert命令测试网站访问速度
在我们平时访问的网站中,有一些网站访问速度非常快,比如百度搜索网站和一些门户网站,有些网站访问很慢,有些网站甚至无法访问.那么我们该如何判断这些网站的访问速度呢?下面我们就使用Windows的ping ...
- Docker学习笔记 - Docker部署nginx网站
一.制作 nginx 镜像 1.下载配置文件 mkdir /opt/nginx_docker && cd /opt/nginx_docker mkdir nginx && ...
- 借网站日记分析~普及一下Pandas基础
对网站日记分析其实比较常见,今天模拟演示一下一些应用场景,也顺便说说Pandas,图示部分也简单分析了下 1.数据清洗¶ 一般数据都不可能直接拿来用的,或多或少都得清理一下,我这边就模拟一下清洗完 ...
随机推荐
- python 通过线上API查询ip归属地
API为国外API,频率限制1分钟45个ip 脚本如下 1 #!/usr/bin/env python3 2 #-*-coding:utf-8-*- 3 4 import requests,re,js ...
- Python的.gitignore模板
参考:https://github.com/github/gitignore Python的.gitignore模板,记录一下方便查询 # Byte-compiled / optimized / DL ...
- 好客租房25-react中的事件处理(事件对象)
3.2事件对象 可以通过事件处理程序的参数 React中的事件对象叫做:合成事件(对象) 合成事件:兼容所有浏览器 //导入react import React from 'react' ...
- python读取csv、excel、mysql内容
前提:导入扩展包 import pandas as pd import pymysql ①读取csv文件 fpath='/test.csv'ratings=pd.read_csv(fpath)prin ...
- python之数据类型的内置方法(set、tuple、dict)与简单认识垃圾回收机制
目录 字典的内置方法 类型转换 字典取值 修改值 计算字典长度 成员运算 删除元素 获取元素 更新字典 快速生成字典 setdefault()方法 元组的内置方法 类型转换 索引与切片操作 统计长度 ...
- 【HEOI2014】大工程<虚树>
虚树 我们每天都用心思索着,这究竟是为了什么呢?我想我也不知道,只是觉得如果人不思考问题就很无聊. 我觉得虚树不是什么数据结构,就是一种技巧或者工具.它能把树中\(k\)个关键点以\(O(klogk) ...
- Eureka服务下线太慢,电话被告警打爆了
某年某月的某一天,就像一张破碎的脸... 错了,重来. 某天,忽然发现大量的告警,经过多番调查研究考察(此处省略3000字),发现是由于 Eureka 服务下线太慢,而仍然有大量的请求打进来导致的报错 ...
- Linux文本搜索及截取操作
Linux文本搜索及截取操作 cat 查看 grep 搜索 awk 截取 查看dna-server.xml 文件的内容 [root@localhost servers]# cat cwag9002/w ...
- Base64编码知识详解
在我们进行前端开发时,针对项目优化,常会提到一条:针对较小图片,合理使用Base64字符串替换内嵌,可以减少页面http请求. 并且还会特别强调下,必须是小图片,大小不要超过多少KB,等等. 那么,B ...
- JS数组at函数(获取最后一个元素的方法)介绍
本文介绍js中数组的at函数,属于比较简单的知识普及性文章,难度不大. 0x00 首先,我们可以思考如下一个问题,如果要获取一个数组的最后一个元素(这是很常用的操作),我们应该怎么做? 相信大部分人能 ...