Skip to content

Commit 2cc5e1a

Browse files
committed
add data-service jib docker image generator to data-service app
1 parent 3869406 commit 2cc5e1a

File tree

6 files changed

+65
-8
lines changed

6 files changed

+65
-8
lines changed

data-service/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@
2424
<skipTests>false</skipTests>
2525
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
2626
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
27+
<skipDocker>false</skipDocker>
2728
</properties>
2829

2930
<profiles>
31+
<profile>
32+
<id>skip-docker</id>
33+
<properties>
34+
<skipDocker>true</skipDocker>
35+
<dockerImageTag>pwm/pwm-data-service</dockerImageTag>
36+
</properties>
37+
</profile>
3038
</profiles>
3139

3240
<build>
@@ -87,6 +95,48 @@
8795
<artifactId>maven-clean-plugin</artifactId>
8896
<version>3.1.0</version>
8997
</plugin>
98+
99+
<plugin>
100+
<groupId>com.google.cloud.tools</groupId>
101+
<artifactId>jib-maven-plugin</artifactId>
102+
<version>3.2.0</version>
103+
<executions>
104+
<execution>
105+
<id>make-docker-image</id>
106+
<phase>package</phase>
107+
<goals>
108+
<goal>buildTar</goal>
109+
</goals>
110+
<configuration>
111+
<skip>${skipDocker}</skip>
112+
<from>
113+
<image>tomcat:9.0-jdk17-temurin</image>
114+
</from>
115+
<to>
116+
<image>pwm/pwm-data-service</image>
117+
<tags>
118+
<tag>${project.version}</tag>
119+
<tag>latest</tag>
120+
</tags>
121+
</to>
122+
<outputPaths>
123+
<tar>target/pwm-data-service-docker-image-${project.version}.tar</tar>
124+
</outputPaths>
125+
<container>
126+
<appRoot>/usr/local/tomcat/webapps/ROOT</appRoot>
127+
<environment>
128+
<DATA_SERVICE_PROPS>/config/data-service.properties</DATA_SERVICE_PROPS>
129+
</environment>
130+
<creationTime>${git.commit.time}</creationTime>
131+
<filesModificationTime>${git.commit.time}</filesModificationTime>
132+
<volumes>
133+
<volume>/config</volume>
134+
</volumes>
135+
</container>
136+
</configuration>
137+
</execution>
138+
</executions>
139+
</plugin>
90140
</plugins>
91141
</build>
92142

data-service/src/main/java/password/pwm/receiver/PwmReceiverApp.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ public class PwmReceiverApp
3434
private static final String ENV_NAME = "DATA_SERVICE_PROPS";
3535

3636
private Storage storage;
37-
private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
3837
private Settings settings;
39-
private Status status = new Status();
38+
39+
private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
40+
private final Status status = new Status();
4041

4142
public PwmReceiverApp( )
4243
{

data-service/src/main/java/password/pwm/receiver/TelemetryViewerServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class TelemetryViewerServlet extends HttpServlet
4646
@Override
4747
protected void doGet( final HttpServletRequest req, final HttpServletResponse resp ) throws ServletException, IOException
4848
{
49-
LOGGER.debug( "htttp request for viewer" );
49+
LOGGER.debug( "http request for viewer" );
5050
final String daysString = req.getParameter( PARAM_DAYS );
5151
final int days = StringUtil.isEmpty( daysString ) ? 30 : Integer.parseInt( daysString );
5252
final ContextManager contextManager = ContextManager.getContextManager( req.getServletContext() );

data-service/src/main/webapp/WEB-INF/web.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
~ limitations under the License.
2020
-->
2121

22-
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23-
xmlns="http://java.sun.com/xml/ns/javaee"
24-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
25-
id="PWM" version="3.0">
22+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
25+
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
26+
version="3.1"
27+
id="PWM-Data-Service">
2628
<display-name>PWM Data Service</display-name>
2729
<!-- <distributable/> Clustering/Session replication is not supported -->
2830
<description>Password Management Servlet - Data Service</description>

docker/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<name>PWM Password Self Service: Docker Image</name>
1717

1818
<properties>
19+
<dockerImageTag>pwm/pwm-webapp</dockerImageTag>
1920
<skipDocker>false</skipDocker>
2021
</properties>
2122

@@ -48,6 +49,10 @@
4849
</from>
4950
<to>
5051
<image>${dockerImageTag}</image>
52+
<tags>
53+
<tag>latest</tag>
54+
<tag>${project.version}</tag>
55+
</tags>
5156
</to>
5257
<outputPaths>
5358
<tar>target/pwm-docker-image-${project.version}.tar</tar>

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
<properties>
2626
<warArtifactID>pwm-${project.version}.war</warArtifactID>
27-
<dockerImageTag>pwm/pwm-webapp</dockerImageTag>
2827

2928
<build.number>0</build.number> <!-- default in case not set on command line -->
3029
<build.revision>0</build.revision> <!-- default in case not set on command line -->

0 commit comments

Comments
 (0)