Fix docker image pull/save 58/2158/3
authorSerban Jora <sj2381@att.com>
Tue, 26 Jun 2018 23:29:57 +0000 (19:29 -0400)
committerSerban Jora <sj2381@att.com>
Wed, 27 Jun 2018 14:14:31 +0000 (10:14 -0400)
Change-Id: Ib808877df9c7129f729e72732d591f317c8b97d9
Signed-off-by: Serban Jora <sj2381@att.com>
Issue-ID: ACUMOS-1015
Signed-off-by: Serban Jora <sj2381@att.com>
gateway/pom.xml
gateway/src/main/java/org/acumos/federation/gateway/config/DockerConfiguration.java
gateway/src/main/java/org/acumos/federation/gateway/service/impl/ArtifactServiceImpl.java
gateway/src/test/resources/docker-compose.yml

index fce444f..cb150a0 100644 (file)
@@ -112,6 +112,11 @@ limitations under the License.
                        <!-- spring sets the <version>${spring.boot.configuration.processor.version}</version> -->
                        <optional>true</optional>
                </dependency>
+               <dependency>
+                       <groupId>com.google.guava</groupId>
+                       <artifactId>guava</artifactId>
+                       <version>19.0</version>
+               </dependency>
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
index 0ff5106..4bdee9b 100644 (file)
@@ -20,6 +20,8 @@
 
 package org.acumos.federation.gateway.config;
 
+import java.lang.invoke.MethodHandles;
+
 import org.springframework.stereotype.Component;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Configuration;
@@ -27,6 +29,8 @@ import org.springframework.context.annotation.Configuration;
 import com.github.dockerjava.core.DockerClientConfig; 
 import com.github.dockerjava.core.DefaultDockerClientConfig; 
 
+import org.acumos.federation.gateway.config.EELFLoggerDelegate;
+
 /**
  * 
  */
@@ -34,6 +38,7 @@ import com.github.dockerjava.core.DefaultDockerClientConfig;
 @ConfigurationProperties(prefix = "docker")
 public class DockerConfiguration {
 
+       private static final EELFLoggerDelegate log = EELFLoggerDelegate.getLogger(MethodHandles.lookup().lookupClass());
        private DefaultDockerClientConfig.Builder builder;
 
        public DockerConfiguration() {
index ec3043f..93d5318 100644 (file)
@@ -52,6 +52,7 @@ import org.acumos.nexus.client.data.UploadArtifactInfo;
 import com.github.dockerjava.api.DockerClient;
 import com.github.dockerjava.api.model.Identifier;
 import com.github.dockerjava.api.model.Repository;
+import com.github.dockerjava.api.model.PullResponseItem;
 import com.github.dockerjava.core.command.PullImageResultCallback;
 import com.github.dockerjava.core.command.PushImageResultCallback;
 
@@ -96,12 +97,12 @@ public class ArtifactServiceImpl extends AbstractServiceImpl
                                //pull followed by save
                                DockerClient docker = this.clients.getDockerClient();
 
-                               PullImageResultCallback pullResult = new PullImageResultCallback();
+                               PullImageResultCallback pullResult = new PullImageResultCallback(); 
                                docker.pullImageCmd(theArtifact.getUri())
                                                        .exec(pullResult);
                                pullResult.awaitCompletion();
 
-                               return new InputStreamResource(docker.saveImageCmd(theArtifact.getName()).exec());
+                               return new InputStreamResource(docker.saveImageCmd(theArtifact.getUri()).exec());
                        }
                        else {  
                                NexusArtifactClient artifactClient = this.clients.getNexusClient();
index faa8ce1..e840348 100644 (file)
@@ -2,45 +2,52 @@ version: '2.0'
 services:
   federation:
     container_name: federation-gateway
-    image: federation-gateway:1.1.0-SNAPSHOT
+    image: federation-gateway:1.1.4-SNAPSHOT
     environment:
       SPRING_APPLICATION_JSON: '{
         "federation" : {
           "instance" : "gateway",
           "instance.name" : "ATT",
-          "operator" : "d468656f-57d0-46e3-9f94-7ffa4f66dc03",
+          "operator" : "user_uuid",
           "address" : "0.0.0.0",
           "server" : {
-            "port" : 9002
+            "port" : 9084
           },
           "ssl" : {
-            "key-store" : "/app/acumosa.pkcs12",
-            "key-store-password" : "acumosa",
+            "key-store" : "/app/your_keystore.pkcs12",
+            "key-store-password" : "keystore_password",
             "key-store-type" : "PKCS12",
-               "key-password" : "acumosa",
-             "trust-store" : "/app/acumosTrustStore.jks",
-            "trust-store-password" : "acumos"
+               "key-password" : "key_password",
+             "trust-store" : "/app/your_truststore.jks",
+            "trust-store-password" : "changeit"
                }
         },
         "local" : {
           "address": "0.0.0.0",
           "server": {
-            "port" : 9022
+            "port" : 9884
           },
           "ssl" : {
-            "key-store" : "/app/acumosa.pkcs12",
-            "key-store-password" : "acumosa",
+            "key-store" : "/app/your_keystore.pkcs12",
+            "key-store-password" : "keystore_password",
             "key-store-type" : "PKCS12",
-            "key-password" : "acumosa",
-           "trust-store" : "/app/acumosTrustStore.jks",
-                 "trust-store-password" : "acumos"
+            "key-password" : "key_password",
+           "trust-store" : "/app/youro_truststore.jks",
+                 "trust-store-password" : "changeit"
           }
         },
+        "docker": {
+          "host": "tcp://your_host:port",
+          "registryUrl": "your_registry:port",
+          "registryUsername": "docker_username",
+          "registryPassword": "docker_password",
+          "registryEmail": ""
+        },
         "nexus": {
-          "url": "http://cognita-nexus01.eastus.cloudapp.azure.com:8081/repository/repo_cognita_model_maven/",
+          "url": "http://your_nexus:port/some_path/",
           "proxy": "",
-          "password": "not4you",
-          "username": "cognita_model_rw",
+          "username": "nexus_username",
+          "password": "nexus_password",
           "groupid": "com.artifact"
         },
         "peer": {
@@ -50,9 +57,9 @@ services:
         },
         "cdms" : {
           "client" : {
-            "url": "http://mlp-cmn-data-svc:8000/ccds",
-            "username": "ccds_client",
-            "password": "ccds_client"
+            "url": "cds_reference",
+            "username": "cds_username",
+            "password": "cds_password"
           }
         }
       }'
@@ -64,6 +71,7 @@ services:
       - "9022:9022"
     volumes:
       - ./:/app
+      - /var/run/docker.sock:/var/run/docker.sock
     logging:
       driver: json-file