Explorar el Código

Merged in FD3-664 (pull request #35)

FD3-664

Approved-by: Guillermo Espinoza <guillermo@interlink.com.ar>
Gabriel Gosparo hace 6 años
padre
commit
92e5fab816
Se han modificado 1 ficheros con 39 adiciones y 2 borrados
  1. 39 2
      tools/src/Release.php

+ 39 - 2
tools/src/Release.php

@@ -187,6 +187,15 @@ class Release extends Command
                 'OAUTH' => false,
                 'MODULE_INSTALL' => true
             ),
+            "api" => array(
+                'HOST_ENV' => true,
+                "VAR_ENV" => array(
+                    'VIRTUAL_HOST' => '',
+                    'HTTPS_METHOD' => 'nohttps',
+                ),
+                'OAUTH' => false,
+                'MODULE_INSTALL' => true
+            ),
             "pma" => array(
                 'HOST_ENV' => true,
                 "VAR_ENV" => array(
@@ -636,6 +645,32 @@ class Release extends Command
 
         $this->writeVariablesEnviroment($module . "." . $host_env_file, $module);
     }
+    
+    function addApi(FileFormat2 $composer, $config = array())
+    {
+        $module = "api";
+        $version = "latest";
+        $registry = "";
+        $host_env_file = "";
+        extract($config);
+
+        $composer
+            ->addService($module)
+            ->image($registry . "fd3/$module:" . $version)
+            ->restart($this->_docker_restart_default)
+            ->build("./extra/" . $module)
+            ->addLinks('nginx:base.fd3.flowdat.com')
+            ->addLinks('nginx:cablemodem.fd3.flowdat.com')
+            ->addLinks('nginx:ftth.fd3.flowdat.com')
+            ->addLinks('nginx:radius.fd3.flowdat.com')
+            ->addEnv_file("running.env")
+            ->addEnv_file($host_env_file)
+            ->addEnv_file($module . "." . $host_env_file)
+            ->addVolumes("./extra/$module/", "/opt/$module");
+        $this->addBuild($module, $composer);
+
+        $this->writeVariablesEnviroment($module . "." . $host_env_file, $module);
+    }
 
     function addNginx(FileFormat2 $composer, $config = array())
     {
@@ -660,6 +695,7 @@ class Release extends Command
             ->addVolumes("./cablemodem/", "/opt/cablemodem")
             ->addVolumes("./dhcp/", "/opt/dhcp")
             ->addVolumes("./grafana/", "/opt/grafana")
+            ->addVolumes('./extra/api/', '/opt/api')
             ->addVolumes("/var/run/docker.sock", "/tmp/docker.sock:ro")
             ->addVolumes("pma_volumen", "/opt/pma")
             ->addVolumes("./extra/nginx/certs", "/etc/nginx/certs:ro")
@@ -1079,10 +1115,10 @@ class Release extends Command
             ->image($registry . "fd3/swagger-ui:" . $version)
             ->build("./extra/swagger/")
             ->restart($this->_docker_restart_default)
-            ->addEnviroment("SWAGGER_JSON", "/foo/ftth.json")
+            ->addEnviroment("SWAGGER_JSON", "/opt/api/api.v1.json")
             ->addEnv_file("running.env")
             ->addEnv_file("host.env")
-            ->addPorts(8085, 8080);
+            ->addPorts(8090, 8080);
     }
 
 
@@ -1140,6 +1176,7 @@ class Release extends Command
 
         // Swagger
         $this->addSwagger($composer, $base_vars);
+        $this->addApi($composer, $base_vars);
 
         $this->_dObj->file("docker-compose.yml")->content($composer->render());