-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge upstream changes, new api feature /api/status
- Loading branch information
Showing
17 changed files
with
162 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,19 +34,21 @@ You can use a chef recipe to setup your server or setup a vagrant box. | |
|
||
Dependencies | ||
|
||
sudo apt-get install php5-common | ||
sudo apt-get install php5 | ||
sudo apt-get install php5-xcache | ||
sudo apt-get install php5-mongo | ||
sudo apt-get install php5-fpm | ||
sudo apt-get install php5-curl | ||
sudo apt-get install mongodb | ||
sudo apt-get install npm | ||
|
||
Get the code | ||
|
||
git clone [email protected]:brunogoossens/BBB-Load-Balancer.git /var/www/bbb-load-balancer | ||
cd /var/www/bbb-load-balancer | ||
php5-common | ||
php5-cli | ||
php5-xcache | ||
php5-mongo | ||
php5-curl | ||
mongodb | ||
npm | ||
node | ||
git | ||
curl | ||
|
||
Get the code (change the destination) | ||
|
||
$ git clone https://github.com/brunogoossens/BBB-Load-Balancer.git /path/of/project | ||
$ cd /path/of/project | ||
|
||
Get NPM packages | ||
|
||
|
@@ -56,7 +58,7 @@ Edit the config file | |
|
||
$ cp app/config/parameters.yml.dist app/config/parameters.yml | ||
|
||
Change the bbb.salt value inside the file. The salt must be the same on all BBB servers | ||
Change the bbb.salt value inside the new file. The salt must be the same on all BBB servers | ||
You can also change other values if you like. | ||
|
||
Get composer | ||
|
@@ -65,26 +67,37 @@ Get composer | |
|
||
Install packages with composer | ||
|
||
composer install | ||
$ ./composer.phar install | ||
|
||
Start server (without apache or nginx) | ||
|
||
$ app/console server:run --env=prod | ||
|
||
If you want to configure an other server like apache or nginx, you can follow [this](http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html) guide. | ||
Make sure if you use a webserver, that it has write access to the app/cache and app/log folders. You can read more about this [here](http://symfony.com/doc/current/book/installation.html). Search the page for "Setting up Permissions". | ||
|
||
To automatically enable and disable servers based on there status, you can add this cronjob. | ||
|
||
* * * * * /path/to/project/app/console bbblb:servers:check --env=prod | ||
* * * * * /path/of/project/app/console bbblb:servers:check --env=prod | ||
|
||
To remove stopped meetings from the load balancer. | ||
To remove stopped meetings from the load balancer, add this cronjob. | ||
|
||
* * * * * /path/to/project/app/console bbblb:meetings:cleanup --env=prod | ||
* * * * * /path/of/project/app/console bbblb:meetings:cleanup --env=prod | ||
|
||
# Adding BBB Servers to the load balancer # | ||
|
||
Access the web interface: http://127.0.0.1:8000 (or vhost configured in apache or nginx) | ||
The first time you access this page, you must create an admin user. After creating this user, you can manage the BBB load balancer. You need to add at least 1 BBB server to the list of servers before you can use the load balancer. | ||
The first time you access this page, you must create an admin user. After creating this user, you can manage the BBB load balancer. You need to add at least 1 BBB server to the list of servers before you can use the load balancer. After setting up the load balancer, you should change your client applications BBB url to the new BBB load balancer URL. | ||
(http://127.0.0.1/bigbluebutton) | ||
|
||
# Updating the loadbalancer # | ||
|
||
So we added cool new features to the repository but you have deployed old code. You should do the following commands to get the newest code. | ||
|
||
$ cd /path/of/project/bbb-load-balancer | ||
$ git pull | ||
$ app/console cache:clear --env=prod | ||
$ app/console assets:install | ||
$ app/console assetic:dump --env=prod | ||
|
||
# Contact # | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{{ { 'message': exception.message }|json_encode|raw }}] | ||
[{{ { 'status_text': status_text, 'message': exception.message }|json_encode|raw }}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/BBBLoadBalancer/AdminBundle/Controller/DefaultAPIController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace BBBLoadBalancer\AdminBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use BBBLoadBalancer\UserBundle\Annotations\ValidAPIKey; | ||
|
||
class DefaultAPIController extends Controller | ||
{ | ||
/** | ||
* @Route("/api/status", name="status", defaults={"_format": "json"}) | ||
* @Method({"GET"}) | ||
* @ValidAPIKey | ||
*/ | ||
public function statusAction(Request $request) | ||
{ | ||
$return = array( | ||
'servers' => array() | ||
); | ||
|
||
// return all servers | ||
$servers = $this->get('server')->getServersBy(array("enabled" => true, "up" => true)); | ||
if(empty($servers)){ | ||
return new JsonResponse(array( | ||
"status" => "ERROR", | ||
"message" => "No Servers found that are enabled and up." | ||
) | ||
); | ||
} | ||
|
||
$servercount = count($servers); | ||
|
||
return new JsonResponse(array( | ||
"status" => "OK", | ||
"message" => "$servercount servers are used by the load balancer." | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
src/BBBLoadBalancer/AdminBundle/Tests/Controller/DefaultControllerTest.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace BBBLoadBalancer\BBBBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class BBBLoadBalancerBBBBundle extends Bundle | ||
{ | ||
} |
2 changes: 1 addition & 1 deletion
2
...minBundle/Controller/BBBAPIController.php → ...BBBBundle/Controller/BBBAPIController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/BBBLoadBalancer/BBBBundle/DependencyInjection/BBBLoadBalancerBBBExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace BBBLoadBalancer\BBBBundle\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
|
||
/** | ||
* This is the class that loads and manages your bundle configuration | ||
* | ||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} | ||
*/ | ||
class BBBLoadBalancerBBBExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$configuration = new Configuration(); | ||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('services.yml'); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/BBBLoadBalancer/BBBBundle/DependencyInjection/Configuration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace BBBLoadBalancer\BBBBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* This is the class that validates and merges configuration from your app/config files | ||
* | ||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} | ||
*/ | ||
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$rootNode = $treeBuilder->root('bbb_load_balancer_bbb'); | ||
|
||
// Here you should define the parameters that are allowed to | ||
// configure your bundle. See the documentation linked above for | ||
// more information on that topic. | ||
|
||
return $treeBuilder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
services: | ||
bbb: | ||
class: BBBLoadBalancer\BBBBundle\Service\BBBService | ||
arguments: [ %bbb.salt%, @logger ] |
2 changes: 1 addition & 1 deletion
2
...lancer/AdminBundle/Service/BBBService.php → ...Balancer/BBBBundle/Service/BBBService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
src/BBBLoadBalancer/ThemeBundle/Tests/Controller/DefaultControllerTest.php
This file was deleted.
Oops, something went wrong.