Переглянути джерело

Se paso la configuracion de los modulos a cada uno de los servicios

gabriel 6 роки тому
батько
коміт
0237641e09
38 змінених файлів з 703 додано та 304 видалено
  1. 10 9
      tools/installModules.sh
  2. 0 292
      tools/src/Modules/ModulesAll.php
  3. 35 2
      tools/src/Release.php
  4. 15 0
      tools/src/Services/Amqp.php
  5. 17 0
      tools/src/Services/Api.php
  6. 18 0
      tools/src/Services/Base.php
  7. 14 0
      tools/src/Services/Base_log_worker.php
  8. 18 0
      tools/src/Services/Cablemodem.php
  9. 14 0
      tools/src/Services/Cablemodem_command_worker.php
  10. 14 0
      tools/src/Services/Cablemodem_tasklogger_worker.php
  11. 18 0
      tools/src/Services/Dhcp.php
  12. 14 0
      tools/src/Services/Dhcp_tasklogger_worker.php
  13. 14 0
      tools/src/Services/Freeradius.php
  14. 18 0
      tools/src/Services/Ftth.php
  15. 14 0
      tools/src/Services/Ftth_command_worker.php
  16. 14 0
      tools/src/Services/Ftth_tasklogger_worker.php
  17. 14 0
      tools/src/Services/Genieacs_cwmp.php
  18. 14 0
      tools/src/Services/Genieacs_fs.php
  19. 14 0
      tools/src/Services/Genieacs_gui.php
  20. 14 0
      tools/src/Services/Genieacs_nbi.php
  21. 17 0
      tools/src/Services/Geoserver.php
  22. 145 1
      tools/src/Services/InitialService.php
  23. 14 0
      tools/src/Services/Jsendpoint.php
  24. 14 0
      tools/src/Services/Jsonep_mongo.php
  25. 14 0
      tools/src/Services/Jsonep_mysql.php
  26. 14 0
      tools/src/Services/Kea.php
  27. 14 0
      tools/src/Services/Mongodb.php
  28. 14 0
      tools/src/Services/Mysql.php
  29. 14 0
      tools/src/Services/Nginx.php
  30. 18 0
      tools/src/Services/Pma.php
  31. 17 0
      tools/src/Services/Radius.php
  32. 14 0
      tools/src/Services/Redis.php
  33. 18 0
      tools/src/Services/Stats.php
  34. 14 0
      tools/src/Services/Stats_command_worker.php
  35. 14 0
      tools/src/Services/Statsd.php
  36. 14 0
      tools/src/Services/Supervisord.php
  37. 17 0
      tools/src/Services/Swagger.php
  38. 14 0
      tools/src/Services/Tftp.php

+ 10 - 9
tools/installModules.sh

@@ -106,7 +106,7 @@ then
     fi
     ###################################################################
     DIRINSTALL=$DIRINSTALLDEFAULT
-    echo "Ingrese el directorio de instalacion: (default: $DIRINSTALLDEFAULT)"
+    echo "Ingrese el directorio absoluto de instalacion: (default: $DIRINSTALLDEFAULT)"
     read DIRINSTALL
     if [ "$DIRINSTALL" = "" ];
     then
@@ -121,21 +121,22 @@ then
     ###################################################################
     echo "Ingresando al directorio $DIRINSTALL"
     cd $DIRINSTALL
+    DIRTOOLS=$DIRINSTALL/tools
     ###################################################################
-    GIT=$GITDEFUALT
+    BRANCH=""
     echo "Ingrese la rama a instalar. (default: master)"
-    read GIT
+    read BRANCH
     eval `ssh-agent`
     ssh-add - <<< "$bitbucketid_rsa"
-    if [ "$GIT" = "" ];
+    if [ "$BRANCH" = "" ];
     then
         eval $COMMANDGITDEFAULT
     else
-        eval <<< "git clone -b $GIT $GITDEFUALT"
+        eval <<< "git clone -b $BRANCH $GITDEFUALT"
     fi
     ###################################################################
-    echo "Ingresando al directorio $DIRINSTALL/tools"
-    cd tools
+    echo "Ingresando al directorio $DIRTOOLS"
+    cd $DIRTOOLS
     ###################################################################
     echo "Construimos el dind?(Y/n)"
     VALUEYESNO=1
@@ -143,7 +144,7 @@ then
     if [ "$VALUEYESNO" = "1" ];
     then
         echo "Contruyendo el dind"
-        docker build --build-arg DIR_INSTALL=$(pwd) -t dind .
+        docker build --build-arg DIR_INSTALL=$DIRTOOLS -t dind .
     else
         echo "NO SE CONSTRUYE EL DIND"
     fi
@@ -154,7 +155,7 @@ then
     if [ "$VALUEYESNO" = "1" ];
     then
         echo "Instalando paquetes adicionales en dind"
-        docker run -it -v $(pwd):$(pwd) -v /var/run/docker.sock:/tmp/docker.sock dind composer install
+        docker run -it -v $DIRTOOLS:$DIRTOOLS -v /var/run/docker.sock:/tmp/docker.sock dind composer install
     else
         echo "NO SE INSTALAN LOS PAQUETES ADICIONALES"
     fi

+ 0 - 292
tools/src/Modules/ModulesAll.php

@@ -1,292 +0,0 @@
-<?php
-
-namespace FD3\Modules;
-
-class ModulesAll
-{
-    static public $_modules_all = array(
-        "base" => array(
-            "HELP" => "Modulo obligatorio",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-                'AMQP_KEY' => 'base'
-            ),
-            'OAUTH' => false,
-            'REQUIRED' => true,
-            "DEPENDS" => array(),
-        ),
-        "amqp" => array(
-            "HELP" => "Modulo obligatorio",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => true,
-            "DEPENDS" => array(),
-        ),
-        "ftth" => array(
-            "HELP" => "Modulo de ftth",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-                'AMQP_KEY' => 'ftth'
-            ),
-            'OAUTH' => true,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "radius" => array(
-            "HELP" => "Modulo radius",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-            ),
-            'OAUTH' => true,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth"),
-        ),
-        "stats" => array(
-            "HELP" => "Modulo de estadisticas",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-                'AMQP_KEY' => 'stats'
-            ),
-            'OAUTH' => true,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "cablemodem" => array(
-            "HELP" => "Modulo de cablemodem",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-                'AMQP_KEY' => 'cablemodem'
-            ),
-            'OAUTH' => true,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "dhcp" => array(
-            "HELP" => "Modulo de dhcp",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-                'AMQP_KEY' => 'cablemodem'
-            ),
-            'OAUTH' => true,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "api" => array(
-            "HELP" => "API/WebService para interactuar con otros billing",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-            ),
-            'OAUTH' => false,
-            "REQUIRED" => true,
-            "DEPENDS" => array("base"),
-        ),
-        "pma" => array(
-            "HELP" => "Modulo de phpmyadmin",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                "PMA_HOST" => "mysql",
-                "PMA_PORT" => "3306",
-                "PMA_ABSOLUTE_URI" => ""
-            ),
-            'OAUTH' => false,
-            "REQUIRED" => true,
-            "DEPENDS" => array("base"),
-        ),
-        "swagger" => array(
-            "HELP" => "Modulo para probar y ver las definiciones del API/WebService",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                "SWAGGER_JSON" => "/opt/swagger/api.v1.json",
-                "PORT" => "80"
-            ),
-            'OAUTH' => false,
-            "REQUIRED" => true,
-            "DEPENDS" => array("base"),
-        ),
-        "kea" => array(
-            "HELP" => "Modulo de kea (dhcp)",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "geoserver" => array(
-            "HELP" => "",
-            'HOST_ENV' => true,
-            "VAR_ENV" => array(
-                'VIRTUAL_HOST' => '',
-                'HTTPS_METHOD' => 'nohttps',
-            ),
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array(),
-        ),
-        "statsd" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("stats")
-        ),
-        "freeradius" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "genieacs-cwmp" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "genieacs-fs" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "genieacs-gui" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "genieacs-nbi" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "tftp" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("cablemodem")
-        ),
-        "jsendpoint" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("stats")
-        ),
-        "jsonep_mongo" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("stats")
-        ),
-        "jsonep_mysql" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "REQUIRED" => false,
-            "DEPENDS" => array("stats")
-        ),
-        "mongodb" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "DEPENDS" => array("base"),
-            'REQUIRED' => true
-        ),
-        "redis" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            "DEPENDS" => array("base"),
-            'REQUIRED' => true
-        ),
-        "mysql" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => true,
-            "DEPENDS" => array("base")
-        ),
-        "nginx" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => true,
-            "DEPENDS" => array("base")
-        ),
-        "supervisord" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => true,
-            "DEPENDS" => array("base")
-        ),
-        "base_log_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("base")
-        ),
-        "ftth_tasklogger_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "cablemodem_tasklogger_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("cablemodem")
-        ),
-        "dhcp_tasklogger_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("dhcp")
-        ),
-        "ftth_command_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("ftth")
-        ),
-        "stats_command_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("stats")
-        ),
-        "cablemodem_command_worker" => array(
-            "HELP" => "",
-            'HOST_ENV' => false,
-            'OAUTH' => false,
-            'REQUIRED' => false,
-            "DEPENDS" => array("cablemodem")
-        ));
-}

+ 35 - 2
tools/src/Release.php

@@ -4,7 +4,6 @@ namespace FD3;
 
 use Docker\Composer\FileFormat2;
 use Docker\Composer\ServiceNotFoundException;
-use FD3\Modules\ModulesAll;
 use FD3\Services\Base;
 use FD3\Services\Cablemodem;
 use FD3\Services\Dhcp;
@@ -142,10 +141,44 @@ class Release extends Command
             ]];
         $this->_modules = array();
         $this->_ansible_vars = array();
-        $this->_modules_all = ModulesAll::$_modules_all;
+        $this->_modules_all = $this->getModules();
         $this->_add_nginx_links = false;
     }
 
+    private function getModules()
+    {
+        $dir = __DIR__ . "/Services/";
+        $files = scandir($dir);
+        $modulesRead = [];
+        $resp = [];
+        foreach ($files as $file) {
+            if (is_file($dir . $file) && $file != "InitialService.php") {
+                $class = "FD3\\Services\\" . explode(".", $file)[0];
+                $object = new $class();
+                array_push($modulesRead, $object);
+            }
+        }
+        // obtengo los modulos requeridos por obligacion
+        foreach ($modulesRead as $key => $mod) {
+            if ($mod->isRequired()) {
+                $resp[$mod->getModuleName()] = $mod->getConfig();
+                unset($modulesRead[$key]);
+            }
+        }
+        // obtengo los modulos sin dependencias
+        foreach ($modulesRead as $key => $mod) {
+            if (count($mod->getDepends()) == 0) {
+                $resp[$mod->getModuleName()] = $mod->getConfig();
+                unset($modulesRead[$key]);
+            }
+        }
+        // obtengo el resto de los modulos
+        foreach ($modulesRead as $mod) {
+            $resp[$mod->getModuleName()] = $mod->getConfig();
+        }
+        return $resp;
+    }
+
     protected function configure()
     {
         $this

+ 15 - 0
tools/src/Services/Amqp.php

@@ -7,6 +7,21 @@ use FD3\Release;
 
 class Amqp extends InitialService
 {
+    /**
+     * Amqp constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo AMQP obligatorio")
+            ->setHostEnv(false)
+            ->setVarEnv([
+            ])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 17 - 0
tools/src/Services/Api.php

@@ -7,6 +7,23 @@ use FD3\Release;
 
 class Api extends InitialService
 {
+    /**
+     * Api constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("API/WebService para interactuar con otros billing")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps'
+            ])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 18 - 0
tools/src/Services/Base.php

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Base extends InitialService
 {
+    /**
+     * Base constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo base obligatorio")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps',
+                'AMQP_KEY' => 'base'
+            ])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Base_log_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Base_log_worker extends InitialService
 {
+    /**
+     * Base_log_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de log del base")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 18 - 0
tools/src/Services/Cablemodem.php

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Cablemodem extends InitialService
 {
+    /**
+     * Cablemodem constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de cablemodem")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps',
+                'AMQP_KEY' => 'cablemodem'
+            ])
+            ->setOauth(true)
+            ->setRequired(false)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Cablemodem_command_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Cablemodem_command_worker extends InitialService
 {
+    /**
+     * Cablemodem_command_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de comandos del cablemodem")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['cablemodem']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Cablemodem_tasklogger_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Cablemodem_tasklogger_worker extends InitialService
 {
+    /**
+     * Cablemodem_tasklogger_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de logs de tareas del cablemodem")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['cablemodem']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 18 - 0
tools/src/Services/Dhcp.php

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Dhcp extends InitialService
 {
+    /**
+     * Dhcp constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de DHCP")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps',
+                'AMQP_KEY' => 'cablemodem'
+            ])
+            ->setOauth(true)
+            ->setRequired(false)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Dhcp_tasklogger_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Dhcp_tasklogger_worker extends InitialService
 {
+    /**
+     * Dhcp_tasklogger_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de logs de tareas del dhcp")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['dhcp']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Freeradius.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Freeradius extends InitialService
 {
+    /**
+     * Freeradius constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de freeradius")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 18 - 0
tools/src/Services/Ftth.php

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Ftth extends InitialService
 {
+    /**
+     * Ftth constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de ftth")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps',
+                'AMQP_KEY' => 'ftth'
+            ])
+            ->setOauth(true)
+            ->setRequired(false)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Ftth_command_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Ftth_command_worker extends InitialService
 {
+    /**
+     * Ftth_command_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de comandos del ftth")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Ftth_tasklogger_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Ftth_tasklogger_worker extends InitialService
 {
+    /**
+     * Ftth_tasklogger_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de logs de tareas del ftth")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Genieacs_cwmp.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Genieacs_cwmp extends InitialService
 {
+    /**
+     * Genieacs_cwmp constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de genieacs cwmp")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Genieacs_fs.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Genieacs_fs extends InitialService
 {
+    /**
+     * Genieacs_fs constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de genieacs fs")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Genieacs_gui.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Genieacs_gui extends InitialService
 {
+    /**
+     * Genieacs_gui constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de genieacs gui")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Genieacs_nbi.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Genieacs_nbi extends InitialService
 {
+    /**
+     * Genieacs_nbi constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de genieacs nbi")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 17 - 0
tools/src/Services/Geoserver.php

@@ -7,6 +7,23 @@ use FD3\Release;
 
 class Geoserver extends InitialService
 {
+    /**
+     * Geoserver constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de geoserver")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps'
+            ])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 145 - 1
tools/src/Services/InitialService.php

@@ -3,8 +3,32 @@
 namespace FD3\Services;
 
 
-class InitialService
+abstract class InitialService
 {
+    /**
+     * @var string Contiene una ayuda
+     */
+    private $help;
+    /**
+     * @var boolean Me dice si tengo que crear el  archivo de host.env
+     */
+    private $hostEnv;
+    /**
+     * @var array Contiene las variables de entorno a cargar.
+     */
+    private $varEnv;
+    /**
+     * @var boolean Me dice si tengo que crear el archivo de oauth.
+     */
+    private $oauth;
+    /**
+     * @var boolean Me dice si es un modulo requerido en la instalacion.
+     */
+    private $required;
+    /**
+     * @var array Contiene la dependencias.
+     */
+    private $depends;
 
     public function getModuleName()
     {
@@ -15,4 +39,124 @@ class InitialService
     {
         return explode("_", $this->getModuleName())[0];
     }
+
+    /**
+     * @return string
+     */
+    public function getHelp()
+    {
+        return $this->help;
+    }
+
+    /**
+     * @param string $help
+     * @return $this
+     */
+    public function setHelp($help)
+    {
+        $this->help = $help;
+        return $this;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isHostEnv()
+    {
+        return $this->hostEnv;
+    }
+
+    /**
+     * @param bool $hostEnv
+     * @return $this
+     */
+    public function setHostEnv($hostEnv)
+    {
+        $this->hostEnv = $hostEnv;
+        return $this;
+    }
+
+    /**
+     * @return array
+     */
+    public function getVarEnv()
+    {
+        return $this->varEnv;
+    }
+
+    /**
+     * @param array $varEnv
+     * @return $this
+     */
+    public function setVarEnv($varEnv)
+    {
+        $this->varEnv = $varEnv;
+        return $this;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isOauth()
+    {
+        return $this->oauth;
+    }
+
+    /**
+     * @param bool $oauth
+     * @return $this
+     */
+    public function setOauth($oauth)
+    {
+        $this->oauth = $oauth;
+        return $this;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isRequired()
+    {
+        return $this->required;
+    }
+
+    /**
+     * @param bool $required
+     * @return $this
+     */
+    public function setRequired($required)
+    {
+        $this->required = $required;
+        return $this;
+    }
+
+    /**
+     * @return array
+     */
+    public function getDepends()
+    {
+        return $this->depends;
+    }
+
+    /**
+     * @param array $depends
+     * @return $this
+     */
+    public function setDepends($depends)
+    {
+        $this->depends = $depends;
+        return $this;
+    }
+
+    public function getConfig()
+    {
+        return [
+            "HELP" => $this->getHelp(),
+            'HOST_ENV' => $this->isHostEnv(),
+            "VAR_ENV" => $this->getVarEnv(),
+            'OAUTH' => $this->isOauth(),
+            'REQUIRED' => $this->isRequired(),
+            "DEPENDS" => $this->getDepends(),
+        ];
+    }
 }

+ 14 - 0
tools/src/Services/Jsendpoint.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Jsendpoint extends InitialService
 {
+    /**
+     * Jsendpoint constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de json end point")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['stats']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Jsonep_mongo.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Jsonep_mongo extends InitialService
 {
+    /**
+     * Jsonep_mongo constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de json end point para mongodb")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['stats']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Jsonep_mysql.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Jsonep_mysql extends InitialService
 {
+    /**
+     * Jsonep_mysql constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de json end point para mysql")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['stats']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Kea.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Kea extends InitialService
 {
+    /**
+     * Kea constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de kea (dhcp)")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends([]);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Mongodb.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Mongodb extends InitialService
 {
+    /**
+     * Mongodb constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de mongodb")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Mysql.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Mysql extends InitialService
 {
+    /**
+     * Mysql constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de mysql")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Nginx.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Nginx extends InitialService
 {
+    /**
+     * Nginx constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de nginx")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 18 - 0
tools/src/Services/Pma.php

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Pma extends InitialService
 {
+    /**
+     * Pma constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de phpmyadmin")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                "PMA_HOST" => "mysql",
+                "PMA_PORT" => "3306",
+                "PMA_ABSOLUTE_URI" => ""
+            ])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 17 - 0
tools/src/Services/Radius.php

@@ -7,6 +7,23 @@ use FD3\Release;
 
 class Radius extends InitialService
 {
+    /**
+     * Radius constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de radius")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps'
+            ])
+            ->setOauth(true)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Redis.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Redis extends InitialService
 {
+    /**
+     * Redis constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de redis")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

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

@@ -7,6 +7,24 @@ use FD3\Release;
 
 class Stats extends InitialService
 {
+    /**
+     * Stats constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de estadisticas")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                'VIRTUAL_HOST' => '',
+                'HTTPS_METHOD' => 'nohttps',
+                'AMQP_KEY' => 'stats'
+            ])
+            ->setOauth(true)
+            ->setRequired(false)
+            ->setDepends(['ftth']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Stats_command_worker.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Stats_command_worker extends InitialService
 {
+    /**
+     * Stats_command_worker constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de comandos del stats")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['stats']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Statsd.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Statsd extends InitialService
 {
+    /**
+     * Statsd constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de recoleccion de datos")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['stats']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Supervisord.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Supervisord extends InitialService
 {
+    /**
+     * Supervisord constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de supervisord")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 17 - 0
tools/src/Services/Swagger.php

@@ -7,6 +7,23 @@ use FD3\Release;
 
 class Swagger extends InitialService
 {
+    /**
+     * Swagger constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo para probar y ver las definiciones del API/WebService")
+            ->setHostEnv(true)
+            ->setVarEnv([
+                "SWAGGER_JSON" => "/opt/swagger/api.v1.json",
+                "PORT" => "80"
+            ])
+            ->setOauth(false)
+            ->setRequired(true)
+            ->setDepends(['base']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer

+ 14 - 0
tools/src/Services/Tftp.php

@@ -7,6 +7,20 @@ use FD3\Release;
 
 class Tftp extends InitialService
 {
+    /**
+     * Tftp constructor.
+     */
+    public function __construct()
+    {
+        $this
+            ->setHelp("Modulo de tftp")
+            ->setHostEnv(false)
+            ->setVarEnv([])
+            ->setOauth(false)
+            ->setRequired(false)
+            ->setDepends(['cablemodem']);
+    }
+
     /**
      * @param Release $release
      * @param FileFormat2 $composer