|
@@ -167,6 +167,147 @@ inventory=inventory.ini
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function addFtth($composer, $config = array(), $flavor = "dev"){
|
|
|
+ $version = "latest";
|
|
|
+ $domain = "fd3.flowdat.com";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("ftth")
|
|
|
+ ->image($registry."fd3/ftth:" . $version)
|
|
|
+ ->build("./ftth/")
|
|
|
+ ->restart("always")
|
|
|
+ ->addLinks("mysql")
|
|
|
+ ->addLinks("base")
|
|
|
+ ->addLinks("amqp")
|
|
|
+ ->addLinks("base", "base.".$fd_domain)
|
|
|
+
|
|
|
+ ->addEnv_file("ftth.oauth.env")
|
|
|
+ ->addEnviroment("VIRTUAL_HOST", "ftth.".$domain)
|
|
|
+ ->addEnviroment("HOST_FTTH", "ftth.".$domain)
|
|
|
+ ->addEnviroment("HOST_STATS", "stats.".$domain)
|
|
|
+ ->addEnviroment("HOST_MAPAS", "mapas.".$domain)
|
|
|
+ ->addEnviroment("HOST_BASE", "base.".$domain)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
+ //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
+
|
|
|
+ ->addVolumes("./ftth/", "/opt/ftth")
|
|
|
+ ;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function addStats($composer, $config = array(), $flavor = "dev"){
|
|
|
+ $version = "latest";
|
|
|
+ $domain = "fd3.flowdat.com";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("stats")
|
|
|
+ ->image($registry."fd3/stats:" . $version)
|
|
|
+ ->build("./stats/")
|
|
|
+ ->addLinks("mysql")
|
|
|
+ ->addLinks("base")
|
|
|
+ ->addLinks("amqp")
|
|
|
+ ->addLinks("base", "base.".$domain)
|
|
|
+ //->addLinks("jsendpoint", "endpoint")
|
|
|
+ //->addLinks("statsd", "statsd")
|
|
|
+ ->addVolumes("./stats/", "/opt/stats")
|
|
|
+ ->addEnv_file("stats.oauth.env")
|
|
|
+
|
|
|
+ ->addEnviroment("VIRTUAL_HOST", "stats.".$fd_domain)
|
|
|
+ ->addEnviroment("HOST_FTTH", "ftth.".$fd_domain)
|
|
|
+ ->addEnviroment("HOST_STATS", "stats.".$fd_domain)
|
|
|
+ ->addEnviroment("HOST_MAPAS", "mapas.".$fd_domain)
|
|
|
+ ->addEnviroment("HOST_BASE", "base.".$fd_domain)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
+ //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
+
|
|
|
+ ;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function addMapas($composer, $config = array(), $flavor = "dev"){
|
|
|
+ $version = "latest";
|
|
|
+ $domain = "fd3.flowdat.com";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("mapas")
|
|
|
+ ->image($registry."fd3/mapas:" . $version)
|
|
|
+ ->build("./mapas/")
|
|
|
+ ->addLinks("mysql")
|
|
|
+ ->addLinks("base")
|
|
|
+ ->addLinks("amqp")
|
|
|
+ ->addLinks("base", "base.".$domain)
|
|
|
+ ->addEnv_file("mapas.oauth.env")
|
|
|
+
|
|
|
+ ->addEnviroment("VIRTUAL_HOST", "mapas.".$domain)
|
|
|
+ ->addEnviroment("HOST_FTTH", "ftth.".$domain)
|
|
|
+ ->addEnviroment("HOST_STATS", "stats.".$domain)
|
|
|
+ ->addEnviroment("HOST_MAPAS", "mapas.".$domain)
|
|
|
+ ->addEnviroment("HOST_BASE", "base.".$domain)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
+ //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
+ //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
+
|
|
|
+ ->addVolumes("./mapas/", "/opt/mapas")
|
|
|
+ ->addVolumes("./mapas/web/uploads", "/opt/mapas/web/uploads")
|
|
|
+ ;
|
|
|
+ }
|
|
|
+
|
|
|
+ function addNginx($composer, $config = array(), $flavor = "dev"){
|
|
|
+ $version = "latest";
|
|
|
+ $domain = "fd3.flowdat.com";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("nginx")->build("extra/nginx/")
|
|
|
+ ->image($registry."fd3/nginx:".$v)
|
|
|
+ ->addEnv_file($host_env_file)
|
|
|
+ ->restart("always")
|
|
|
+ ->addPorts(80, 80)
|
|
|
+ ->addPorts(443, 443)
|
|
|
+ ->addVolumes("/var/run/docker.sock", "/tmp/docker.sock:ro")
|
|
|
+ ->addVolumes("./extra/nginx/certs", "/etc/nginx/certs:ro")
|
|
|
+ ->addVolumes("./extra/nginx/vhost.d", "/etc/nginx/vhost.d")
|
|
|
+ ->addVolumes("./extra/nginx/share", "/usr/share/nginx/html")
|
|
|
+ ;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function addMongDb($composer, $config = array(), $flavor = "dev"){
|
|
|
+
|
|
|
+ $version = "latest";
|
|
|
+ $domain = "fd3.flowdat.com";
|
|
|
+ $mongdb_version = "3.4";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("mongodb")
|
|
|
+ ->image("mongo:". $mongdb_version)
|
|
|
+ ->addVolumes("./mongodb", "/data/db")
|
|
|
+ ;
|
|
|
+ }
|
|
|
+
|
|
|
+ function addSupervisord(){
|
|
|
+
|
|
|
+ $version = "latest";
|
|
|
+ extract($config);
|
|
|
+
|
|
|
+ $composer->addService("supervisord")->build("./extra/supervisord")
|
|
|
+ ->image($registry."fd3/supervisord:$version")
|
|
|
+ ->privileged(true)
|
|
|
+ ->restart("always")
|
|
|
+ ->addEnviroment("./extra/supervisord/", "/etc/supervisord/")
|
|
|
+ ->addEnviroment("./extra/supervisord/var/", "/var/log/supervisor/")
|
|
|
+ ->addEnviroment("./extra/supervisord/sshd_config", "/etc/ssh/sshd_config")
|
|
|
+ ->addEnviroment("./extra/supervisord/bin/fiberhome", "/usr/bin/fiberhome")
|
|
|
+ ->addEnviroment("./extra/supervisord/bin/fiberlink", "/usr/bin/fiberlink")
|
|
|
+
|
|
|
+ ;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
function addMySql($composer, $config, $flavor = "dev"){
|
|
|
$version = "latest";
|
|
|
$domain = "fd3.flowdat.com";
|
|
@@ -182,7 +323,7 @@ inventory=inventory.ini
|
|
|
;
|
|
|
}
|
|
|
|
|
|
- function getDockerComposer( $v = "latest", $host_env_file = "host.env", $registry = "docker.infra.flowdat.com/", $fd_domain = "fd3.flowdat.com")
|
|
|
+ function getDockerComposer( $version = "latest", $host_env_file = "host.env", $registry = "docker.infra.flowdat.com/", $fd_domain = "fd3.flowdat.com")
|
|
|
{
|
|
|
|
|
|
$mysql_root_pass="235r2342gtfsw";
|
|
@@ -194,80 +335,22 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
|
|
|
|
|
|
$composer = new FileFormat2("../");
|
|
|
|
|
|
- $this->addBase($composer, array("version" => $v, "domain" => $fd_domain));
|
|
|
-
|
|
|
- //$composer->addService("ftth")
|
|
|
- // ->image($registry."fd3/ftth:" . $v)
|
|
|
- // ->build("./ftth/")
|
|
|
- // ->restart("always")
|
|
|
- // ->addLinks("mysql")
|
|
|
- // ->addLinks("base")
|
|
|
- // ->addLinks("amqp")
|
|
|
- // ->addLinks("base", "base.".$fd_domain)
|
|
|
-
|
|
|
- // ->addEnv_file("ftth.oauth.env")
|
|
|
- // ->addEnviroment("VIRTUAL_HOST", "ftth.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_FTTH", "ftth.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_STATS", "stats.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_MAPAS", "mapas.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_BASE", "base.".$fd_domain)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
- // //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
-
|
|
|
- // ->addVolumes("./ftth/", "/opt/ftth")
|
|
|
- //;
|
|
|
-
|
|
|
- //$composer->addService("mapas")
|
|
|
- // ->image($registry."fd3/mapas:" . $v)
|
|
|
- // ->build("./mapas/")
|
|
|
- // ->addLinks("mysql")
|
|
|
- // ->addLinks("base")
|
|
|
- // ->addLinks("amqp")
|
|
|
- // ->addLinks("base", "base.".$fd_domain)
|
|
|
- // ->addEnv_file("mapas.oauth.env")
|
|
|
-
|
|
|
- // ->addEnviroment("VIRTUAL_HOST", "mapas.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_FTTH", "ftth.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_STATS", "stats.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_MAPAS", "mapas.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_BASE", "base.".$fd_domain)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
- // //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
+ $base_vars = array("version" => $version, "domain" => $fd_domain, "registry" => $registry);
|
|
|
|
|
|
- // ->addVolumes("./mapas/", "/opt/mapas")
|
|
|
- // ->addVolumes("./mapas/web/uploads", "/opt/mapas/web/uploads")
|
|
|
- //;
|
|
|
+ $this->addBase($composer, $base_vars);
|
|
|
+ $this->addFtth($composer, $base_vars);
|
|
|
+ $this->addStats($composer, $base_vars);
|
|
|
+ $this->addMapas($composer, $base_vars);
|
|
|
+ $this->addNginx($composer, $base_vars);
|
|
|
|
|
|
|
|
|
- //$composer->addService("stats")
|
|
|
- // ->image($registry."fd3/stats:" . $v)
|
|
|
- // ->build("./stats/")
|
|
|
- // ->addLinks("mysql")
|
|
|
- // ->addLinks("base")
|
|
|
- // ->addLinks("amqp")
|
|
|
- // ->addLinks("base", "base.".$fd_domain)
|
|
|
- // ->addLinks("jsendpoint", "endpoint")
|
|
|
- // ->addLinks("statsd", "statsd")
|
|
|
- // ->addVolumes("./stats/", "/opt/stats")
|
|
|
- // ->addEnv_file("stats.oauth.env")
|
|
|
|
|
|
- // ->addEnviroment("VIRTUAL_HOST", "stats.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_FTTH", "ftth.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_STATS", "stats.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_MAPAS", "mapas.".$fd_domain)
|
|
|
- // ->addEnviroment("HOST_BASE", "base.".$fd_domain)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
|
|
|
- // //->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
|
|
|
- // //->addEnviroment("HTTPS_METHOD", "nohttps")
|
|
|
|
|
|
- //;
|
|
|
|
|
|
/**************************************************************************************/
|
|
|
/* Servicios */
|
|
|
/**************************************************************************************/
|
|
|
- $this->addMySql($composer, array(
|
|
|
+ $this->addMySql($composer, $base_vars + array(
|
|
|
'mysql_root_pass' => $mysql_root_pass,
|
|
|
'mysql_user' => $mysql_user,
|
|
|
'mysql_pass' => $mysql_pass,
|
|
@@ -360,12 +443,6 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
|
|
|
// ->restart("always")
|
|
|
// ;
|
|
|
|
|
|
- //$composer->addService("mongodb")
|
|
|
- // ->image("mongo:3.4")
|
|
|
- // ->addVolumes("./mongodb", "/data/db")
|
|
|
- //;
|
|
|
-
|
|
|
-
|
|
|
//$composer->addService("statsd")->build("./extra/statsd/statsd")
|
|
|
// ->image($registry."fd3/statsd:$v")
|
|
|
// ->addPorts("8125", "8125/udp")
|
|
@@ -375,31 +452,7 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
|
|
|
// ->addVolumes("./extra/statsd/statsd/statsd.config.js", "/opt/config/statsd.config.js")
|
|
|
//;
|
|
|
|
|
|
- //$composer->addService("supervisord")->build("./extra/supervisord")
|
|
|
- // ->image($registry."fd3/supervisord:$v")
|
|
|
- // ->privileged(true)
|
|
|
- // ->restart("always")
|
|
|
- // ->addEnviroment("./extra/supervisord/", "/etc/supervisord/")
|
|
|
- // ->addEnviroment("./extra/supervisord/var/", "/var/log/supervisor/")
|
|
|
- // ->addEnviroment("./extra/supervisord/sshd_config", "/etc/ssh/sshd_config")
|
|
|
- // ->addEnviroment("./extra/supervisord/bin/fiberhome", "/usr/bin/fiberhome")
|
|
|
- // ->addEnviroment("./extra/supervisord/bin/fiberlink", "/usr/bin/fiberlink")
|
|
|
- //
|
|
|
- //;
|
|
|
-
|
|
|
- $composer->addService("nginx")->build("extra/nginx/")
|
|
|
- ->image($registry."fd3/nginx:".$v)
|
|
|
- ->addEnv_file($host_env_file)
|
|
|
- ->restart("always")
|
|
|
- ->addPorts(80, 80)
|
|
|
- ->addPorts(443, 443)
|
|
|
- ->addVolumes("/var/run/docker.sock", "/tmp/docker.sock:ro")
|
|
|
- ->addVolumes("./extra/nginx/certs", "/etc/nginx/certs:ro")
|
|
|
- ->addVolumes("./extra/nginx/vhost.d", "/etc/nginx/vhost.d")
|
|
|
- ->addVolumes("./extra/nginx/share", "/usr/share/nginx/html")
|
|
|
- ;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
return $composer->render();
|
|
|
}
|
|
|
}
|