Skip to content

Commit 1544273

Browse files
authored
Merge pull request #2199 from tecarter94/domain-proxy-standalone-improvements
Domain proxy standalone improvements
2 parents a64e540 + f5dd234 commit 1544273

File tree

31 files changed

+568
-359
lines changed

31 files changed

+568
-359
lines changed

.github/workflows/java-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
1818
restore-keys: |
1919
${{ runner.os }}-maven-
20-
- name: Set up JDK 17
20+
- name: Set up JDK 21
2121
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
2222
with:
2323
distribution: 'temurin'
24-
java-version: 17
24+
java-version: 21
2525
- name: Set up Maven
2626
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
2727
with:

java-components/build-request-processor/src/main/docker/Dockerfile.all-in-one

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-17@sha256:06edd8c82406da7466b73d589a07a10bf121ae5677b0f32e76120213d5303824 AS builder
1+
FROM registry.access.redhat.com/ubi8/openjdk-21@sha256:a10b277c0f16283bb45b0e6cfca3ae9ecf155178f7f731df4a1f744ebd35af70 AS builder
22
USER 0
33
WORKDIR /work
44
COPY ./ .
55

66
RUN mvn -V -B package -pl build-request-processor -am -Dmaven.test.skip
77

8-
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime@sha256:8e863153659dba9ee288b97b7cdf7a83274dd78b26da1e5da6798d0bd45166e8
8+
FROM registry.access.redhat.com/ubi8/openjdk-21-runtime@sha256:c1bf8370627eaed6711ea22915b476d4216517c35c8f8268c0d39ed983bceaff
99
USER 0
1010
WORKDIR /work/
1111

java-components/build-request-processor/src/test/java/com/redhat/hacbs/container/verifier/JarVerificationTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void visit(int version, int access, String name, String signature, String
6666
super.visit(version - 1, access, name, signature, superName, interfaces);
6767
}
6868

69-
}, List.of(new ExpectedChange(ChangeType.MODIFY, "version:61.0>60.0")));
69+
}, List.of(new ExpectedChange(ChangeType.MODIFY, "version:65.0>64.0")));
7070
}
7171

7272
@Test

java-components/cache/src/main/docker/Dockerfile.all-in-one

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-17@sha256:06edd8c82406da7466b73d589a07a10bf121ae5677b0f32e76120213d5303824 AS builder
1+
FROM registry.access.redhat.com/ubi8/openjdk-21@sha256:a10b277c0f16283bb45b0e6cfca3ae9ecf155178f7f731df4a1f744ebd35af70 AS builder
22
USER 0
33
WORKDIR /work
44
COPY ./ .
@@ -7,7 +7,7 @@ RUN mkdir -p /work/cache/target/classes
77

88
RUN mvn -V -B package -pl cache -am -Dmaven.test.skip
99

10-
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime@sha256:8e863153659dba9ee288b97b7cdf7a83274dd78b26da1e5da6798d0bd45166e8
10+
FROM registry.access.redhat.com/ubi8/openjdk-21-runtime@sha256:c1bf8370627eaed6711ea22915b476d4216517c35c8f8268c0d39ed983bceaff
1111
USER 0
1212
WORKDIR /work/
1313

java-components/cli/src/main/docker/Dockerfile.all-in-one

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-17@sha256:06edd8c82406da7466b73d589a07a10bf121ae5677b0f32e76120213d5303824 AS builder
1+
FROM registry.access.redhat.com/ubi8/openjdk-21@sha256:a10b277c0f16283bb45b0e6cfca3ae9ecf155178f7f731df4a1f744ebd35af70 AS builder
22

33
WORKDIR /work
44
COPY ./ .
55

66
RUN mvn -V -B package -pl cli -am -DskipTests
77

8-
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime@sha256:8e863153659dba9ee288b97b7cdf7a83274dd78b26da1e5da6798d0bd45166e8
8+
FROM registry.access.redhat.com/ubi8/openjdk-21-runtime@sha256:c1bf8370627eaed6711ea22915b476d4216517c35c8f8268c0d39ed983bceaff
99
WORKDIR /work/
1010

1111
COPY --from=builder /work/cli/target/quarkus-app/lib/ /deployments/lib/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM quay.io/redhat-appstudio/buildah:v1.35.4@sha256:3d3575bb7d0df64abcf1f22f06e82101a945d03317db1f3caac12814f796d01c
2+
RUN dnf install -y iproute
3+
COPY client/target/domain-proxy-client-999-SNAPSHOT-runner /app/domain-proxy-client-runner
4+
COPY server/target/domain-proxy-server-999-SNAPSHOT-runner /app/domain-proxy-server-runner

java-components/domainproxy/client/pom.xml renamed to java-components/domain-proxy/client/pom.xml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,19 @@
44
<modelVersion>4.0.0</modelVersion>
55
<parent>
66
<groupId>io.github.redhat-appstudio.jvmbuild</groupId>
7-
<artifactId>domainproxy-parent</artifactId>
7+
<artifactId>domain-proxy-parent</artifactId>
88
<version>999-SNAPSHOT</version>
99
</parent>
10-
<artifactId>domainproxy-client</artifactId>
10+
<artifactId>domain-proxy-client</artifactId>
1111

1212
<dependencies>
1313
<dependency>
1414
<groupId>io.quarkus</groupId>
1515
<artifactId>quarkus-arc</artifactId>
1616
</dependency>
1717
<dependency>
18-
<groupId>io.quarkus</groupId>
19-
<artifactId>quarkus-junit5</artifactId>
20-
<scope>test</scope>
21-
</dependency>
22-
<dependency>
23-
<groupId>io.rest-assured</groupId>
24-
<artifactId>rest-assured</artifactId>
25-
<scope>test</scope>
18+
<groupId>io.github.redhat-appstudio.jvmbuild</groupId>
19+
<artifactId>domain-proxy-common</artifactId>
2620
</dependency>
2721
</dependencies>
2822

@@ -37,7 +31,6 @@
3731
<goals>
3832
<goal>build</goal>
3933
<goal>generate-code</goal>
40-
<goal>generate-code-tests</goal>
4134
</goals>
4235
</execution>
4336
</executions>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.redhat.hacbs.domainproxy.client;
2+
3+
import static com.redhat.hacbs.domainproxy.common.CommonIOUtil.createChannelToSocketWriter;
4+
import static com.redhat.hacbs.domainproxy.common.CommonIOUtil.createSocketToChannelWriter;
5+
6+
import java.io.IOException;
7+
import java.net.ServerSocket;
8+
import java.net.Socket;
9+
import java.net.UnixDomainSocketAddress;
10+
import java.nio.channels.SocketChannel;
11+
12+
import jakarta.annotation.PostConstruct;
13+
import jakarta.inject.Inject;
14+
import jakarta.inject.Singleton;
15+
16+
import org.eclipse.microprofile.config.inject.ConfigProperty;
17+
18+
import io.quarkus.logging.Log;
19+
import io.quarkus.runtime.Quarkus;
20+
import io.quarkus.runtime.Startup;
21+
22+
@Startup
23+
@Singleton
24+
public class DomainProxyClient {
25+
26+
@Inject
27+
@ConfigProperty(name = "client-domain-socket")
28+
String domainSocket;
29+
30+
@Inject
31+
@ConfigProperty(name = "client-http-port")
32+
int clientHttpPort;
33+
34+
@Inject
35+
@ConfigProperty(name = "byte-buffer-size")
36+
int byteBufferSize;
37+
38+
@PostConstruct
39+
public void start() {
40+
Log.info("Starting domain proxy client...");
41+
new Thread(() -> {
42+
try (final ServerSocket serverSocket = new ServerSocket(clientHttpPort)) {
43+
while (true) {
44+
final Socket socket = serverSocket.accept();
45+
final UnixDomainSocketAddress address = UnixDomainSocketAddress.of(domainSocket);
46+
final SocketChannel channel = SocketChannel.open(address);
47+
// Write from socket to channel
48+
Thread.startVirtualThread(createSocketToChannelWriter(byteBufferSize, socket, channel));
49+
// Write from channel to socket
50+
Thread.startVirtualThread(createChannelToSocketWriter(byteBufferSize, channel, socket));
51+
}
52+
} catch (final IOException e) {
53+
Log.errorf(e, "Error initialising domain proxy client");
54+
}
55+
Quarkus.asyncExit();
56+
}).start();
57+
}
58+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
client-domain-socket=${DOMAIN_SOCKET:/tmp/domainserver}
2+
client-http-port=8080
3+
byte-buffer-size=${BYTE_BUFFER_SIZE:1024}

0 commit comments

Comments
 (0)