Skip to content

Commit d76603b

Browse files
authored
Merge pull request #3061 from umami-software/dev
v2.14.0
2 parents d324305 + 620a838 commit d76603b

File tree

128 files changed

+16222
-2374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+16222
-2374
lines changed

.github/workflows/cd-cloud.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Create docker images
2+
3+
on:
4+
push:
5+
branches:
6+
- analytics
7+
8+
jobs:
9+
build:
10+
name: Build, push, and deploy
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Generate random hash
17+
id: random_hash
18+
run: echo "hash=$(openssl rand -hex 4)" >> $GITHUB_OUTPUT
19+
20+
- uses: mr-smithers-excellent/docker-build-push@v6
21+
name: Build & push Docker image to docker.io
22+
with:
23+
image: umamisoftware/umami
24+
tags: cloud-${{ steps.random_hash.outputs.hash }}, cloud-latest
25+
buildArgs: DATABASE_TYPE=postgresql
26+
registry: docker.io
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/cd-manual.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,26 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v3
2222

23+
- name: Extract version parts from input
24+
id: extract_version
25+
run: |
26+
echo "version=$(echo ${{ github.event.inputs.version }})" >> $GITHUB_ENV
27+
echo "major=$(echo ${{ github.event.inputs.version }} | cut -d. -f1)" >> $GITHUB_ENV
28+
echo "minor=$(echo ${{ github.event.inputs.version }} | cut -d. -f2)" >> $GITHUB_ENV
29+
30+
- name: Generate tags
31+
id: generate_tags
32+
run: |
33+
echo "tag_major=$(echo ${{ matrix.db-type }}-${{ env.major }})" >> $GITHUB_ENV
34+
echo "tag_minor=$(echo ${{ matrix.db-type }}-${{ env.major }}.${{ env.minor }})" >> $GITHUB_ENV
35+
echo "tag_patch=$(echo ${{ matrix.db-type }}-${{ env.version }})" >> $GITHUB_ENV
36+
echo "tag_latest=$(echo ${{ matrix.db-type }}-latest)" >> $GITHUB_ENV
37+
2338
- uses: mr-smithers-excellent/docker-build-push@v6
2439
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
2540
with:
2641
image: umami
27-
tags: ${{ matrix.db-type }}-${{ inputs.version }}, ${{ matrix.db-type }}-latest
42+
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
2843
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
2944
registry: ghcr.io
3045
multiPlatform: true
@@ -36,7 +51,7 @@ jobs:
3651
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
3752
with:
3853
image: umamisoftware/umami
39-
tags: ${{ matrix.db-type }}-${{ inputs.version }}, ${{ matrix.db-type }}-latest
54+
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
4055
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
4156
registry: docker.io
4257
username: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/cd.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,33 @@ jobs:
1717

1818
- name: Set env
1919
run: |
20-
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
2120
echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
21+
22+
- name: Generate tags
23+
id: generate_tags
24+
run: |
25+
echo "tag_patch=$(echo ${{ matrix.db-type }})-${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
26+
echo "tag_minor=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1,2)" >> $GITHUB_ENV
27+
echo "tag_major=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1)" >> $GITHUB_ENV
28+
echo "tag_latest=$(echo ${{ matrix.db-type }})-latest" >> $GITHUB_ENV
2229
2330
- uses: mr-smithers-excellent/docker-build-push@v6
2431
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
2532
with:
2633
image: umami
27-
tags: ${{ matrix.db-type }}-${{ env.RELEASE_VERSION }}, ${{ matrix.db-type }}-latest
34+
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
2835
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
2936
registry: ghcr.io
3037
multiPlatform: true
3138
platform: linux/amd64,linux/arm64
3239
username: ${{ github.actor }}
3340
password: ${{ secrets.GITHUB_TOKEN }}
3441

35-
3642
- uses: mr-smithers-excellent/docker-build-push@v6
3743
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
3844
with:
3945
image: umamisoftware/umami
40-
tags: ${{ matrix.db-type }}-${{ env.RELEASE_VERSION }}, ${{ matrix.db-type }}-latest
46+
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
4147
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
4248
registry: docker.io
4349
username: ${{ secrets.DOCKER_USERNAME }}
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
-- add tag column
2+
ALTER TABLE umami.website_event ADD COLUMN "tag" String AFTER "event_name";
3+
ALTER TABLE umami.website_event_stats_hourly ADD COLUMN "tag" SimpleAggregateFunction(groupArrayArray, Array(String)) AFTER "max_time";
4+
5+
-- update materialized view
6+
DROP TABLE umami.website_event_stats_hourly_mv;
7+
8+
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
9+
TO umami.website_event_stats_hourly
10+
AS
11+
SELECT
12+
website_id,
13+
session_id,
14+
visit_id,
15+
hostname,
16+
browser,
17+
os,
18+
device,
19+
screen,
20+
language,
21+
country,
22+
subdivision1,
23+
city,
24+
entry_url,
25+
exit_url,
26+
url_paths as url_path,
27+
url_query,
28+
referrer_domain,
29+
page_title,
30+
event_type,
31+
event_name,
32+
views,
33+
min_time,
34+
max_time,
35+
tag,
36+
timestamp as created_at
37+
FROM (SELECT
38+
website_id,
39+
session_id,
40+
visit_id,
41+
hostname,
42+
browser,
43+
os,
44+
device,
45+
screen,
46+
language,
47+
country,
48+
subdivision1,
49+
city,
50+
argMinState(url_path, created_at) entry_url,
51+
argMaxState(url_path, created_at) exit_url,
52+
arrayFilter(x -> x != '', groupArray(url_path)) as url_paths,
53+
arrayFilter(x -> x != '', groupArray(url_query)) url_query,
54+
arrayFilter(x -> x != '', groupArray(referrer_domain)) referrer_domain,
55+
arrayFilter(x -> x != '', groupArray(page_title)) page_title,
56+
event_type,
57+
if(event_type = 2, groupArray(event_name), []) event_name,
58+
sumIf(1, event_type = 1) views,
59+
min(created_at) min_time,
60+
max(created_at) max_time,
61+
arrayFilter(x -> x != '', groupArray(tag)) tag,
62+
toStartOfHour(created_at) timestamp
63+
FROM umami.website_event
64+
GROUP BY website_id,
65+
session_id,
66+
visit_id,
67+
hostname,
68+
browser,
69+
os,
70+
device,
71+
screen,
72+
language,
73+
country,
74+
subdivision1,
75+
city,
76+
event_type,
77+
timestamp);

db/clickhouse/schema.sql

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ CREATE TABLE umami.website_event
2626
--events
2727
event_type UInt32,
2828
event_name String,
29+
tag String,
2930
created_at DateTime('UTC'),
3031
job_id Nullable(UUID)
3132
)
@@ -96,6 +97,7 @@ CREATE TABLE umami.website_event_stats_hourly
9697
views SimpleAggregateFunction(sum, UInt64),
9798
min_time SimpleAggregateFunction(min, DateTime('UTC')),
9899
max_time SimpleAggregateFunction(max, DateTime('UTC')),
100+
tag SimpleAggregateFunction(groupArrayArray, Array(String)),
99101
created_at Datetime('UTC')
100102
)
101103
ENGINE = AggregatingMergeTree
@@ -136,6 +138,7 @@ SELECT
136138
views,
137139
min_time,
138140
max_time,
141+
tag,
139142
timestamp as created_at
140143
FROM (SELECT
141144
website_id,
@@ -161,6 +164,7 @@ FROM (SELECT
161164
sumIf(1, event_type = 1) views,
162165
min(created_at) min_time,
163166
max(created_at) max_time,
167+
arrayFilter(x -> x != '', groupArray(tag)) tag,
164168
toStartOfHour(created_at) timestamp
165169
FROM umami.website_event
166170
GROUP BY website_id,

db/mysql/migrations/01_init/migration.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CREATE TABLE `user` (
1111
UNIQUE INDEX `user_user_id_key`(`user_id`),
1212
UNIQUE INDEX `user_username_key`(`username`),
1313
PRIMARY KEY (`user_id`)
14-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
14+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
1515

1616
-- CreateTable
1717
CREATE TABLE `session` (
@@ -33,7 +33,7 @@ CREATE TABLE `session` (
3333
INDEX `session_created_at_idx`(`created_at`),
3434
INDEX `session_website_id_idx`(`website_id`),
3535
PRIMARY KEY (`session_id`)
36-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
36+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
3737

3838
-- CreateTable
3939
CREATE TABLE `website` (
@@ -53,7 +53,7 @@ CREATE TABLE `website` (
5353
INDEX `website_created_at_idx`(`created_at`),
5454
INDEX `website_share_id_idx`(`share_id`),
5555
PRIMARY KEY (`website_id`)
56-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
56+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
5757

5858
-- CreateTable
5959
CREATE TABLE `website_event` (
@@ -76,7 +76,7 @@ CREATE TABLE `website_event` (
7676
INDEX `website_event_website_id_created_at_idx`(`website_id`, `created_at`),
7777
INDEX `website_event_website_id_session_id_created_at_idx`(`website_id`, `session_id`, `created_at`),
7878
PRIMARY KEY (`event_id`)
79-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
79+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
8080

8181
-- CreateTable
8282
CREATE TABLE `event_data` (
@@ -95,7 +95,7 @@ CREATE TABLE `event_data` (
9595
INDEX `event_data_website_event_id_idx`(`website_event_id`),
9696
INDEX `event_data_website_id_website_event_id_created_at_idx`(`website_id`, `website_event_id`, `created_at`),
9797
PRIMARY KEY (`event_id`)
98-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
98+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
9999

100100
-- CreateTable
101101
CREATE TABLE `team` (
@@ -109,7 +109,7 @@ CREATE TABLE `team` (
109109
UNIQUE INDEX `team_access_code_key`(`access_code`),
110110
INDEX `team_access_code_idx`(`access_code`),
111111
PRIMARY KEY (`team_id`)
112-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
112+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
113113

114114
-- CreateTable
115115
CREATE TABLE `team_user` (
@@ -124,7 +124,7 @@ CREATE TABLE `team_user` (
124124
INDEX `team_user_team_id_idx`(`team_id`),
125125
INDEX `team_user_user_id_idx`(`user_id`),
126126
PRIMARY KEY (`team_user_id`)
127-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
127+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
128128

129129
-- CreateTable
130130
CREATE TABLE `team_website` (
@@ -137,7 +137,7 @@ CREATE TABLE `team_website` (
137137
INDEX `team_website_team_id_idx`(`team_id`),
138138
INDEX `team_website_website_id_idx`(`website_id`),
139139
PRIMARY KEY (`team_website_id`)
140-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
140+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
141141

142142
-- AddSystemUser
143143
INSERT INTO user (user_id, username, role, password) VALUES ('41e2b680-648e-4b09-bcd7-3e2b10c06264' , 'admin', 'admin', '$2b$10$BUli0c.muyCW1ErNJc3jL.vFRFtFJWrT8/GcR4A.sUdCznaXiqFXa');

db/mysql/migrations/02_report_schema_session_data/migration.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CREATE TABLE `session_data` (
2121
INDEX `session_data_website_id_idx`(`website_id`),
2222
INDEX `session_data_session_id_idx`(`session_id`),
2323
PRIMARY KEY (`session_data_id`)
24-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
24+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
2525

2626
-- CreateTable
2727
CREATE TABLE `report` (
@@ -41,7 +41,7 @@ CREATE TABLE `report` (
4141
INDEX `report_type_idx`(`type`),
4242
INDEX `report_name_idx`(`name`),
4343
PRIMARY KEY (`report_id`)
44-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
44+
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
4545

4646
-- EventData migration
4747
UPDATE event_data
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- AlterTable
2+
ALTER TABLE `website_event` ADD COLUMN `tag` VARCHAR(50) NULL;
3+
4+
-- CreateIndex
5+
CREATE INDEX `website_event_website_id_created_at_tag_idx` ON `website_event`(`website_id`, `created_at`, `tag`);

db/mysql/schema.prisma

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ model WebsiteEvent {
102102
pageTitle String? @map("page_title") @db.VarChar(500)
103103
eventType Int @default(1) @map("event_type") @db.UnsignedInt
104104
eventName String? @map("event_name") @db.VarChar(50)
105+
tag String? @db.VarChar(50)
105106
106107
eventData EventData[]
107108
session Session @relation(fields: [sessionId], references: [id])
@@ -116,6 +117,7 @@ model WebsiteEvent {
116117
@@index([websiteId, createdAt, referrerDomain])
117118
@@index([websiteId, createdAt, pageTitle])
118119
@@index([websiteId, createdAt, eventName])
120+
@@index([websiteId, createdAt, tag])
119121
@@index([websiteId, sessionId, createdAt])
120122
@@index([websiteId, visitId, createdAt])
121123
@@map("website_event")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- AlterTable
2+
ALTER TABLE "website_event" ADD COLUMN "tag" VARCHAR(50);
3+
4+
-- CreateIndex
5+
CREATE INDEX "website_event_website_id_created_at_tag_idx" ON "website_event"("website_id", "created_at", "tag");

db/postgresql/schema.prisma

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ model WebsiteEvent {
102102
pageTitle String? @map("page_title") @db.VarChar(500)
103103
eventType Int @default(1) @map("event_type") @db.Integer
104104
eventName String? @map("event_name") @db.VarChar(50)
105+
tag String? @db.VarChar(50)
105106
106107
eventData EventData[]
107108
session Session @relation(fields: [sessionId], references: [id])
@@ -111,11 +112,13 @@ model WebsiteEvent {
111112
@@index([visitId])
112113
@@index([websiteId])
113114
@@index([websiteId, createdAt])
115+
114116
@@index([websiteId, createdAt, urlPath])
115117
@@index([websiteId, createdAt, urlQuery])
116118
@@index([websiteId, createdAt, referrerDomain])
117119
@@index([websiteId, createdAt, pageTitle])
118120
@@index([websiteId, createdAt, eventName])
121+
@@index([websiteId, createdAt, tag])
119122
@@index([websiteId, sessionId, createdAt])
120123
@@index([websiteId, visitId, createdAt])
121124
@@map("website_event")

next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
/// <reference types="next/navigation-types/compat/navigation" />
44

55
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/basic-features/typescript for more information.
6+
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.

0 commit comments

Comments
 (0)