Skip to content

Commit

Permalink
Merge pull request #2534 from umami-software/dev
Browse files Browse the repository at this point in the history
v2.10.0
  • Loading branch information
mikecao committed Feb 27, 2024
2 parents 784237b + 23a45a3 commit 915a4ee
Show file tree
Hide file tree
Showing 539 changed files with 16,106 additions and 7,085 deletions.
17 changes: 3 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,15 @@
"plugins": ["@typescript-eslint", "prettier"],
"settings": {
"import/resolver": {
"alias": {
"map": [
["assets", "./src/assets"],
["components", "./src/components"],
["db", "./db"],
["hooks", "./src/components/hooks"],
["lang", "./src/lang"],
["lib", "./src/lib"],
["public", "./public"],
["queries", "./src/queries"],
["store", "./src/store"],
["styles", "./src/styles"]
],
"extensions": [".ts", ".tsx", ".js", ".jsx", ".json"]
"node": {
"moduleDirectory": ["node_modules", "src/"]
}
}
},
"rules": {
"no-console": "error",
"react/display-name": "off",
"react-hooks/exhaustive-deps": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"import/no-anonymous-default-export": "off",
Expand Down
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "🐛 Bug Report"
name: '🐛 Bug Report'
description: Create a bug report for Umami.
body:
- type: textarea
Expand All @@ -22,11 +22,15 @@ body:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: input
attributes:
label: Which Umami version are you using? (if relevant)
description: 'For example: Chrome, Edge, Firefox, etc'
- type: input
attributes:
label: Which browser are you using? (if relevant)
description: 'For example: Chrome, Edge, Firefox, etc'
- type: input
attributes:
label: How are you deploying your application? (if relevant)
description: 'For example: Vercel, Railway, Docker, etc'
description: 'For example: Vercel, Railway, Docker, etc'
22 changes: 21 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ name: Create docker images

on: [create]

env:
# set Docker OCI Labels
DOCKER_LABELS: >
org.opencontainers.image.title=${{github.event.repository.name}},
org.opencontainers.image.description="Umami is a simple, fast, privacy-focused alternative to Google Analytics",
org.opencontainers.image.vendor=${{github.repository_owner}},
org.opencontainers.image.licenses="MIT",
org.opencontainers.image.version=${{github.ref_name}},
org.opencontainers.image.created=${{ env.NOW }},
org.opencontainers.image.source=${{github.server_url}}/${{github.repository}},
org.opencontainers.image.revision=${{github.sha}},
org.opencontainers.image.url="https://umami.is/",
org.opencontainers.image.documentation="https://umami.is/docs",
org.opencontainers.image.base.name="docker.io/library/node:18-alpine"
jobs:
build:
name: Build, push, and deploy
Expand All @@ -16,25 +31,30 @@ jobs:
- uses: actions/checkout@v3

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- uses: mr-smithers-excellent/docker-build-push@v6
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
with:
image: umami
tags: ${{ matrix.db-type }}-${{ env.RELEASE_VERSION }}, ${{ matrix.db-type }}-latest
labels: $DOCKER_LABELS
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
registry: ghcr.io
multiPlatform: true
platform: linux/amd64,linux/arm64
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- uses: mr-smithers-excellent/docker-build-push@v6
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
with:
image: umamisoftware/umami
tags: ${{ matrix.db-type }}-${{ env.RELEASE_VERSION }}, ${{ matrix.db-type }}-latest
labels: $DOCKER_LABELS
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
strategy:
matrix:
include:
- node-version: 18.x
- node-version: 18.17
db-type: postgresql
- node-version: 18.x
- node-version: 18.17
db-type: mysql

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mysql://username:mypassword@localhost:3306/mydb
yarn build
```

The build step will also create tables in your database if you ae installing for the first time. It will also create a login user with username **admin** and password **umami**.
The build step will also create tables in your database if you are installing for the first time. It will also create a login user with username **admin** and password **umami**.

### Start the application

Expand Down
131 changes: 1 addition & 130 deletions db/clickhouse/schema.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SET allow_experimental_object_type = 1;

-- Create Event
CREATE TABLE umami.website_event
(
Expand Down Expand Up @@ -34,82 +32,6 @@ CREATE TABLE umami.website_event
ORDER BY (website_id, session_id, created_at)
SETTINGS index_granularity = 8192;

CREATE TABLE umami.website_event_queue (
website_id UUID,
session_id UUID,
event_id UUID,
--sessions
hostname LowCardinality(String),
browser LowCardinality(String),
os LowCardinality(String),
device LowCardinality(String),
screen LowCardinality(String),
language LowCardinality(String),
country LowCardinality(String),
subdivision1 LowCardinality(String),
subdivision2 LowCardinality(String),
city String,
--pageviews
url_path String,
url_query String,
referrer_path String,
referrer_query String,
referrer_domain String,
page_title String,
--events
event_type UInt32,
event_name String,
created_at DateTime('UTC'),
--virtual columns
_error String,
_raw_message String
)
ENGINE = Kafka
SETTINGS kafka_broker_list = 'domain:9092,domain:9093,domain:9094', -- input broker list
kafka_topic_list = 'event',
kafka_group_name = 'event_consumer_group',
kafka_format = 'JSONEachRow',
kafka_max_block_size = 1048576,
kafka_handle_error_mode = 'stream';

CREATE MATERIALIZED VIEW umami.website_event_queue_mv TO umami.website_event AS
SELECT website_id,
session_id,
event_id,
hostname,
browser,
os,
device,
screen,
language,
country,
subdivision1,
subdivision2,
city,
url_path,
url_query,
referrer_path,
referrer_query,
referrer_domain,
page_title,
event_type,
event_name,
created_at
FROM umami.website_event_queue;

CREATE MATERIALIZED VIEW umami.website_event_errors_mv
(
error String,
raw String
)
ENGINE = MergeTree
ORDER BY (error, raw)
SETTINGS index_granularity = 8192 AS
SELECT _error AS error,
_raw_message AS raw
FROM umami.website_event_queue
WHERE length(_error) > 0;

CREATE TABLE umami.event_data
(
website_id UUID,
Expand All @@ -127,55 +49,4 @@ CREATE TABLE umami.event_data
)
engine = MergeTree
ORDER BY (website_id, event_id, event_key, created_at)
SETTINGS index_granularity = 8192;

CREATE TABLE umami.event_data_queue (
website_id UUID,
session_id UUID,
event_id UUID,
url_path String,
event_name String,
event_key String,
string_value Nullable(String),
number_value Nullable(Decimal64(4)), --922337203685477.5625
date_value Nullable(DateTime('UTC')),
data_type UInt32,
created_at DateTime('UTC'),
--virtual columns
_error String,
_raw_message String
)
ENGINE = Kafka
SETTINGS kafka_broker_list = 'domain:9092,domain:9093,domain:9094', -- input broker list
kafka_topic_list = 'event_data',
kafka_group_name = 'event_data_consumer_group',
kafka_format = 'JSONEachRow',
kafka_max_block_size = 1048576,
kafka_handle_error_mode = 'stream';

CREATE MATERIALIZED VIEW umami.event_data_queue_mv TO umami.event_data AS
SELECT website_id,
session_id,
event_id,
url_path,
event_name,
event_key,
string_value,
number_value,
date_value,
data_type,
created_at
FROM umami.event_data_queue;

CREATE MATERIALIZED VIEW umami.event_data_errors_mv
(
error String,
raw String
)
ENGINE = MergeTree
ORDER BY (error, raw)
SETTINGS index_granularity = 8192 AS
SELECT _error AS error,
_raw_message AS raw
FROM umami.event_data_queue
WHERE length(_error) > 0;
SETTINGS index_granularity = 8192;
29 changes: 29 additions & 0 deletions db/mysql/migrations/04_team_redesign/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Warnings:
- You are about to drop the `team_website` table. If the table is not empty, all the data it contains will be lost.
*/
-- AlterTable
ALTER TABLE `team` ADD COLUMN `deleted_at` TIMESTAMP(0) NULL,
ADD COLUMN `logo_url` VARCHAR(2183) NULL;

-- AlterTable
ALTER TABLE `user` ADD COLUMN `display_name` VARCHAR(255) NULL,
ADD COLUMN `logo_url` VARCHAR(2183) NULL;

-- AlterTable
ALTER TABLE `website` ADD COLUMN `created_by` VARCHAR(36) NULL,
ADD COLUMN `team_id` VARCHAR(36) NULL;

-- MigrateData
UPDATE `website` SET created_by = user_id WHERE team_id IS NULL;

-- DropTable
DROP TABLE `team_website`;

-- CreateIndex
CREATE INDEX `website_team_id_idx` ON `website`(`team_id`);

-- CreateIndex
CREATE INDEX `website_created_by_idx` ON `website`(`created_by`);

0 comments on commit 915a4ee

Please sign in to comment.