Skip to content

Commit 96a596f

Browse files
Update to Spring Boot 3.2.3
Http Interface Clients, Spring Java Code Formatter, Maven wrapper, Readme.md, docker-compose, GitHub Actions, new Buildpack BaseImage (patched), and Virtual Threads
1 parent 88624a0 commit 96a596f

22 files changed

+802
-778
lines changed

.github/workflows/maven-docker-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
uses: docker/build-push-action@v5.3.0
4848
with:
4949
push: true
50-
tags: patbaumgartner/run:base-cnb
50+
tags: patbaumgartner/builder-jammy-base:latest
5151
file: Dockerfile.base-cnb
5252

5353
- name: Set up JDK
5454
uses: actions/setup-java@v4
5555
with:
56-
java-version: '17'
56+
java-version: '21'
5757
distribution: 'temurin'
5858
cache: maven
5959

@@ -66,7 +66,7 @@ jobs:
6666
mvn spring-boot:build-image \
6767
--batch-mode --no-transfer-progress \
6868
-Dspring-boot.build-image.imageName=${{ steps.meta.outputs.tags }} \
69-
-Dspring-boot.build-image.runImage=patbaumgartner/run:base-cnb \
69+
-Dspring-boot.build-image.runImage=patbaumgartner/builder-jammy-base:latest \
7070
-Dspring-boot.build-image.publish=true \
7171
-DCI_REGISTRY=https://index.docker.io/v1/ \
7272
-DCI_REGISTRY_USER=${{ secrets.DOCKER_USERNAME }} \

.mvn/wrapper/maven-wrapper.jar

2.56 KB
Binary file not shown.
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,2 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

.springjavaformatconfig

Whitespace-only changes.

Dockerfile.base-cnb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
FROM paketobuildpacks/run:base-cnb
1+
FROM paketobuildpacks/run-jammy-base:latest
22

33
USER root
44

55
## Idea from: https://blog.adoptopenjdk.net/2021/01/prerequisites-for-font-support-in-adoptopenjdk/
66
RUN apt-get update \
77
&& apt-get install -y --no-install-recommends \
8-
wget \
9-
fontconfig \
8+
wget \
9+
fontconfig \
1010
&& rm -rf /var/lib/apt/lists/*
1111

1212
# Install Noto Emoji Manually
1313
RUN mkdir -p /usr/share/fonts/truetype/noto \
14-
&& cd /usr/share/fonts/truetype/noto \
15-
&& wget https://github.com/googlefonts/noto-emoji/raw/9a5261d871451f9b5183c93483cbd68ed916b1e9/fonts/NotoEmoji-Regular.ttf \
16-
&& fc-cache -fv
14+
&& cd /usr/share/fonts/truetype/noto \
15+
&& wget https://github.com/googlefonts/noto-emoji/raw/9a5261d871451f9b5183c93483cbd68ed916b1e9/fonts/NotoEmoji-Regular.ttf \
16+
&& fc-cache -fv
1717

1818
USER cnb

HELP.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Getting Started
22

3-
### Reference Documentation
3+
## Reference Documentation
4+
45
For further reference, please consider the following sections:
56

67
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7-
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.0.6/maven-plugin/reference/html/)
8-
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.0.6/maven-plugin/reference/html/#build-image)
9-
8+
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/)
9+
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/#build-image)

README.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
# Lovebox Telegram Sender
44

5-
The app allows sending messages via Telegram Bot to a single Lovebox instance. Text messages and photos with captions
6-
are supported. Other message types (e.g. Stickers, Audio, etc.) will lead to a default message.
5+
The app allows you to send messages to a single instance of Lovebox via Telegram Bot. Text messages and captioned photos are supported. Other message types (e.g. stickers, audio, etc.) will result in a standard message.
76

87
## Application Setup
98

10-
To set up the app, a few IDs and values need to be retrieved from the Lovebox API. The following curl commands help to find
11-
the needed data on an existing account. Make sure you have set up your account via the Android or iOS app already.
9+
To set up the application, you will need to retrieve some IDs and values from the Lovebox API. The following curl commands will help you to on an existing account. Make sure you have already set up your account using the Android or iOS app.
1210

1311
### Login with Password
1412

15-
Log in with a password to retrieve the authorization token for the following request.
13+
Log in with a password to retrieve the authorisation token for the following request.
1614

1715
```bash
1816
curl --location --request POST 'https://app-api.loveboxlove.com/v1/auth/loginWithPassword' \
@@ -36,7 +34,7 @@ curl --location --request POST 'https://app-api.loveboxlove.com/v1/auth/loginWit
3634

3735
### Me Request with the Authorization Token
3836

39-
Use the token above to make the "Me Request" to find the configuration needed details.
37+
Use the token above to make a 'Me Request' to find the configuration details you need.
4038

4139
```bash
4240
curl --location --request POST 'https://app-api.loveboxlove.com/v1/graphql' \
@@ -137,16 +135,13 @@ curl --location --request POST 'https://app-api.loveboxlove.com/v1/graphql' \
137135

138136
### Setting up a Telegram Bot
139137

140-
To create a chatbot on Telegram, you need to contact the [@BotFather](https://telegram.me/BotFather), which is a bot
141-
used to create other bots.
138+
To create a chatbot on Telegram, you need to contact the [@BotFather](https://telegram.me/BotFather), who is a bot which is used to create other bots.
142139

143-
The command you need is `/newbot` which leads to the next steps to create your bot. Follow the instructions and get the
144-
bot `username`, and `token`.
140+
The command you need is `/newbot`, which will take you through the next steps to create your bot. Follow the instructions and get the bot `username` and `token`.
145141

146142
### Adjusting SpringBoot's application.properties
147143

148-
Running the app from the source needs adjustments according to your settings. Adjusting the `application.properties` in
149-
the sources or passing them as Java options or CLI arguments to the app.
144+
Running the application from source requires customisation according to your settings. Adjust the `application.properties' in the sources or pass it as Java options or CLI arguments to the application.
150145

151146
```properties
152147
# Lovebox Login
@@ -164,8 +159,7 @@ bot.token=4072971853:ABEojZ42uNA6YYn_c7DF8RH0UOorqXuveSQ
164159

165160
### Setting Environment Variables e.g. for Docker
166161

167-
The following snippet can be passed as `.env` and read by the `docker-compose.yml` or used to be passed directly to
168-
the `docker run` command.
162+
The following snippet can be passed as `.env` and read by `docker-compose.yml`, or used to pass directly to the the `docker run` command.
169163

170164
```bash
171165
# Lovebox Login
@@ -208,39 +202,29 @@ mvn spring-boot:build-image \
208202

209203
### Fixing Known Issues with Missing Fonts
210204

211-
Since the app uses fonts, we need to make sure that fonts are part of the docker container. The containers produced
212-
above throw an exception when using
213-
them `java.lang.NullPointerException: Cannot load from short array because "sun.awt.FontConfiguration.head" is null`
205+
Since the application uses fonts, we need to make sure that fonts are part of the Docker container. The containers created above will throw an exception if they are `java.lang.NullPointerException`: Cannot load from short array because `sun.awt.FontConfiguration.head` is null.
214206

215-
[Andreas Ahlensdorf](https://github.com/aahlenst) describes nicely the font problem in his blog post [Prerequisites for
216-
Font Support in AdoptOpenJDK](https://blog.adoptopenjdk.net/2021/01/prerequisites-for-font-support-in-adoptopenjdk/).
207+
[Andreas Ahlensdorf](https://github.com/aahlenst) describes nicely the font problem in his blog post [Prerequisites for Font Support in AdoptOpenJDK](https://blog.adoptopenjdk.net/2021/01/prerequisites-for-font-support-in-adoptopenjdk/).
217208

218-
After more research, it seems that the only solution to add fonts to the build pack base image is to create an OCI run
219-
image by extending the base one. See the `Dockerfile.`base-cnb` file and how a patch with the additional font packages
220-
might look like.
209+
After further research, it seems that the only way to add fonts to the build pack base image is to create an OCI run image by extending the base image. See the `Dockerfile.base-cnb` file and what a patch with the additional font packages might look like.
221210

222211
Build the `runImage` locally with the following command.
223212

224213
```bash
225214
docker build --no-cache -f Dockerfile.base-cnb -t patbaumgartner/run:base-cnb .
226215
```
227216

228-
Since we run the pull policy in the `mvn spring-boot:build-image` command with IF_NOT_PRESENT, we need to make sure that
229-
the newest version of the builder is locally available. Finally, pass to the `spring-boot-maven-plugin` the `runImage`
230-
to build the docker container containing the fonts.
217+
Since we are running the pull policy with `IF_NOT_PRESENT` in the `mvn spring-boot:build-image` command, we need to make sure that the latest version of the builder is available locally. Finally, pass the `runImage` to the `spring-boot-maven-plugin` to create the docker container containing the fonts.
231218

232219
```bash
233220
mvn spring-boot:build-image \
234221
--batch-mode \
235222
--no-transfer-progress \
236223
-Dspring-boot.build-image.imageName='patbaumgartner/${project.artifactId}:${project.version}' \
237-
-Dspring-boot.build-image.runImage=patbaumgartner/run:base-cnb \
224+
-Dspring-boot.build-image.runImage=patbaumgartner/builder-jammy-base:latest \
238225
-Dspring-boot.build-image.pullPolicy=IF_NOT_PRESENT
239226
```
240227

241228
## Credits
242229

243-
Reverse engineering (unpinning certificates) was done with [APKLab](https://github.com/APKLab/APKLab) and the
244-
[Lovebox APK](https://www.apkmonk.com/app/love.lovebox.loveboxapp/) provided by [apkmonk](https://www.apkmonk.com). Postman
245-
was used to capture the REST calls from the mobile app. The article [Capturing Http Requests](https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-http-requests/)
246-
covers everything needed. After a Postman update, [new certs](https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-http-requests/#troubleshooting-certificate-issues) need to be installed.
230+
Reverse engineering (unpinning certificates) was done using [APKLab](https://github.com/APKLab/APKLab) and the [Lovebox APK](https://www.apkmonk.com/app/love.lovebox.loveboxapp/) provided by [apkmonk](https://www.apkmonk.com). Postman was used to capture the REST calls from the mobile application. The article [Capturing Http Requests](https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-http-requests/) covers everything you need to know. After updating Postman, [new certs](https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-http-requests/#troubleshooting-certificate-issues) need to be installed.

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3.8"
22

33
services:
44
lovebox-telegram-sender:
5-
image: patbaumgartner/lovebox-telegram-sender:0.0.1-SNAPSHOT
5+
image: lovebox-telegram-sender:0.1.0-SNAPSHOT
66
container_name: lovebox-telegram-sender
77
env_file:
8-
- ./.env
8+
- ./.env

0 commit comments

Comments
 (0)