1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace FD3\Services;
- use Docker\Composer\FileFormat;
- use FD3\Release;
- class Ftth_task extends InitialService
- {
- /**
- * @var int ip server
- */
- protected $ip_server = 20;
- /**
- * 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']);
- }
- /**
- * Add config
- * @throws \Docker\Composer\ServiceNotFoundException
- */
- public function add()
- {
- $module = $this->getModuleName();
- $initial = $this->getInitialName();
- $version = "latest";
- $registry = "";
- extract($this->getConfigVar());
- if ($this->getRelease()->needInstallModule($module)) {
- $this->getComposer()->addService($module)
- ->image($registry . "fd3/$initial:" . $version);
- if ($this->getProduction() === false) {
- $this->getComposer()->service($module)
- ->build("./$initial/")
- ->addVolumes("./$initial/", "/opt/$initial/")
- ->addVolumes("./netmiko/", "/opt/netmiko/")
- ->addVolumes("./connect/", "/usr/bin/connect/");
- }
- $this->getComposer()->service($module)
- ->hostname($module)
- ->command("bin/console rabbitmq:consumer flowdat_tasklogger")
- ->restart($this->getRelease()->_docker_restart_task)
- ->addEnv_file($this->getRelease()->_running_env)
- ->addEnv_file($this->getRelease()->_host_env)
- ->addEnv_file("$initial." . $this->getRelease()->_host_env)
- ->addEnviroment("AMQP_KEY", "$initial")
- ->addVolumes("./backups-config", "/opt/ftth/web/backups-config")
- ->addVolumes("/etc/localtime:/etc/localtime:ro")
- ->addVolumes("./hosts:/etc/hosts")
- ->network($this->getRelease()->_network_name)->ipv4_address($this->generateIP());
- $this->addLink(new Mysql(), $module)
- ->addLink(new Base(), $module)
- ->addLinkNginx(new Base(), $module);
- }
- }
- }
|