Skip to content

Commit

Permalink
(improvement) Preparing for a new selfhosted release (#235)
Browse files Browse the repository at this point in the history
* prepare for a new selfhosted release

* funnels fix & project ordering

* api key auth support

* fix broken migration

* selfhosted: v2 -> v3 migration script

* fix migration

* empty projects error fix

* bump clickhouse-server

* bump redis
  • Loading branch information
Blaumaus authored May 22, 2024
1 parent 59eff9d commit 06587de
Show file tree
Hide file tree
Showing 36 changed files with 937 additions and 128 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SMTP_MOCK=true
# Selfhosted
EMAIL=[email protected]
PASSWORD=12345678
API_KEY=

# Swetrix CDN for storing files
CDN_URL=http://localhost:5006
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ENV TZ=UTC \
CLICKHOUSE_DATABASE=analytics \
API_ORIGINS=\
[email protected] \
PASSWORD=12345678
PASSWORD=12345678 \
API_KEY=
RUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/$TZ /etc/localtime
WORKDIR /app
COPY --from=build /build/package*.json ./
Expand Down
2 changes: 1 addition & 1 deletion apps/production/src/analytics/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ export class AnalyticsService {
let diff = null

if (from && to) {
diff = dayjs(to).diff(dayjs(from?.[0].created || to), 'days')
diff = dayjs(to).diff(dayjs(from?.[0]?.created || to), 'days')

const tbMap = _find(timeBucketToDays, ({ lt }) => diff <= lt)

Expand Down
10 changes: 6 additions & 4 deletions apps/production/src/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,11 @@ export class ProjectService {
})
}

async getPIDsWhereAnalyticsDataExists(projectIds: string[]) {
async getPIDsWhereAnalyticsDataExists(
projectIds: string[],
): Promise<string[]> {
if (_isEmpty(projectIds)) {
return {}
return []
}

const params = _reduce(
Expand Down Expand Up @@ -895,9 +897,9 @@ export class ProjectService {
return _map(result, ({ pid }) => pid)
}

async getPIDsWhereErrorsDataExists(projectIds: string[]) {
async getPIDsWhereErrorsDataExists(projectIds: string[]): Promise<string[]> {
if (_isEmpty(projectIds)) {
return {}
return []
}

const params = _reduce(
Expand Down
Loading

0 comments on commit 06587de

Please sign in to comment.