Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/usage-meter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Usage meter checks
on:
pull_request:
paths: ['applications/usage-meter/**', '.github/workflows/usage-meter.yml']
push:
branches: [main]
paths: ['applications/usage-meter/**', '.github/workflows/usage-meter.yml']
workflow_dispatch:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: applications/usage-meter
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- run: ./gradlew --no-daemon clean test installDist
# Real Cloud acceptance is explicit and does not use CI credentials.
13 changes: 13 additions & 0 deletions applications/usage-meter/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PGHOST=YOUR_DIRECT_CLOUD_POSTGRES_HOSTNAME
PGPORT=5432
PGDATABASE=postgres
PGUSER=usage_app
PGPASSWORD=YOUR_RUNTIME_PASSWORD
PGSSLROOTCERT=/absolute/path/to/postgres-ca.pem
CLICKHOUSE_URL=https://YOUR_CLICKHOUSE_HOSTNAME:8443
CLICKHOUSE_USER=usage_reports
CLICKHOUSE_PASSWORD=YOUR_REPORT_PASSWORD
ACCOUNT_TOKENS='{"00000000-0000-4000-8000-000000000001":"YOUR_RANDOM_TOKEN_AT_LEAST_32_CHARACTERS","00000000-0000-4000-8000-000000000002":"ANOTHER_RANDOM_TOKEN_AT_LEAST_32_CHARACTERS"}'
PORT=3000
# Tests only: RUN_CLOUD_TESTS=1 and TEST_WRONG_CA=/absolute/path/to/unrelated-ca.pem
# Keep migration, publication/CDC and administrator passwords out of this file.
1 change: 1 addition & 0 deletions applications/usage-meter/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gradlew.bat text eol=crlf
5 changes: 5 additions & 0 deletions applications/usage-meter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.gradle/
build/
.deployment/
.env
*.log
212 changes: 212 additions & 0 deletions applications/usage-meter/README.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions applications/usage-meter/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
kotlin("jvm") version "2.4.20"
kotlin("plugin.serialization") version "2.4.20"
application
}
repositories { mavenCentral() }
kotlin { jvmToolchain(21) }
application { mainClass.set("meter.MainKt") }
dependencyLocking { lockAllConfigurations() }
dependencies {
val ktor = "3.6.0"
implementation("io.ktor:ktor-server-netty-jvm:$ktor")
implementation("io.ktor:ktor-server-auth-jvm:$ktor")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor")
implementation("io.ktor:ktor-server-status-pages-jvm:$ktor")
implementation("io.ktor:ktor-server-body-limit-jvm:$ktor")
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktor")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
implementation("org.jetbrains.exposed:exposed-core:1.5.0")
implementation("org.jetbrains.exposed:exposed-jdbc:1.5.0")
implementation("org.jetbrains.exposed:exposed-java-time:1.5.0")
implementation("org.postgresql:postgresql:42.7.13")
implementation("com.zaxxer:HikariCP:7.1.0")
implementation("com.clickhouse:client-v2:0.10.0")
implementation("ch.qos.logback:logback-classic:1.6.5")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter:6.0.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:6.0.3")
}
tasks.test { useJUnitPlatform() }
157 changes: 157 additions & 0 deletions applications/usage-meter/gradle.lockfile

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions applications/usage-meter/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx768m -Dfile.encoding=UTF-8
org.gradle.workers.max=1
kotlin.compiler.execution.strategy=in-process
Binary file not shown.
10 changes: 10 additions & 0 deletions applications/usage-meter/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=bafd5ce9cfaea0fbccfdc8439a1ac42fbd4cd9c89dc9a988228d8a2639a58e6c
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip
networkTimeout=30000
retries=2
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
248 changes: 248 additions & 0 deletions applications/usage-meter/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading