|
@@ -0,0 +1,66 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+namespace FD3\Services;
|
|
|
+
|
|
|
+use Docker\Composer\FileFormat;
|
|
|
+use FD3\Release;
|
|
|
+
|
|
|
+class Export extends InitialService
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * @var int ip server
|
|
|
+ */
|
|
|
+ protected $ip_server = 61;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Ftth constructor.
|
|
|
+ */
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this
|
|
|
+ ->setHelp("Modulo de export")
|
|
|
+ ->setHostEnv(true)
|
|
|
+ ->setVarEnv([
|
|
|
+ 'FTTH_EXPORT' => 'export.ftth'
|
|
|
+ ])
|
|
|
+ ->setOauth(true)
|
|
|
+ ->setRequired(false)
|
|
|
+ ->setDepends([]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Add config
|
|
|
+ * @throws \Docker\Composer\ServiceNotFoundException
|
|
|
+ */
|
|
|
+ public function add()
|
|
|
+ {
|
|
|
+ $module = $this->getModuleName();
|
|
|
+ $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()->_running_env)
|
|
|
+ ->addEnv_file($module . "." . $host_env_file)
|
|
|
+ ->addEnv_file("minio.env")
|
|
|
+ ->network($this->getRelease()->_network_name)->ipv4_address($this->generateIP());
|
|
|
+
|
|
|
+ $this->addLink(new Amqp(), $module)
|
|
|
+ ->addLink(new Minio(), $module);
|
|
|
+
|
|
|
+ $this->getRelease()->addBuild($module, $this->getComposer());
|
|
|
+ $this->getRelease()->writeVariablesEnviroment($module . "." . $host_env_file, $module);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|