Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Added readmes listing all options
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Speckmaier committed Jun 19, 2017
1 parent b3d7423 commit e8fb03a
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ public function parseToService( Service $service, Configuration $configuration )
$url = $healthcheckConfig->get('url', '');
$healthcheckInformation->setUrl( $url );

$port = $healthcheckConfig->get('port', 80);
$healthcheckInformation->setPort( $port );

$strategy = $healthcheckConfig->get( 'strategy', HealthcheckExtraInformation::STRATEGY_NONE );
$healthcheckInformation->setStrategy( $strategy );

$interval = $healthcheckConfig->get( 'interval', 2000 );
$healthcheckInformation->setInterval( $interval );

$responseTimeout = $healthcheckConfig->get( 'response-timeout', 2000 );
$healthcheckInformation->setResponseTimeout( $responseTimeout );

$initializingTimeout = $healthcheckConfig->get( 'init-timeout', 60000 );
$healthcheckInformation->setInitializingTimeout( $initializingTimeout );

$reinitializingTimeout = $healthcheckConfig->get( 'reinit-timeout', 60000 );
$healthcheckInformation->setReinitializingTimeout( $reinitializingTimeout );

$healthyThreshold = $healthcheckConfig->get( 'healthy-threshold', 2 );
$healthcheckInformation->setHealthyThreshold( $healthyThreshold );

$unhealthyThreshold = $healthcheckConfig->get( 'unhealthy-threshold', 3 );
$healthcheckInformation->setUnhealthyThreshold( $unhealthyThreshold );

$service->addExtraInformation($healthcheckInformation);

}
Expand Down
27 changes: 27 additions & 0 deletions app/Blueprint/Healthcheck/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Healthcheck
Set up a rancher healthcheck that periodically opens connections to the container to check whether the service running
in it is actually still doing its intended job.

## Options
All options lie in the `healthcheck` json object.
- `enable` can be set to `false` to disable the healthcheck without removing its data. Intended for debugging. defaults
to `true`
- `port` the port to query for a successful connection. Defaults to `80`
- `url` http url to check. This will enable http 1.0 checking instead of tcp 'conection opens' checking
- `interval`: Interval between healthchecks in ms. Defaults to `2000`
- `response-timeout`: Time in ms before a stalled request is counted as having failed. Defaults to `2000`
- `init-timeout`: Time before the first healthcheck is attempted in ms. Defaults to `60000`
- `reinit-timeout`: Time after a restart before the first healthcheck is attempted in ms. Defaults to `60000`
- `healthy-threshold`: Number of successful requests before the service counts as being healthy. Defaults to `2`
- `unhealthy-threshold`: Number of failed requests before the service counts as being unhealthy. Defaults to `3`

## Example
```json
{
"default": {
"healthcheck":{
"url":"\/"
}
}
}
```
43 changes: 34 additions & 9 deletions app/Blueprint/PublishUrls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,46 @@ The rancher traefik loadbalancer publishes service ports based on a list of labe
- traefik.domain
- traefik.alias
- traefik.path
- traefik.path.prefix
- traefik.priority
- traefik.path.prefix - traefik.priority

Setting
## Example
```json
{
"publish-urls": {
"enable": true,
"urls":[
"https://www.example.com/sitemap.xml",
"https://www.example.com/sitemaps/"
]
"default":{
"healthcheck":{
"enable":true
},
"publish":{
"enable": true,
"url": "https:\/\/www.example.com"
}
},
"environments":{
"test": {
"publish": {
"pathes": [
"\/sitemaps\/",
"\/sitemap.xml"
]
}
}
}
}
```
Will set the traefik labels to balance the pathes `sitemap.xml,/sitemaps/` on `www.example.com` to the service.
The protocol is currently ignored.
Since no port is given port 80 is assumed

## All options
All options are inside the `publish` json object
- `type`: The type of loadbalancer / service discovery to create info for. Currently only `traefik` is available and is used
as default.
- `port`: The port inside the container that should be published through the load balancer. Defaults to `80`
- `pathes`: If this is non-empty then only http urls with pathes starting with the given path are forwarded to this container. Defaults to `[]`
- `priority`: High priority services beat lower priority services.

### Traefik implementation notes
- The default priority is 5. Setting `pathes` will change the default priority to `10`.
- Rancher traefik only accepts containers in the `healthy` state - this state only appears when a healthcheck is set. This mean
setting a [healthcheck](../Healthcheck/README.md) is NECESSARY for the published urls to work.
TODO: Add check for Loadbalancer to the valdation.
33 changes: 33 additions & 0 deletions app/Blueprint/Scheduler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Scheduler
Sets scheduling rules for the container.

## Use case
Rancher uses Tag based scheduling which is set via container labels.

## Options
All options life inside the `scheduler` json object.

- `enable`: Can be set to `false` to disable creating the scheduling rules without removing them. Defaults to `true`
- `scheduler`: Scheduler to use. Currently the default and only implementation available is `rancher`
- `same-host`: Setting this to `true` will allow multiple containers to be scheduled on the same host. Defaults to `false`
- `tags`: Object or array of tags. A host must have these tags set for a container to be scheduled there. Defaults to []
- Arrays or numerical object variables will be created as `$VALUE=true` tag rule
- non-numerical object variables will be created as `$NAME=$VALUE` tag rule
- `forbid-tags`: Object or array of forbidden tags. see `tags` except the host must NOT have these tags. Defaults to []


## Example
```json
{
"defaults":{
"scheduler":{
"tags":[
"apps",
],
"should-not-have-tags":[
"fallback"
]
}
}
}
```
10 changes: 10 additions & 0 deletions app/Blueprint/Scheduler/SchedulerParser/SchedulerParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public function parse( Service $service, Configuration $configuration ) {
$forbiddenTags = [];
$schedulerInformation->setForbidTags($forbiddenTags);

$shouldHaveTags = $schedulerConfig->get('should-have-tags', []);
if( !is_array($shouldHaveTags) )
$shouldHaveTags = [];
$schedulerInformation->setShouldHaveTags($shouldHaveTags);

$shouldNotTags = $schedulerConfig->get('should-not-tags', []);
if( !is_array($shouldNotTags) )
$shouldNotTags = [];
$schedulerInformation->setShouldNotTags($shouldNotTags);

$allowSameHost = $schedulerConfig->get('same-host', false);
$schedulerInformation->setAllowSameHost($allowSameHost);

Expand Down
4 changes: 3 additions & 1 deletion app/Blueprint/Webserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ This blueprint creates infrastructures to support apps using php7.


### Recognized Configuration Values

- [Healthcheck Options](../Healthcheck/README.md)
- [Scheduler Options](../Scheduler/README.md)
- [Publish Urls Options](../PublishUrls/README.md)

#### Docker options
| Option | Defaults to | Explanation |
Expand Down

0 comments on commit e8fb03a

Please sign in to comment.