12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace FD3\Services;
- use Docker\Composer\FileFormat;
- use FD3\Release;
- class Stats_cmd extends InitialService
- {
- /**
- * @var int ip server
- */
- protected $ip_server = 24;
- /**
- * Stats_command_worker constructor.
- */
- public function __construct()
- {
- $this
- ->setHelp("Modulo de comandos del stats")
- ->setHostEnv(false)
- ->setVarEnv([])
- ->setOauth(false)
- ->setRequired(true)
- ->setDepends(['stats']);
- }
- /**
- * Add config
- * @throws \Docker\Composer\ServiceNotFoundException
- */
- public function add()
- {
- $module = "stats_command";
- $version = "latest";
- $registry = "";
- $host_env_file = "";
- extract($this->getConfigVar());
- if ($this->getRelease()->needInstallModule($module)) {
- $this->getComposer()->addService($module)
- ->image($registry . "fd3/$module:" . $version);
- if ($this->getProduction() === false) {
- $this->getComposer()->service($module)
- ->build("./$module/")
- ->addVolumes("./$module/", "/opt/$module/");
- }
- $this->getComposer()->service($module)
- ->hostname($module)
- ->restart($this->getRelease()->_docker_restart_task)
- ->addEnv_file($this->getRelease()->_host_env)
- ->addEnviroment("DEV_MODE", $this->getProduction() === false ? 1 : 0)
- ->addEnv_file("mysql." . $host_env_file)
- ->addVolumes("/etc/localtime:/etc/localtime:ro")
- ->network($this->getRelease()->_network_name)->ipv4_address($this->generateIP());
- if ($this->getRelease()->isModuleAvailable(new Geoserver())) {
- $this->getComposer()->service($module)
- ->addVolumes("./geoserver/geoserver-shapes", "/var/www/shapes");
- }
- $this->addLink(new Mysql(), $module)
- ->addLink(new Redis(), $module)
- ->addLink(new Amqp(), $module);
- }
- }
- }
|