Pārlūkot izejas kodu

Merge branch '2-close-connection-ws' into 'master'

Resolve "Close Connection (WS)"

Closes #2

See merge request interlink-sa/flowdat3/modules/installer!47
Gabriel Gosparo 6 gadi atpakaļ
vecāks
revīzija
0638df18b2

+ 3 - 0
modules.ini

@@ -10,6 +10,9 @@ repo = "ssh://git@gitlab.com/interlink-sa/flowdat3/modules/dhcp.git"
 [ftth]
 repo = "ssh://git@gitlab.com/interlink-sa/flowdat3/modules/ftth.git"
 
+[mapas]
+repo = "ssh://git@gitlab.com:interlink-sa/flowdat3/modules/mapas.git"
+
 [radius]
 repo = "ssh://git@gitlab.com/interlink-sa/flowdat3/modules/radius.git"
 

+ 24 - 13
tools/src/Release.php

@@ -4,13 +4,17 @@ namespace FD3;
 
 use Docker\Composer\FileFormat2;
 use Docker\Composer\ServiceNotFoundException;
+use FD3\Services\Api;
 use FD3\Services\Base;
 use FD3\Services\Cablemodem;
 use FD3\Services\Dhcp;
 use FD3\Services\Ftth;
+use FD3\Services\Ftth_tasklogger_worker;
 use FD3\Services\Nginx;
+use FD3\Services\Pma;
 use FD3\Services\Radius;
 use FD3\Services\Stats;
+use FD3\Services\Swagger;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Exception\LogicException;
 use Symfony\Component\Console\Input\InputArgument;
@@ -272,7 +276,8 @@ class Release extends Command
             $this->_ansible_vars["CMD_USERNAME"] = $this->_user_system['users'][$internal_user_id]['user'];
             $this->_ansible_vars["CMD_PASSWORD"] = $this->_user_system['users'][$internal_user_id]['password'];
             $this->_ansible_vars["ENV_LIST"] = "prod,dev,test";
-	        $this->_ansible_vars["API_CIDR"] = "172.20.0.0/24";
+            $this->_ansible_vars["API_CIDR"] = "172.20.0.0/24";
+            $this->_ansible_vars["IK_SUBRED"] = "200.50.160.0/21";
             $this->_ansible_vars["MYSQL_ROOT_PASSWORD"] = $this->_mysql_root_pass;
 
             $this->_add_nginx_links = (boolean)$input->getOption('add-nginx-links');
@@ -355,11 +360,9 @@ class Release extends Command
             foreach ($depends as $depend) {
                 if (in_array($depend, $modules)) {
                     return true;
+                }
             }
         }
-        return $resp;
-    }
-
         return false;
     }
 
@@ -389,13 +392,13 @@ class Release extends Command
                     if ($helper->ask($input, $output, $question)) {
                         $modules [] = $name;
                         $value['REQUIRED'] = true;
-    }
+                    }
 
-    }
+                }
 
-    }
+            }
 
-    }
+        }
 
         $modules = implode(",", $modules);
         return $modules;
@@ -410,9 +413,9 @@ class Release extends Command
         foreach ($this->_modules as $key => $values) {
             if ($values['HOST_ENV']) {
                 $resp ["HOST_" . strtoupper($key)] = $this->getDomain($key);
-    }
+            }
 
-    }
+        }
 
         return $resp;
     }
@@ -431,8 +434,16 @@ class Release extends Command
     function getDockerComposer($version = "latest", $host_env_file = "host.env", $registry = "docker.infra.flowdat.com/")
     {
         $composer = new FileFormat2("../");
-        $composer->getVolumes()->addVolumen('pma_volumen', 'local');
-        $composer->getVolumes()->addVolumen('swagger_volumen', 'local');
+        $composer->getVolumes()->addVolumen(Pma::PMA_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Swagger::SWAGGER_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Base::BASE_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Cablemodem::CABLEMODEM_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Dhcp::DHCP_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Ftth::FTTH_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Radius::RADIUS_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Stats::STATS_SOCKET_VOLUMEN, 'local');
+        $composer->getVolumes()->addVolumen(Api::API_SOCKET_VOLUMEN, 'local');
+
         $base_vars = array(
             "version" => $version,
             "host_env_file" => $host_env_file,
@@ -529,7 +540,7 @@ class Release extends Command
                     foreach ($app['VAR_ENV'] as $key => $value) {
                         if ($key == 'VIRTUAL_HOST') {
                             $env .= "VIRTUAL_HOST=" . $this->getDomain($module) . "\n";
-                        } else if($key == 'PMA_ABSOLUTE_URI') {
+                        } else if ($key == 'PMA_ABSOLUTE_URI') {
                             $env .= "PMA_ABSOLUTE_URI=" . $this->getDomain("pma") . "\n";
                         } else {
                             $env .= $key . "=" . $value . "\n";

+ 4 - 1
tools/src/Services/Api.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Api extends InitialService
 {
+    const API_SOCKET_VOLUMEN = "api_socket_volumen";
+
     /**
      * Api constructor.
      */
@@ -45,7 +47,8 @@ class Api extends InitialService
                 ->addEnv_file($release->_running_env)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
-                ->addVolumes("./extra/$module/", "/opt/$module");
+                ->addVolumes("./extra/$module/", "/opt/$module")
+                ->addVolumes(self::API_SOCKET_VOLUMEN, "/run/php/");
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);
         }

+ 4 - 1
tools/src/Services/Base.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Base extends InitialService
 {
+    const BASE_SOCKET_VOLUMEN = "base_socket_volumen";
+
     /**
      * Base constructor.
      */
@@ -48,7 +50,8 @@ class Base extends InitialService
                 ->addEnv_file($release->_running_env)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
-                ->addVolumes("./$module/", "/opt/$module");
+                ->addVolumes("./$module/", "/opt/$module")
+                ->addVolumes(self::BASE_SOCKET_VOLUMEN, "/run/php/");
             $release->addNginxLinks($module, $composer);
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);

+ 4 - 1
tools/src/Services/Cablemodem.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Cablemodem extends InitialService
 {
+    const CABLEMODEM_SOCKET_VOLUMEN = "cablemodem_socket_volumen";
+
     /**
      * Cablemodem constructor.
      */
@@ -51,7 +53,8 @@ class Cablemodem extends InitialService
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addVolumes("./$module/", "/opt/$module")
-                ->addVolumes("./$module/web/uploads", "/opt/$module/web/uploads");
+                ->addVolumes("./$module/web/uploads", "/opt/$module/web/uploads")
+                ->addVolumes(self::CABLEMODEM_SOCKET_VOLUMEN, "/run/php/");
             $release->addNginxLinks($module, $composer);
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);

+ 4 - 1
tools/src/Services/Dhcp.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Dhcp extends InitialService
 {
+    const DHCP_SOCKET_VOLUMEN = "dhcp_socket_volumen";
+
     /**
      * Dhcp constructor.
      */
@@ -51,7 +53,8 @@ class Dhcp extends InitialService
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
                 ->addVolumes("./$module/", "/opt/$module")
-                ->addVolumes("./kea/conf", "/opt/dhcp/web/kea");
+                ->addVolumes("./kea/conf", "/opt/dhcp/web/kea")
+                ->addVolumes(self::DHCP_SOCKET_VOLUMEN, "/run/php/");;
             $release->addNginxLinks($module, $composer);
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);

+ 4 - 1
tools/src/Services/Ftth.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Ftth extends InitialService
 {
+    const FTTH_SOCKET_VOLUMEN = "ftth_socket_volumen";
+
     /**
      * Ftth constructor.
      */
@@ -52,7 +54,8 @@ class Ftth extends InitialService
                 ->addEnv_file($module . ".oauth.env")
                 ->addVolumes("./$module/", "/opt/" . $module)
                 ->addVolumes("./extra/netmiko", "/opt/netmiko")
-                ->addVolumes("./extra/backups-config", "/opt/ftth/web/backups-config");
+                ->addVolumes("./extra/backups-config", "/opt/ftth/web/backups-config")
+                ->addVolumes(self::FTTH_SOCKET_VOLUMEN, "/run/php/");
             $release->addNginxLinks($module, $composer);
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);

+ 12 - 4
tools/src/Services/Nginx.php

@@ -38,6 +38,7 @@ class Nginx extends InitialService
             ->build("extra/nginx/")
             ->image($registry . "fd3/$module:" . $version)
             ->addEnv_file($host_env_file)
+            ->addEnv_file("running.env")
             ->restart($release->_docker_restart_default)
             ->addPorts(80, 80)
             ->addPorts(443, 443)
@@ -49,10 +50,17 @@ class Nginx extends InitialService
             ->addVolumes("./dhcp/", "/opt/dhcp")
             ->addVolumes('./extra/api/', '/opt/api')
             ->addVolumes("/var/run/docker.sock", "/tmp/docker.sock:ro")
-            ->addVolumes("pma_volumen", "/opt/pma")
-            ->addVolumes("swagger_volumen", "/opt/swagger")
             ->addVolumes("./extra/nginx/certs", "/etc/nginx/certs:ro")
             ->addVolumes("./extra/nginx/conf.d", "/etc/nginx/conf.d")
-            ->addVolumes("./extra/nginx/share", "/usr/share/nginx/html");
+            ->addVolumes("./extra/nginx/share", "/usr/share/nginx/html")
+            ->addVolumes(Pma::PMA_VOLUMEN, "/opt/pma")
+            ->addVolumes(Swagger::SWAGGER_VOLUMEN, "/opt/swagger")
+            ->addVolumes(Base::BASE_SOCKET_VOLUMEN, "/tmp/base")
+            ->addVolumes(Cablemodem::CABLEMODEM_SOCKET_VOLUMEN, '/tmp/cablemodem')
+            ->addVolumes(Dhcp::DHCP_SOCKET_VOLUMEN, '/tmp/dhcp')
+            ->addVolumes(Ftth::FTTH_SOCKET_VOLUMEN, '/tmp/ftth')
+            ->addVolumes(Radius::RADIUS_SOCKET_VOLUMEN, '/tmp/radius')
+            ->addVolumes(Stats::STATS_SOCKET_VOLUMEN, '/tmp/stats')
+            ->addVolumes(Api::API_SOCKET_VOLUMEN, '/tmp/api');
     }
-}
+}

+ 3 - 1
tools/src/Services/Pma.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Pma extends InitialService
 {
+    const PMA_VOLUMEN = "pma_volumen";
+
     /**
      * Pma constructor.
      */
@@ -44,7 +46,7 @@ class Pma extends InitialService
                 ->addEnv_file($release->_host_env)
                 ->addEnv_file("mysql." . $host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
-                ->addVolumes("pma_volumen", "/www");
+                ->addVolumes(self::PMA_VOLUMEN, "/www");
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);
         }
     }

+ 4 - 1
tools/src/Services/Radius.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Radius extends InitialService
 {
+    const RADIUS_SOCKET_VOLUMEN = "radius_socket_volumen";
+
     /**
      * Radius constructor.
      */
@@ -49,7 +51,8 @@ class Radius extends InitialService
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file("$module.oauth.env")
-                ->addVolumes("./$module/", "/opt/$module");
+                ->addVolumes("./$module/", "/opt/$module")
+                ->addVolumes(self::RADIUS_SOCKET_VOLUMEN, "/run/php/");
             $release->addNginxLinks($module, $composer);
             $release->addBuild($module, $composer);
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);

+ 3 - 0
tools/src/Services/Stats.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Stats extends InitialService
 {
+    const STATS_SOCKET_VOLUMEN = "stats_socket_volumen";
+
     /**
      * Stats constructor.
      */
@@ -48,6 +50,7 @@ class Stats extends InitialService
                 ->addLinks((new Jsonep_mysql())->getModuleName().":".(new Jsonep_mysql())->getModuleName())
                 ->addLinks((new Base())->getModuleName())
                 ->addVolumes("./$module/", "/opt/$module")
+                ->addVolumes(self::STATS_SOCKET_VOLUMEN, "/run/php/")
                 ->addEnv_file($release->_running_env)
                 ->addEnv_file($host_env_file)
                 ->addEnv_file($module . "." . $host_env_file)

+ 3 - 1
tools/src/Services/Swagger.php

@@ -7,6 +7,8 @@ use FD3\Release;
 
 class Swagger extends InitialService
 {
+    const SWAGGER_VOLUMEN = "swagger_volumen";
+
     /**
      * Swagger constructor.
      */
@@ -45,7 +47,7 @@ class Swagger extends InitialService
                 ->addEnv_file($module . "." . $host_env_file)
                 ->addEnv_file($release->_running_env)
                 ->addEnv_file($release->_host_env)
-                ->addVolumes("swagger_volumen", "/usr/share/nginx/html");
+                ->addVolumes(self::SWAGGER_VOLUMEN, "/usr/share/nginx/html");
             $release->writeVariablesEnviroment($module . "." . $host_env_file, $module);
         }