소스 검색

FD3-142 radius y freeradius docker

Guillermo Espinoza 7 년 전
부모
커밋
87eef526d8
1개의 변경된 파일57개의 추가작업 그리고 11개의 파일을 삭제
  1. 57 11
      tools/src/Release.php

+ 57 - 11
tools/src/Release.php

@@ -15,7 +15,7 @@ class Release extends Command
 {
     protected function configure()
     {
-        $this 
+        $this
         ->setName('make:install')
 
         ->setDescription('Create a new install.')
@@ -23,21 +23,24 @@ class Release extends Command
         ->setHelp('This command allows you to create a new installation...')
 
 	 ->addArgument('dir', InputArgument::REQUIRED, 'The directory where to create the installation.')
-	 ->addOption('base-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url fot the app Base', "git@bitbucket.org:ikflowdat/base.git")
+	 ->addOption('base-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Base', "git@bitbucket.org:ikflowdat/base.git")
 	 ->addOption('base-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Base app', "master")
 
-	 ->addOption('ftth-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url fot the app Base', "git@bitbucket.org:ikflowdat/ftth.git")
+	 ->addOption('ftth-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Ftth', "git@bitbucket.org:ikflowdat/ftth.git")
 	 ->addOption('ftth-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Ftth appFtth', "master")
 
-	 ->addOption('mapas-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url fot the app Base', "git@bitbucket.org:ikflowdat/mapas.git")
+	 ->addOption('mapas-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Mapas', "git@bitbucket.org:ikflowdat/mapas.git")
 	 ->addOption('mapas-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Mapas app', "master")
 
-	 ->addOption('stats-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url fot the app Base', "git@bitbucket.org:ikflowdat/stats.git")
+	 ->addOption('stats-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Stats', "git@bitbucket.org:ikflowdat/stats.git")
 	 ->addOption('stats-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Stats app', "master")
 
-	 ->addOption('extra-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url fot the app Base', "git@bitbucket.org:ikflowdat/extra.git")
+	 ->addOption('extra-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Extra', "git@bitbucket.org:ikflowdat/extra.git")
 	 ->addOption('extra-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Extra files and apps', "master")
 
+     ->addOption('radius-repo',null, InputOption::VALUE_REQUIRED, 'Git clone Url for the app Radius', "git@bitbucket.org:ikflowdat/radius.git")
+	 ->addOption('radius-ref', null, InputOption::VALUE_REQUIRED, 'Git reference (branch or tag) to clone the Radius files and apps', "master")
+
 	 ->addOption('host-ip', null, InputOption::VALUE_REQUIRED, 'Ip of the runnning host to be added to the /etc/hosts file, eventually', "127.0.1.1")
 
 	 ->addOption('domain', null, InputOption::VALUE_REQUIRED, 'Domain where the flowdat will be installed', "fd3.flowdat.com")
@@ -78,6 +81,10 @@ class Release extends Command
 			'url' => $input->getOption("extra-repo"),
 			'branch' => $input->getOption("extra-ref"),
 		),
+		"radius" => array(
+			'url' => $input->getOption("radius-repo"),
+			'branch' => $input->getOption("radius-ref"),
+		),
 	);
 
 	$dObj->file("git.ini")->writeIniConfig($install_config);
@@ -102,14 +109,14 @@ class Release extends Command
 
 	$dObj->file('host.env')->content($env_content);
 
-	foreach(array("ftth", "mapas", "stats") as $app){
+	foreach(array("ftth", "mapas", "stats", 'radius') as $app){
 		$dObj->file($app.'.oauth.env')->content("");
 	}
 
 	$dObj->file('install.yml')->content(
 		yaml::dump(array(
 			"install_dir" => realpath($dir),
-			'docker_apps' => array('base', 'stats', 'ftth', 'mapas'),
+			'docker_apps' => array('base', 'stats', 'ftth', 'mapas', 'radius'),
                         'domain'      => $domain,
 			)
 		)
@@ -121,7 +128,7 @@ inventory=inventory.ini
         "
 	);
 
-	
+
     }
 
     function getHostEnv($fd_domain = "fd3.flowdat.com"){
@@ -130,6 +137,7 @@ inventory=inventory.ini
 		"HOST_FTTH"	=> "ftth.". $fd_domain,
 		"HOST_MAPAS" 	=> "mapas.".$fd_domain,
 		"HOST_STATS"	=> "stats.".$fd_domain,
+        "HOST_RADIUS"	=> "radius.".$fd_domain,
 		"HOST_GRAFANA"	=> "grafana.".$fd_domain,
 		"HOST_PMA"	=> "pma.".$fd_domain,
 	);
@@ -141,6 +149,7 @@ inventory=inventory.ini
 		"ftth.". $fd_domain => $config_ip,
 		"mapas.". $fd_domain => $config_ip,
 		"stats.". $fd_domain => $config_ip,
+		"radius.". $fd_domain => $config_ip,
 		"grafana.". $fd_domain => $config_ip,
 		"pma.". $fd_domain => $config_ip,
 	);
@@ -170,6 +179,7 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
 		->addEnviroment("HOST_STATS", 	"stats.".$fd_domain)
 		->addEnviroment("HOST_MAPAS", 	"mapas.".$fd_domain)
 		->addEnviroment("HOST_BASE", 	"base." .$fd_domain)
+		->addEnviroment("HOST_RADIUS", 	"radius." .$fd_domain)
 		->addVolumes("./base/", "/opt/base")
 	;
 
@@ -188,6 +198,7 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
 		->addEnviroment("HOST_STATS", 	"stats.".$fd_domain)
 		->addEnviroment("HOST_MAPAS", 	"mapas.".$fd_domain)
 		->addEnviroment("HOST_BASE", 	"base.".$fd_domain)
+        ->addEnviroment("HOST_RADIUS", 	"radius." .$fd_domain)
 		//->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
 		//->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
 		//->addEnviroment("HTTPS_METHOD", 	"nohttps")
@@ -209,6 +220,7 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
 		->addEnviroment("HOST_STATS", 	"stats.".$fd_domain)
 		->addEnviroment("HOST_MAPAS", 	"mapas.".$fd_domain)
 		->addEnviroment("HOST_BASE", 	"base.".$fd_domain)
+        ->addEnviroment("HOST_RADIUS", 	"radius." .$fd_domain)
 		//->addEnviroment("OAUTH_CLIENT_ID", $oauth_client)
 		//->addEnviroment("OAUTH_CLIENT_SECRET", $oauth_client_secret)
 		//->addEnviroment("HTTPS_METHOD", 	"nohttps")
@@ -235,12 +247,46 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
 		->addEnviroment("HOST_STATS", 	"stats.".$fd_domain)
 		->addEnviroment("HOST_MAPAS", 	"mapas.".$fd_domain)
 		->addEnviroment("HOST_BASE", 	"base.".$fd_domain)
+        ->addEnviroment("HOST_RADIUS", 	"radius." .$fd_domain)
 		//->addEnviroment("OAUTH_CLIENT_ID", 	$oauth_client)
 		//->addEnviroment("OAUTH_CLIENT_SECRET",	$oauth_client_secret)
 		//->addEnviroment("HTTPS_METHOD", 	"nohttps")
 
 	;
 
+	$composer->addService("radius")
+		->image("{$registry}fd3/radius:{$v}")
+		->build("./radius/")
+		->addLinks("mysql")
+        ->addLinks("base")
+		->addLinks("amqp")
+		->addLinks("base", "base.".$fd_domain)
+		->addVolumes("./radius/", "/opt/radius")
+		->addEnv_file("radius.oauth.env")
+
+		->addEnviroment("VIRTUAL_HOST", "radius.".$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("HOST_RADIUS", 	"radius." .$fd_domain)
+	;
+
+    $composer->addService("freeradius")
+        ->image("{$registry}fd3/freeradius:{$v}")
+		->build("./extra/freeradius")
+        ->addLinks("mysql")
+        ->addEnviroment("MYSQL_HOST", 'mysql')
+        ->addEnviroment("MYSQL_ROOT_PASSWORD", $mysql_root_pass)
+		->addEnviroment("MYSQL_USER", $mysql_user)
+		->addEnviroment("MYSQL_PASSWORD", $mysq_pass)
+        ->addPorts(1812, 1812)
+        ->addPorts(1813, 1813)
+        ->addPorts(3799, 3799)
+		->addVolumes("./extra/freeradius", "/opt/freeradius")
+		->restart("always")
+	;
+
 	/**************************************************************************************/
 	/* Servicios */
 	/**************************************************************************************/
@@ -364,10 +410,10 @@ $oauth_client_secret = "5w7gx6ptdoo4g8cwwo88o8gowosgco84sso08ssow0osg88g8k";
 		->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/")	
+	$composer->addService("nginx")->build("extra/nginx/")
 		->image($registry."fd3/nginx:".$v)
 		->addEnv_file($host_env_file)
 		->restart("always")