cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Initial Docker work on spring_boot_scan
Date Wed, 16 Aug 2017 14:55:27 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 7f9e0f467 -> 9eb57287e


Initial Docker work on spring_boot_scan


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9eb57287
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9eb57287
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9eb57287

Branch: refs/heads/3.1.x-fixes
Commit: 9eb57287ee4f2d3b89afa91d67e59da39f848f89
Parents: 7f9e0f4
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Aug 16 15:53:05 2017 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Aug 16 15:55:07 2017 +0100

----------------------------------------------------------------------
 .../samples/jax_rs/spring_boot/Dockerfile       |  4 +-
 .../release/samples/jax_rs/spring_boot/README   |  5 +-
 .../release/samples/jax_rs/spring_boot/pom.xml  |  2 +-
 .../spring_boot_scan/application/Dockerfile     |  5 ++
 .../jax_rs/spring_boot_scan/application/README  | 45 +++++++++++++----
 .../jax_rs/spring_boot_scan/application/pom.xml | 53 +++++++++++++++++---
 .../src/main/resources/application.yml          |  2 +-
 .../jax_rs/spring_boot_scan/client/pom.xml      |  2 +-
 .../spring_boot_scan/eureka-registry/Dockerfile |  6 +++
 .../spring_boot_scan/eureka-registry/README     | 35 +++++++++++--
 .../spring_boot_scan/eureka-registry/pom.xml    | 28 ++++++++++-
 11 files changed, 157 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot/Dockerfile
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/Dockerfile b/distribution/src/main/release/samples/jax_rs/spring_boot/Dockerfile
index 57ef253..d4c8390 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/Dockerfile
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/Dockerfile
@@ -1,5 +1,5 @@
 FROM openjdk:8-jdk-alpine
 VOLUME /tmp
-ADD target/spring-boot-sample-rs-cxf.jar app.jar
+ADD target/spring-boot-sample-rs.jar spring-boot-sample-rs.jar
 ENV JAVA_OPTS=""
-ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar"
]
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /spring-boot-sample-rs.jar"
]

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/README b/distribution/src/main/release/samples/jax_rs/spring_boot/README
index 4d107b1..36c5ada 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/README
@@ -31,10 +31,10 @@ $ mvn dockerfile:push
 
 Run the container:
 --
-docker run -p 8080:8080 -t ${username}/apachecxf:spring-boot-sample-rs-cxf
+docker run -p 8080:8080 -t ${username}/apachecxf:spring-boot-sample-rs
 --
 
-== Testing the server ==
+= Testing the server =
 
 ---- From the browser ----
 
@@ -46,6 +46,7 @@ http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser
 
 will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
 
+
 http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON
 description of services.
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
index 4b63e0b..2db4aff 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
@@ -8,7 +8,7 @@
         <relativePath>../..</relativePath>
     </parent>
     <groupId>org.apache.cxf.samples</groupId> 
-    <artifactId>spring-boot-sample-rs-cxf</artifactId>
+    <artifactId>spring-boot-sample-rs</artifactId>
     <name>Spring Boot CXF REST Application</name>
     <description>Spring Boot CXF REST Application</description>
     <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/Dockerfile
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/Dockerfile
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/Dockerfile
new file mode 100644
index 0000000..dd22ae1
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/Dockerfile
@@ -0,0 +1,5 @@
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+ADD target/spring-boot-sample-rs-scan-app.jar spring-boot-sample-rs-scan-app.jar
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /spring-boot-sample-rs-scan-app.jar"
]

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
index 6295e29..d083b16 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
@@ -7,23 +7,43 @@ and deployed in a single JAX-RS endpoint.
 The application registers itself with Eureka Registry.  
 
 The client discovers the client address from the registry and invokes it.
+Make sure that the Eureka registry is started as described in the eureka-registry/README
+before running this application.
 
-The sample uses Maven. It can be built and run from the command line.
+= Starting the server =
 
-To run the client from a command line:
+The sample uses Maven. It can be built and run from the command line using Maven, Java or
Docker:
 
-1. If you have not started a eureka-registry application then build and start it 
-first in the eureka-registry folder in a separate terminal window:
+---- With Maven ----
 
 $ mvn spring-boot:run
 
-2. Run the server 
-----
-$ mvn -Pserver
-----
+---- With Java ----
 
-3. Check that the server is deployed:
+$ java -jar target/spring-boot-sample-rs-scan-app.jar
 
+---- With Docker ----
+
+Install Docker, create the demo image:
+--
+$ mvn dockerfile:build
+--
+
+Optional step, push the image. 
+Create a DockerHub id, for example, make this id set to your current ${username}
+--
+$ docker login
+$ mvn dockerfile:push
+--
+
+Run the container:
+--
+docker run -p 8080:8080 --network="host" -t ${username}/apachecxf:spring-boot-sample-rs-scan-app

+
+= Testing the server =
+
+---- From the browser ----
+ 
 http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser
 
 will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
@@ -32,9 +52,12 @@ http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser
 
 will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!"
 
+
+---- From the command line ----
+
 Check client/README on how to run a command line client.
 
-4. Swagger JSON and UI
+= Swagger JSON and UI =
 
 http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON
 description of services.
@@ -51,7 +74,7 @@ or access it from the CXF Services page:
 (Note - CXF Services page is available by default at the path ending with "/services" - but
in this demo
 it has been configured to listen at "/info")
 
-5. System metrics and health checks
+= System metrics and health checks =
 
 http://localhost:8080/system/metrics 
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
index c0f0626..ded81a2 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
@@ -7,7 +7,7 @@
         <version>3.1.13-SNAPSHOT</version>
         <relativePath>../../..</relativePath>
     </parent>
-    <artifactId>spring-boot-sample-rs-cxf-scan-app</artifactId>
+    <artifactId>spring-boot-sample-rs-scan-app</artifactId>
     <name>Spring Boot CXF REST Scan Application</name>
     <description>Spring Boot CXF REST Scan Application</description>
     <dependencyManagement>
@@ -49,7 +49,7 @@
             <artifactId>spring-cloud-starter-eureka</artifactId>
             <version>${spring.cloud.eureka.version}</version>
         </dependency>
-        <!-- Actuator Endpoints -->
+        <!-- Actuator  Endpoints -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-actuator</artifactId>
@@ -64,6 +64,44 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot.version}</version>
+                <configuration>
+                    <mainClass>sample.rs.service.SampleRestApplication</mainClass>
+                </configuration>
+                <executions>
+                   <execution>
+                      <goals>
+                          <goal>repackage</goal>
+                       </goals>
+                   </execution>
+                </executions>
+            </plugin>
+            <plugin>
+              <groupId>com.spotify</groupId>
+              <artifactId>dockerfile-maven-plugin</artifactId>
+              <version>1.3.4</version>
+              <executions>
+               <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                  <goal>push</goal>
+                </goals>
+               </execution>
+              </executions>
+              <configuration>
+                <repository>${user.name}/apachecxf</repository>
+                <tag>${project.artifactId}</tag>
+              </configuration>
+            </plugin>
+        </plugins>
+    </build>
     <profiles>
         <profile>
             <id>server</id>
@@ -71,13 +109,14 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <build>
+                <finalName>${project.artifactId}</finalName> 
                 <defaultGoal>spring-boot:run</defaultGoal>
                 <plugins>
-                    <plugin>
-                        <groupId>org.springframework.boot</groupId>
-                        <artifactId>spring-boot-maven-plugin</artifactId>
-                        <version>${spring.boot.version}</version>
-                    </plugin>
+                   <plugin>
+                     <groupId>org.springframework.boot</groupId>
+                     <artifactId>spring-boot-maven-plugin</artifactId>
+                     <version>${spring.boot.version}</version>
+                   </plugin>
                 </plugins>
             </build>
         </profile>

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml
index ee5a4fb..04fa15b 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml
@@ -14,7 +14,7 @@ eureka:
   client:
     registerWithEureka: true
     serviceUrl:
-      defaultZone: http://127.0.0.1:8761/eureka/
+      defaultZone: ${EUREKA_SERVER_URI:http://${EUREKA_SERVER_USER:}:${EUREKA_SERVER_PASS:}@127.0.0.1:8761}/eureka/
   instance:
     statusPageUrlPath: /services/helloservice/info
     healthCheckUrlPath: /system/health

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/client/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/client/pom.xml
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/client/pom.xml
index 7655699..ccc3780 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/client/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/client/pom.xml
@@ -7,7 +7,7 @@
         <version>3.1.13-SNAPSHOT</version>
         <relativePath>../../..</relativePath>
     </parent>
-    <artifactId>spring-boot-sample-rs-cxf-scan-client</artifactId>
+    <artifactId>spring-boot-sample-rs-scan-client</artifactId>
     <name>Spring Boot CXF REST Scan Application Client</name>
     <description>Spring Boot CXF REST Scan Application Client</description>
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/Dockerfile
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/Dockerfile
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/Dockerfile
new file mode 100644
index 0000000..03b3ee3
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/Dockerfile
@@ -0,0 +1,6 @@
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+ADD target/spring-boot-sample-rs-scan-eureka.jar spring-boot-sample-rs-scan-eureka.jar
+EXPOSE 8761
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /spring-boot-sample-rs-scan-eureka.jar"
]

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/README
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/README
index 7da21aa..1f6c62d 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/README
@@ -3,11 +3,38 @@
 This sample project shows how to start Eureka Registry.  
 
 
-Run the registry application:
- 
-----
+= Starting the registry =
+
+The sample uses Maven. It can be built and run from the command line using Maven, Java or
Docker:
+
+---- With Maven ----
+
 $ mvn spring-boot:run
-----
+
+---- With Java ----
+
+$ java -jar target/spring-boot-sample-rs-scan-eureka.jar
+
+---- With Docker ----
+
+Install Docker, create the demo image:
+--
+$ mvn dockerfile:build
+--
+
+Optional step, push the image. 
+Create a DockerHub id, for example, make this id set to your current ${username}
+--
+$ docker login
+$ mvn dockerfile:push
+--
+
+Run the container:
+--
+docker run -p 8080:8080 -t ${username}/apachecxf:spring-boot-sample-rs-scan-eureka
+--
+
+= Testing the registry =
 
 Check the registry is live with typing "http://localhost:8761/eureka/apps" in a browser.
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/9eb57287/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml
index 85b451d..5bd3db1 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml
@@ -7,7 +7,7 @@
         <version>3.1.13-SNAPSHOT</version>
         <relativePath>../../..</relativePath>
     </parent>
-    <artifactId>eureka-registry-for-cxf</artifactId>
+    <artifactId>spring-boot-sample-rs-scan-eureka</artifactId>
     <name>Eureka Registry for CXF SpringBoot demos</name>
     <description>Eureka Registry for CXF SpringBoot demos</description>
     <properties>
@@ -39,11 +39,37 @@
 
 
     <build>
+        <finalName>${project.artifactId}</finalName>
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <version>${spring.boot.version}</version>
+                <executions>
+                   <execution>
+                      <goals>
+                          <goal>repackage</goal>
+                       </goals>
+                   </execution>
+                </executions>
+            </plugin>
+            <plugin>
+              <groupId>com.spotify</groupId>
+              <artifactId>dockerfile-maven-plugin</artifactId>
+              <version>1.3.4</version>
+              <executions>
+               <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                  <goal>push</goal>
+                </goals>
+               </execution>
+              </executions>
+              <configuration>
+                <repository>${user.name}/apachecxf</repository>
+                <tag>${project.artifactId}</tag>
+              </configuration>
             </plugin>
         </plugins>
     </build>


Mime
View raw message