Skip to content

Commit efd0068

Browse files
authored
feat: Add Helm configuration #WPB-21554
1 parent 88bc0f4 commit efd0068

Some content is hidden

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

43 files changed

+623
-201
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Makefile
22
.gradle
33
.idea
4+
build
45
.kotlin
56
.gitignore
67
LICENSE

.env.example

Lines changed: 0 additions & 6 deletions
This file was deleted.

.env.sample

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Database
2+
DB_USER=remind-app-user
3+
DB_PASSWORD=super-secret-wire-pwd
4+
DB_URL=jdbc:postgresql://db:5432/remind-app
5+
DB_NAME=remind-app
6+
7+
# Init
8+
SDK_APP_ID=myAppUuid
9+
SDK_APP_TOKEN=myApiToken
10+
API_HOST_URL=https://staging-nginz-https.zinfra.io
11+
CRYPTO_PASSWORD=myDummyPasswordmyDummyPassword01
12+
13+
# SDK
14+
WIRE_SDK_USER_ID=myUserUuid
15+
WIRE_SDK_EMAIL=[email protected]
16+
WIRE_SDK_PASSWORD=mySecretPassword01!
17+
WIRE_SDK_ENVIRONMENT=staging.zinfra.io

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ nb-configuration.xml
3838
# Plugin directory
3939
/.quarkus/cli/plugins/
4040

41-
**/demo.properties
42-
43-
# Ignore SQLite database
44-
*.db
45-
46-
# Ignore Core-crypto directory
47-
cryptography
41+
# Ignore Storage directory content but keep the directory
42+
storage/*
43+
!storage/.gitkeep

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ COPY . .
99

1010
RUN ./gradlew clean build --no-daemon
1111

12-
FROM registry.access.redhat.com/ubi9/openjdk-21
12+
FROM eclipse-temurin:21-jre
13+
14+
WORKDIR /deployments
1315

1416
ENV LANGUAGE='en_US:en'
1517

@@ -19,9 +21,9 @@ COPY --chown=185 --from=build /setup/build/quarkus-app/quarkus-run.jar /deployme
1921
COPY --chown=185 --from=build /setup/build/quarkus-app/app/ /deployments/app/
2022
COPY --chown=185 --from=build /setup/build/quarkus-app/quarkus/ /deployments/quarkus/
2123

24+
RUN mkdir -p /deployments/storage && chown -R 185:0 /deployments/storage
25+
2226
EXPOSE 8080
2327
USER 185
24-
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
25-
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
2628

27-
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
29+
ENTRYPOINT ["java", "-jar", "-Dquarkus.http.host=0.0.0.0", "-Djava.util.logging.manager=org.jboss.logmanager.LogManager", "/deployments/quarkus-run.jar"]

README.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ This is an app that can create reminders for conversation, and send a message wh
1414
- Delete reminders
1515

1616
> [!IMPORTANT]
17-
> As of now, the bot only supports a maximum of 5 active reminders per group.
17+
> As of now, the app only supports a maximum of 5 active reminders per group.
1818
19-
## Getting started
19+
## Commands
2020

2121
### The basics of `/remind` command:
2222

@@ -39,13 +39,13 @@ This is an app that can create reminders for conversation, and send a message wh
3939
| one time reminder | `/remind to` | `"Fill in your invoices by end of day"` | `"tomorrow at 17:30"` |
4040
| one time reminder | `/remind to` | `"Fill in your invoices by end of day"` | `"next Tue at 17:30"` |
4141
| one time reminder | `/remind to` | `"Reply to HR email"` | `"in 10 minutes"` |
42-
| one time reminder | `/remind to` | `"Travel back in time to not develop the bot"` | `"11/11/2150"` |
42+
| one time reminder | `/remind to` | `"Travel back in time to not develop the app"` | `"11/11/2150"` |
4343
| recurrent reminder | `/remind to` | `"Join the daily stand-up"` | `"every day at 10:00"` |
4444
| recurrent reminder | `/remind to` | `"Empty the unread emails"` | `"every Friday at 17:00"` |
4545
| recurrent reminder | `/remind to` | `"Empty the unread emails"` | `"every Mon, TUE, friday at 17:00"` |
4646

4747
> [!TIP]
48-
> You can set reminders for yourself. To do so, you can use the commands in a private conversation, a 1:1 with the bot.
48+
> You can set reminders for yourself. To do so, you can use the commands in a private conversation, a 1:1 with the app.
4949
5050
### Other helpful commands:
5151

@@ -54,33 +54,24 @@ This is an app that can create reminders for conversation, and send a message wh
5454
- `/remind delete <reminder-identifier>` (deletes the target reminder, the identifier can be obtained from the list
5555
command)
5656

57-
## Technical details
57+
## Development setup
5858

59-
### Bot Architecture
59+
You first need to set all the env variables required by the app itself and the SDK inside.
60+
Check the `.env.sample` and create a new `.env` file while setting the properties.
6061

61-
We are using a DDD-like architecture, but without the burden of defining a full DDD model (involving domains "experts"
62-
and so on). The idea is to have a clear separation of concerns between the different layers of the application.
63-
So each layer does the following:
62+
And also the env variables required by `Wire Applications JVM SDK`, check related README
63+
[SDK README](https://github.com/wireapp/wire-apps-jvm-sdk/blob/main/README.md)
6464

65-
- **Application**: Exposes the REST API and handles the HTTP requests, it's what the clients see.
66-
- **Domain**: Contains the business logic, domain core entities, this layer is "clean" in other words, doesn't have any
67-
dependency on other layers or frameworks. To access the logic, we provide UseCases, so we can group them (kind of
68-
services + aggregates in DDD)
69-
- **Infrastructure**: Contains the implementation of the domain repositories, and other external dependencies, like
70-
databases, queues technologies, framework configurations, etc.
7165

72-
<img src="https://imgpile.com/images/C7Q2Gj.png" width="800"/>
7366

74-
**Note**: To enforce layer dependency, can be split into different gradle modules, but for now, we are keeping it
75-
simple.
76-
77-
### Bot Framework
67+
## Running the application in dev mode
7868

7969
This project uses Quarkus, the Supersonic Subatomic Java Framework.
80-
8170
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
8271

83-
## Running the application in dev mode
72+
If you don't want to mess with Quarkus, use the provided `Dockerfile` or `docker-compose.yml`
73+
74+
Otherwise you can just start the `db` service in docker to have Postgres running and run the app yourself.
8475

8576
You can run your application in dev mode that enables live coding using:
8677
```shell script
@@ -119,7 +110,7 @@ Or, if you don't have GraalVM installed, you can run the native executable build
119110
./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true
120111
```
121112

122-
You can then execute your native executable with: `./build/reminders-bots-1.0.0-SNAPSHOT-runner`
113+
You can then execute your native executable inside the `build` directory
123114

124115
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling.
125116

build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ val quarkusPlatformVersion: String by project
2828
*/
2929
configurations.all {
3030
resolutionStrategy {
31-
force("com.google.protobuf:protobuf-java:4.32.0")
32-
force("com.google.protobuf:protobuf-kotlin:4.32.0")
31+
force("com.google.protobuf:protobuf-java:4.33.0")
32+
force("com.google.protobuf:protobuf-kotlin:4.33.0")
3333
}
3434
}
3535

@@ -45,6 +45,8 @@ dependencies {
4545
implementation("io.quarkus:quarkus-flyway")
4646
implementation("io.quarkus:quarkus-quartz")
4747
implementation("io.quarkus:quarkus-jdbc-postgresql")
48+
implementation("io.quarkus:quarkus-smallrye-health")
49+
implementation("io.quarkus:quarkus-logging-json")
4850

4951
// Kotlin support
5052
implementation("io.quarkus:quarkus-kotlin")
@@ -55,7 +57,7 @@ dependencies {
5557
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
5658
implementation("com.rubiconproject.oss:jchronic:0.2.8")
5759
implementation("io.arrow-kt:arrow-core:2.1.2")
58-
implementation("com.wire:wire-apps-jvm-sdk:0.0.16")
60+
implementation("com.wire:wire-apps-jvm-sdk:0.0.18")
5961

6062
// Test dependencies
6163
testImplementation("io.quarkus:quarkus-junit5")

config/detekt/baseline.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
<?xml version="1.0" ?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<SmellBaseline>
3-
<ManuallySuppressedIssues></ManuallySuppressedIssues>
4-
<CurrentIssues></CurrentIssues>
3+
<ManuallySuppressedIssues/>
4+
<CurrentIssues>
5+
<ID>UseCheckOrError:MlsSdkClient.kt$MlsSdkClient$throw IllegalStateException("API_HOST_URL environment variable is required")</ID>
6+
<ID>UseCheckOrError:MlsSdkClient.kt$MlsSdkClient$throw IllegalStateException("CRYPTO_PASSWORD environment variable is required")</ID>
7+
<ID>UseCheckOrError:MlsSdkClient.kt$MlsSdkClient$throw IllegalStateException("SDK_APP_ID environment variable is required")</ID>
8+
<ID>UseCheckOrError:MlsSdkClient.kt$MlsSdkClient$throw IllegalStateException("SDK_APP_TOKEN environment variable is required")</ID>
9+
</CurrentIssues>
510
</SmellBaseline>

docker-compose.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
version: '3'
22

33
services:
4-
reminders_bot:
5-
image: wirebots/reminders:latest
4+
reminders_app:
5+
platform: linux/amd64 # Allows using core-crypto on macOs
66
build:
77
context: ./
88
dockerfile: Dockerfile
99
environment:
10-
QUARKUS_DATASOURCE_URL: jdbc:postgresql://db/quarkus
10+
QUARKUS_DATASOURCE_URL: jdbc:postgresql://db/${DB_NAME}
11+
env_file: .env
12+
volumes:
13+
- reminders_app-storage:/deployments/storage
1114
depends_on:
1215
- db
1316

1417
db:
1518
image: postgres:13
1619
environment:
17-
- POSTGRES_USER=quarkus
18-
- POSTGRES_PASSWORD=quarkus
19-
- POSTGRES_DB=quarkus
20+
- POSTGRES_USER=${DB_USER}
21+
- POSTGRES_PASSWORD=${DB_PASSWORD}
22+
- POSTGRES_DB=${DB_NAME}
2023
ports:
2124
- 5432:5432
2225
volumes:
23-
- reminders_bot-db:/var/lib/postgresql/data/
26+
- reminders_app-db:/var/lib/postgresql/data/
2427

2528
volumes:
26-
reminders_bot-db:
29+
reminders_app-storage:
30+
reminders_app-db:

helm/remindapp/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
name: remindapp
3+
description: Wire Remind-App - A Helm chart for deploying the Wire Remind app
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
home: https://github.com/wireapp/remind-app
8+
maintainers:
9+
- name: Wire Integrations Team

0 commit comments

Comments
 (0)