Skip to content

Commit 4ef5279

Browse files
authored
Merge pull request #31 from javaBin/dependency-upgrades
Dependency upgrades and run with mise
2 parents bc528ce + 8373487 commit 4ef5279

18 files changed

Lines changed: 216 additions & 89 deletions

File tree

.github/workflows/maven.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Set up JDK
3333
uses: actions/setup-java@v4
3434
with:
35-
java-version: '21'
35+
java-version: '25'
3636
distribution: corretto
3737
cache: maven
3838

Dockerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22
# Run: docker run --name moresleep-container -p 5000:5000 moresleep-app:latest
33
# Check localhost:5000 and you should get a homepage
44
# Stage 1: Build the application
5-
FROM maven:3.9.11-eclipse-temurin-21 AS build
5+
FROM maven:3.9.12-eclipse-temurin-25 AS build
66
WORKDIR /app
77
COPY pom.xml .
88
COPY src ./src
99
RUN mvn clean package -Dmaven.test.skip=true
1010

1111
# Stage 2: Create the final runtime image
12-
FROM eclipse-temurin:21-jre-jammy AS final
12+
FROM eclipse-temurin:25-jre-jammy AS final
1313

14-
# Install SOPS
15-
RUN curl -L -o /usr/local/bin/sops https://github.com/getsops/sops/releases/download/v3.10.2/sops-v3.10.2.linux.amd64 && \
16-
chmod +x /usr/local/bin/sops
17-
18-
# Install unzip and curl
19-
RUN apt-get update && \
14+
# Install unzip and curl
15+
RUN apt-get update -y && \
2016
apt-get install -y curl unzip && \
2117
rm -rf /var/lib/apt/lists/*
2218

19+
# Install SOPS
20+
RUN curl -L -o /usr/local/bin/sops https://github.com/getsops/sops/releases/download/v3.11.0/sops-v3.11.0.linux.amd64 && \
21+
chmod +x /usr/local/bin/sops
22+
2323
# Install AWS CLI v2
2424
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip" && \
2525
unzip /tmp/awscliv2.zip -d /tmp && \
2626
/tmp/aws/install && \
2727
rm -rf /tmp/aws /tmp/awscliv2.zip
2828

2929
WORKDIR /app
30-
COPY --from=build /app/target/cake-redux-0.3-SNAPSHOT-jar-with-dependencies.jar app.jar
30+
COPY --from=build /app/target/cake-redux-jar-with-dependencies.jar app.jar
3131
COPY ./config/.enc.prod.env /app/.enc.env
3232

3333
# Remove AWS profile from SOPS config to use container's AWS credentials
3434
RUN sed -i 's/sops_kms__list_0__map_aws_profile=javabin/sops_kms__list_0__map_aws_profile=/' /app/.enc.env
3535

3636
EXPOSE 8081
37-
ENTRYPOINT ["sops", "exec-env", ".enc.env", "java -jar app.jar"]
37+
ENTRYPOINT ["sops", "exec-env", ".enc.env", "java -jar app.jar"]

compose.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: cake-lie
2+
3+
services:
4+
db:
5+
image: postgres:17.6-alpine
6+
restart: unless-stopped
7+
command: |
8+
postgres
9+
-c max_connections=200
10+
-c shared_buffers=2GB
11+
-c wal_level=minimal
12+
-c fsync=off
13+
-c synchronous_commit=off
14+
-c full_page_writes=off
15+
-c work_mem=16MB
16+
-c max_wal_senders=0
17+
-c wal_level=minimal
18+
-c wal_writer_delay=5s
19+
-c wal_buffers=32MB
20+
-c maintenance_work_mem=128MB
21+
-c max_wal_size=3GB
22+
-c shared_preload_libraries=pg_stat_statements,auto_explain
23+
-c auto_explain.log_min_duration=50ms
24+
-c auto_explain.log_analyze=true
25+
-c auto_explain.log_buffers=true
26+
-c auto_explain.log_timing=true
27+
volumes:
28+
- pg-data:/var/lib/postgresql/data
29+
environment:
30+
POSTGRES_USER: localdevuser
31+
POSTGRES_PASSWORD: localdevuser
32+
POSTGRES_DB: moresleeplocal
33+
TZ: Europe/Oslo
34+
healthcheck:
35+
test: [ "CMD" , "/usr/local/bin/pg_isready", "-d", "moresleeplocal", "-U", "localdevuser", "-t", "3" ]
36+
retries: 3
37+
timeout: 1m
38+
start_period: 15s
39+
40+
moresleep:
41+
image: ghcr.io/javabin/moresleep:edge
42+
ports:
43+
- "8082:8082"
44+
env_file:
45+
- path: ./.env.moresleep
46+
required: false
47+
environment:
48+
DBHOST: db
49+
depends_on:
50+
db:
51+
condition: service_healthy
52+
53+
volumes:
54+
pg-data: {}

mise.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[tools]
2+
java = "25"
3+
maven = "latest"
4+
5+
[tasks.infrastructure]
6+
run = [
7+
"""
8+
if ! netstat -an | grep -q '[.:]5432\\b'; then
9+
echo "Starter Infrastrutur..."
10+
docker compose up --wait
11+
else
12+
echo "Infrastruturen kjører allerede"
13+
fi
14+
""",
15+
""
16+
]
17+
18+
[tasks.infrastructure-destroy]
19+
run = [
20+
"docker compose down -v"
21+
]
22+
23+
[tasks.start]
24+
depends = ["infrastructure"]
25+
env = { SLEEPINGPILL_BASE_LOCATION = "http://localhost:8082", NO_AUTH_MODE = "true", SERVER_PORT = "5000", CAKE_LOCATION = "localhost" }
26+
run = [
27+
"mvn clean package",
28+
"java -jar -Xmx512m -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 target/cake-redux-jar-with-dependencies.jar env-only"
29+
]

pom.xml

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>no.javazone</groupId>
56
<artifactId>cake-redux</artifactId>
@@ -10,9 +11,23 @@
1011
<properties>
1112
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1213
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
13-
<kotlin.version>1.8.0</kotlin.version>
14+
<kotlin.version>2.3.0</kotlin.version>
1415
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
1516
</properties>
17+
<dependencyManagement>
18+
<dependencies>
19+
<dependency>
20+
<groupId>commons-codec</groupId>
21+
<artifactId>commons-codec</artifactId>
22+
<version>1.19.0</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>commons-logging</groupId>
26+
<artifactId>commons-logging</artifactId>
27+
<version>1.3.5</version>
28+
</dependency>
29+
</dependencies>
30+
</dependencyManagement>
1631

1732
<dependencies>
1833
<dependency>
@@ -23,51 +38,62 @@
2338
<dependency>
2439
<groupId>junit</groupId>
2540
<artifactId>junit</artifactId>
26-
<version>4.11</version>
41+
<version>4.13.2</version>
2742
<scope>test</scope>
2843
</dependency>
44+
<dependency>
45+
<groupId>jakarta.servlet</groupId>
46+
<artifactId>jakarta.servlet-api</artifactId>
47+
<version>6.0.0</version>
48+
<scope>provided</scope>
49+
</dependency>
2950
<dependency>
3051
<groupId>org.eclipse.jetty</groupId>
3152
<artifactId>jetty-server</artifactId>
32-
<version>9.4.16.v20190411</version>
53+
<version>12.1.5</version>
3354
</dependency>
3455
<dependency>
35-
<groupId>org.eclipse.jetty</groupId>
36-
<artifactId>jetty-plus</artifactId>
37-
<version>9.4.16.v20190411</version>
56+
<groupId>org.eclipse.jetty.ee10</groupId>
57+
<artifactId>jetty-ee10-servlet</artifactId>
58+
<version>12.1.5</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.eclipse.jetty.ee10</groupId>
62+
<artifactId>jetty-ee10-webapp</artifactId>
63+
<version>12.1.5</version>
3864
</dependency>
3965
<dependency>
4066
<groupId>org.assertj</groupId>
4167
<artifactId>assertj-core</artifactId>
42-
<version>1.7.0</version>
68+
<version>3.11.1</version>
4369
<scope>test</scope>
4470
</dependency>
4571

4672
<dependency>
4773
<groupId>org.mockito</groupId>
48-
<artifactId>mockito-all</artifactId>
49-
<version>1.9.5</version>
74+
<artifactId>mockito-core</artifactId>
75+
<version>5.19.0</version>
5076
<scope>test</scope>
5177
</dependency>
5278

5379

5480
<dependency>
5581
<groupId>org.jsonbuddy</groupId>
5682
<artifactId>jsonbuddy</artifactId>
57-
<version>0.8.0</version>
83+
<version>0.18.1</version>
5884
</dependency>
5985

6086

6187
<dependency>
6288
<groupId>com.sendgrid</groupId>
6389
<artifactId>sendgrid-java</artifactId>
64-
<version>4.1.0</version>
90+
<version>4.10.3</version>
6591
</dependency>
6692

6793
<dependency>
6894
<groupId>org.logevents</groupId>
6995
<artifactId>logevents</artifactId>
70-
<version>0.1.38</version>
96+
<version>0.5.9</version>
7197
</dependency>
7298
<dependency>
7399
<groupId>org.jetbrains.kotlin</groupId>
@@ -77,6 +103,7 @@
77103
</dependencies>
78104

79105
<build>
106+
<finalName>${project.artifactId}</finalName>
80107
<plugins>
81108
<plugin>
82109
<artifactId>kotlin-maven-plugin</artifactId>
@@ -85,7 +112,9 @@
85112
<executions>
86113
<execution>
87114
<id>compile</id>
88-
<goals> <goal>compile</goal> </goals>
115+
<goals>
116+
<goal>compile</goal>
117+
</goals>
89118
<configuration>
90119
<sourceDirs>
91120
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
@@ -95,7 +124,9 @@
95124
</execution>
96125
<execution>
97126
<id>test-compile</id>
98-
<goals> <goal>test-compile</goal> </goals>
127+
<goals>
128+
<goal>test-compile</goal>
129+
</goals>
99130
<configuration>
100131
<sourceDirs>
101132
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
@@ -110,10 +141,9 @@
110141
<plugin>
111142
<artifactId>maven-compiler-plugin</artifactId>
112143
<configuration>
113-
<target>11</target>
114-
<source>11</source>
144+
<release>25</release>
115145
</configuration>
116-
<version>3.10.1</version>
146+
<version>3.14.1</version>
117147
<executions>
118148
<!-- Replacing default-compile as it is treated specially by maven -->
119149
<execution>
@@ -128,12 +158,16 @@
128158
<execution>
129159
<id>java-compile</id>
130160
<phase>compile</phase>
131-
<goals> <goal>compile</goal> </goals>
161+
<goals>
162+
<goal>compile</goal>
163+
</goals>
132164
</execution>
133165
<execution>
134166
<id>java-test-compile</id>
135167
<phase>test-compile</phase>
136-
<goals> <goal>testCompile</goal> </goals>
168+
<goals>
169+
<goal>testCompile</goal>
170+
</goals>
137171
</execution>
138172
</executions>
139173
</plugin>
@@ -145,7 +179,9 @@
145179
<execution>
146180
<id>copy-dependencies</id>
147181
<phase>package</phase>
148-
<goals><goal>copy-dependencies</goal></goals>
182+
<goals>
183+
<goal>copy-dependencies</goal>
184+
</goals>
149185
</execution>
150186
</executions>
151187
</plugin>

src/main/java/no/javazone/cake/redux/DataServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import org.jsonbuddy.parse.JsonParser;
1414
import org.jsonbuddy.pojo.PojoMapper;
1515

16-
import javax.servlet.ServletException;
17-
import javax.servlet.http.HttpServlet;
18-
import javax.servlet.http.HttpServletRequest;
19-
import javax.servlet.http.HttpServletResponse;
16+
import jakarta.servlet.ServletException;
17+
import jakarta.servlet.http.HttpServlet;
18+
import jakarta.servlet.http.HttpServletRequest;
19+
import jakarta.servlet.http.HttpServletResponse;
2020
import java.io.IOException;
2121
import java.io.InputStream;
2222
import java.io.PrintWriter;

src/main/java/no/javazone/cake/redux/EntranceServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import org.jsonbuddy.JsonObject;
55
import org.jsonbuddy.parse.JsonParser;
66

7-
import javax.servlet.ServletException;
8-
import javax.servlet.http.HttpServlet;
9-
import javax.servlet.http.HttpServletRequest;
10-
import javax.servlet.http.HttpServletResponse;
7+
import jakarta.servlet.ServletException;
8+
import jakarta.servlet.http.HttpServlet;
9+
import jakarta.servlet.http.HttpServletRequest;
10+
import jakarta.servlet.http.HttpServletResponse;
1111
import java.io.*;
1212
import java.net.HttpURLConnection;
1313
import java.net.URL;

src/main/java/no/javazone/cake/redux/OpenDataServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import org.jsonbuddy.JsonObject;
1111
import org.jsonbuddy.parse.JsonParser;
1212

13-
import javax.servlet.ServletException;
14-
import javax.servlet.http.HttpServlet;
15-
import javax.servlet.http.HttpServletRequest;
16-
import javax.servlet.http.HttpServletResponse;
13+
import jakarta.servlet.ServletException;
14+
import jakarta.servlet.http.HttpServlet;
15+
import jakarta.servlet.http.HttpServletRequest;
16+
import jakarta.servlet.http.HttpServletResponse;
1717
import java.io.IOException;
1818
import java.io.PrintWriter;
1919

src/main/java/no/javazone/cake/redux/SecurityFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package no.javazone.cake.redux;
22

3-
import javax.servlet.*;
4-
import javax.servlet.http.HttpServletRequest;
3+
import jakarta.servlet.*;
4+
import jakarta.servlet.http.HttpServletRequest;
55
import java.io.IOException;
66

77
public class SecurityFilter implements Filter {

src/main/java/no/javazone/cake/redux/SigninServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package no.javazone.cake.redux;
22

3-
import javax.servlet.ServletException;
4-
import javax.servlet.http.HttpServlet;
5-
import javax.servlet.http.HttpServletRequest;
6-
import javax.servlet.http.HttpServletResponse;
3+
import jakarta.servlet.ServletException;
4+
import jakarta.servlet.http.HttpServlet;
5+
import jakarta.servlet.http.HttpServletRequest;
6+
import jakarta.servlet.http.HttpServletResponse;
77
import java.io.IOException;
88

99
public class SigninServlet extends HttpServlet {

0 commit comments

Comments
 (0)