Skip to content

Commit cfd6476

Browse files
committed
init basic quarkus server
1 parent 9b79f18 commit cfd6476

22 files changed

+1428
-8
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!target/*-runner
3+
!target/*-runner.jar
4+
!target/lib/*
5+
!target/quarkus-app/*

.gitignore

+35-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
1+
#Maven
12
target/
23
pom.xml.tag
34
pom.xml.releaseBackup
45
pom.xml.versionsBackup
5-
pom.xml.next
66
release.properties
7-
dependency-reduced-pom.xml
8-
buildNumber.properties
9-
.mvn/timing.properties
10-
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
11-
.mvn/wrapper/maven-wrapper.jar
7+
8+
9+
# Eclipse
10+
.project
11+
.classpath
12+
.settings/
13+
bin/
14+
15+
# IntelliJ
16+
.idea
17+
*.ipr
18+
*.iml
19+
*.iws
20+
21+
# NetBeans
22+
nb-configuration.xml
23+
24+
# Visual Studio Code
25+
.vscode
26+
.factorypath
27+
28+
# OSX
29+
.DS_Store
30+
31+
# Vim
32+
*.swp
33+
*.swo
34+
35+
# patch
36+
*.orig
37+
*.rej
38+
39+
# Local environment
40+
.env

README.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# indy-generic-proxy-service
2-
Indy microservice providing a generic HTTP proxy interface to Indy cached content, for non-Maven, non-NPM builds
1+
# Indy Generic Proxy Service
2+
Indy Generic Proxy Service is a single full-functional service providing a
3+
generic HTTP proxy interface to Indy cached content, for non-Maven, non-NPM
4+
builds.
5+
6+
## Prerequisite for building
7+
1. jdk11
8+
2. mvn 3.6.2+
9+
10+
## Prerequisite for debugging in local
11+
1. docker 20+
12+
2. docker-compose 1.20+
13+
14+
## Configure
15+
16+
see [src/main/resources/application.yaml](src/main/resources/application.properties) for details
17+
18+
19+
## Try it
20+
21+
There are a few steps to set it up.
22+
23+
1. Build (make sure you use jdk11 and mvn 3.6.2+)
24+
```
25+
$ git clone [email protected]:Commonjava/indy-repository-service.git
26+
$ cd indy-repository-service
27+
$ mvn clean compile
28+
```
29+
2. Start depending services:
30+
```
31+
$ docker-compose up
32+
```
33+
2. Start in debug mode
34+
```
35+
$ mvn quarkus:dev
36+
```

pom.xml

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Copyright (C) 2011-2021 Red Hat, Inc. (https://github.com/Commonjava/service-parent)
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
-->
14+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
16+
xmlns="http://maven.apache.org/POM/4.0.0">
17+
<parent>
18+
<groupId>org.commonjava</groupId>
19+
<artifactId>service-parent</artifactId>
20+
<version>1-SNAPSHOT</version>
21+
</parent>
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>org.commonjava.indy.service</groupId>
24+
<artifactId>indy-generic-proxy-service</artifactId>
25+
<version>1.0-SNAPSHOT</version>
26+
<name>Indy :: Service :: Generic Proxy</name>
27+
<properties>
28+
<apiVersion>1</apiVersion>
29+
<xnioVersion>3.8.2.Final</xnioVersion>
30+
<propulsorVersion>1.4</propulsorVersion>
31+
<httpcoreVersion>4.4.9</httpcoreVersion>
32+
<httpclientVersion>4.5.13</httpclientVersion>
33+
<weftVersion>1.19-SNAPSHOT</weftVersion>
34+
</properties>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.commonjava.indy.service</groupId>
39+
<artifactId>indy-event-model</artifactId>
40+
<version>1.0-SNAPSHOT</version>
41+
</dependency>
42+
<!-- quarkus deps start -->
43+
<dependency>
44+
<groupId>io.quarkus</groupId>
45+
<artifactId>quarkus-arc</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>io.quarkus</groupId>
49+
<artifactId>quarkus-resteasy-jackson</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>io.quarkus</groupId>
53+
<artifactId>quarkus-vertx</artifactId>
54+
</dependency>
55+
<dependency>
56+
<groupId>io.quarkus</groupId>
57+
<artifactId>quarkus-vertx-web</artifactId>
58+
</dependency>
59+
<dependency>
60+
<groupId>io.quarkus</groupId>
61+
<artifactId>quarkus-smallrye-openapi</artifactId>
62+
</dependency>
63+
<dependency>
64+
<groupId>io.quarkus</groupId>
65+
<artifactId>quarkus-smallrye-context-propagation</artifactId>
66+
</dependency>
67+
<dependency>
68+
<groupId>io.quarkus</groupId>
69+
<artifactId>quarkus-config-yaml</artifactId>
70+
</dependency>
71+
<dependency>
72+
<groupId>io.quarkus</groupId>
73+
<artifactId>quarkus-junit5</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>io.quarkus</groupId>
78+
<artifactId>quarkus-undertow</artifactId>
79+
</dependency>
80+
<dependency>
81+
<groupId>io.quarkus</groupId>
82+
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
83+
</dependency>
84+
<dependency>
85+
<groupId>io.rest-assured</groupId>
86+
<artifactId>rest-assured</artifactId>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.jboss.xnio</groupId>
91+
<artifactId>xnio-nio</artifactId>
92+
<version>${xnioVersion}</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.commonjava.propulsor</groupId>
96+
<artifactId>propulsor-core</artifactId>
97+
<version>${propulsorVersion}</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>org.apache.httpcomponents</groupId>
101+
<artifactId>httpclient</artifactId>
102+
<version>${httpclientVersion}</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.apache.httpcomponents</groupId>
106+
<artifactId>httpcore</artifactId>
107+
<version>${httpcoreVersion}</version>
108+
</dependency>
109+
<dependency>
110+
<groupId>org.apache.commons</groupId>
111+
<artifactId>commons-compress</artifactId>
112+
<version>1.19</version>
113+
</dependency>
114+
</dependencies>
115+
116+
<build>
117+
<plugins>
118+
<plugin>
119+
<groupId>io.quarkus</groupId>
120+
<artifactId>quarkus-maven-plugin</artifactId>
121+
</plugin>
122+
<plugin>
123+
<groupId>ru.concerteza.buildnumber</groupId>
124+
<artifactId>maven-jgit-buildnumber-plugin</artifactId>
125+
<version>1.2.9</version>
126+
<executions>
127+
<execution>
128+
<id>git-buildnumber</id>
129+
<goals>
130+
<goal>extract-buildnumber</goal>
131+
</goals>
132+
<phase>initialize</phase>
133+
<configuration>
134+
<runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
135+
</configuration>
136+
</execution>
137+
</executions>
138+
</plugin>
139+
<plugin>
140+
<groupId>org.codehaus.mojo</groupId>
141+
<artifactId>buildnumber-maven-plugin</artifactId>
142+
<version>1.1</version>
143+
<executions>
144+
<execution>
145+
<id>buildnumbers</id>
146+
<phase>initialize</phase>
147+
<goals>
148+
<goal>create</goal>
149+
</goals>
150+
<configuration>
151+
<timestampFormat>{0,date,yyyy-MM-dd HH:mm Z}</timestampFormat>
152+
</configuration>
153+
</execution>
154+
</executions>
155+
</plugin>
156+
</plugins>
157+
</build>
158+
</project>

src/main/docker/Dockerfile.jvm

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
3+
#
4+
# Before building the container image run:
5+
#
6+
# ./mvnw package
7+
#
8+
# Then, build the image with:
9+
#
10+
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/indy-generic-proxy-service-jvm .
11+
#
12+
# Then run the container using:
13+
#
14+
# docker run -i --rm -p 8080:8080 quarkus/indy-generic-proxy-service-jvm
15+
#
16+
# If you want to include the debug port into your docker image
17+
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005
18+
#
19+
# Then run the container using :
20+
#
21+
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/indy-generic-proxy-service-jvm
22+
#
23+
###
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
25+
26+
ARG JAVA_PACKAGE=java-11-openjdk-headless
27+
ARG RUN_JAVA_VERSION=1.3.8
28+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
29+
# Install java and the run-java script
30+
# Also set up permissions for user `1001`
31+
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
32+
&& microdnf update \
33+
&& microdnf clean all \
34+
&& mkdir /deployments \
35+
&& chown 1001 /deployments \
36+
&& chmod "g+rwX" /deployments \
37+
&& chown 1001:root /deployments \
38+
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
39+
&& chown 1001 /deployments/run-java.sh \
40+
&& chmod 540 /deployments/run-java.sh \
41+
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
42+
43+
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
44+
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
45+
# We make four distinct layers so if there are application changes the library layers can be re-used
46+
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
47+
COPY --chown=1001 target/quarkus-app/*.jar /deployments/
48+
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
49+
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
50+
51+
EXPOSE 8080
52+
USER 1001
53+
54+
ENTRYPOINT [ "/deployments/run-java.sh" ]
55+

src/main/docker/Dockerfile.legacy-jar

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
3+
#
4+
# Before building the container image run:
5+
#
6+
# ./mvnw package -Dquarkus.package.type=legacy-jar
7+
#
8+
# Then, build the image with:
9+
#
10+
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/indy-generic-proxy-service-legacy-jar .
11+
#
12+
# Then run the container using:
13+
#
14+
# docker run -i --rm -p 8080:8080 quarkus/indy-generic-proxy-service-legacy-jar
15+
#
16+
# If you want to include the debug port into your docker image
17+
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005
18+
#
19+
# Then run the container using :
20+
#
21+
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/indy-generic-proxy-service-legacy-jar
22+
#
23+
###
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
25+
26+
ARG JAVA_PACKAGE=java-11-openjdk-headless
27+
ARG RUN_JAVA_VERSION=1.3.8
28+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
29+
# Install java and the run-java script
30+
# Also set up permissions for user `1001`
31+
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
32+
&& microdnf update \
33+
&& microdnf clean all \
34+
&& mkdir /deployments \
35+
&& chown 1001 /deployments \
36+
&& chmod "g+rwX" /deployments \
37+
&& chown 1001:root /deployments \
38+
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
39+
&& chown 1001 /deployments/run-java.sh \
40+
&& chmod 540 /deployments/run-java.sh \
41+
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
42+
43+
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
44+
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
45+
COPY target/lib/* /deployments/lib/
46+
COPY target/*-runner.jar /deployments/app.jar
47+
48+
EXPOSE 8080
49+
USER 1001
50+
51+
ENTRYPOINT [ "/deployments/run-java.sh" ]

src/main/docker/Dockerfile.native

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
3+
#
4+
# Before building the container image run:
5+
#
6+
# ./mvnw package -Pnative
7+
#
8+
# Then, build the image with:
9+
#
10+
# docker build -f src/main/docker/Dockerfile.native -t quarkus/indy-generic-proxy-service .
11+
#
12+
# Then run the container using:
13+
#
14+
# docker run -i --rm -p 8080:8080 quarkus/indy-generic-proxy-service
15+
#
16+
###
17+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
18+
WORKDIR /work/
19+
RUN chown 1001 /work \
20+
&& chmod "g+rwX" /work \
21+
&& chown 1001:root /work
22+
COPY --chown=1001:root target/*-runner /work/application
23+
24+
EXPOSE 8080
25+
USER 1001
26+
27+
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

0 commit comments

Comments
 (0)