Skip to content

Commit

Permalink
Merge pull request #141 from Orange-OpenSource/fix/doc
Browse files Browse the repository at this point in the history
Fix documentations:
  • Loading branch information
arnaudruffin committed Feb 16, 2016
2 parents 1fb9ba0 + 811d8fd commit d66b9e3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ We suppose that the autosleep service broker is already available in your market

### Basics

Create an autosleep service instance to get applications in the space automatically put to sleep after an inactivity period:
Create an autosleep service instance to watch all applications in the space and automatically put them to sleep after default idle duration:

```
cf cs autosleep default my-autosleep
```

Autosleep **will periodically automatically bind every applications in the space** to this service instance (if you want to fine tune which apps gets auto-bound, please use the [excludeAppNameRegExp](#excludeappnameregexp) parameter to exclude some apps).
Autosleep **will periodically automatically bind every applications in the space** to this service instance (if you want to fine tune which apps gets auto-bound, please use the [exclude-from-auto-enrollment](#exclude-from-auto-enrollment) parameter to exclude some apps).

Once bound, your application will be watched for inactivity, and automatically stopped by the autosleep service. If you wish to disable this watch, simply unbind your application from the autosleep service instance.

### Advanced configuration parameters

Optionally the autosleep service broker accepts the following parameters:

- [```inactivity```] (#inactivity)
- [```excludeAppNameRegExp ```] (#excludeappnameregexp)
- [```no_optout ```] (#lockno_optout)
- [```idle-duration```] (#idle-duration)
- [```exclude-from-auto-enrollment ```] (#exclude-from-auto-enrollment)
- [```auto-enrollment ```] (#lockauto-enrollment)
- [```secret ```] (#secret)

These parameters can be provided on service creations as well as on service updates, eg.
Expand All @@ -51,37 +51,38 @@ These parameters can be provided on service creations as well as on service upda
cf cs autosleep default my-autosleep -c '{"inactivity": "PT1H15M"}'
```

#### *inactivity*
#### *idle-duration*
Duration after which bound applications will be considered as inactive. The time format used is [the ISO8601] (https://en.wikipedia.org/wiki/ISO_8601#Durations) duration format.

- *Example:*```'{"inactivity": "PT1H15M"}'```
would stop the application after *1 hour and 15 minutes* of inactivity.
- *Default value :* 24H

#### *excludeAppNameRegExp*
#### *exclude-from-auto-enrollment*
If you don't want all the application to be automatically bound, you can set this parameter with a regular expression to filter on application names.

- *Example:*```'{"excludeAppNameRegExp": ".*"}'```
wouldn't automatically bind any application in the space. Application would have to be bound manually.
- *Default value :* none (every app in space will be bound).


#### :lock:*no_optout*
#### :lock:*auto-enrollment*

If platform teams (admins, org managers, or specific members of the space) don't want all space members to be able to manually unbound apps from the autosleep service themselves, then a no_optout mode is supported. When set:
* manually unbound apps, will automatically be re-bound again after the activity period
By default this parameter is set as ```standard```. If platform teams (admins, org managers, or specific members of the space) don't want all space members to be able to manually unbound apps from the autosleep service themselves, then a forced mode is supported. When set to this:

* manually unbound apps will automatically be re-bound again after the activity period
* the autosleep service-instance won't be deletable by space members to disable auto-bindings

To enable to "no_optout" mode, set this parameter to ``true``. As this is a protected parameter, you will have also have to provide a ['secret' parameter] (#secret).
To enable to "forced" mode, set the *auto-enrollment* parameter to ``forced``. As this is a protected parameter, you will have also have to provide a [```secret``` parameter] (#secret).

- *Example:*```'{"no_optout": "true"}'```
- *Default value :* false
- *Example:*```'{"auto-enrollment": "forced"}'```
- *Default value :* ```standard```

#### *secret*
Provide a secret if you wish to set/change a protected parameter. Please save it carefully, has you will be asked to provide the same secret the next time you set/change a protected parameter
Provide a secret if you wish to set/change a protected parameter. Please save it carefully, has you will be asked to provide the same secret the next time you set/change a protected parameter. As a fallback, you may also use the credential password set at deployment time (see the ```security.user.password``` in [publish documentation] (doc/publish.md)).

- *Example:*```'{"secret": "Th1s1zg00dP@$$w0rd"}'```
- *Default value :* none
- *Default value :* ```null```


# Usage by platform teams
Expand All @@ -90,7 +91,7 @@ Provide a secret if you wish to set/change a protected parameter. Please save it
If you wish to build the app yourself, go to [build documentation] (doc/build.md).

## How to deploy and publish
Once you built the application or if you got it from [latest release] (https://github.com/Orange-OpenSource/autosleep/releases/), go to [build documentation] (doc/publish.md).
Once you built the application or if you got it from [latest release] (https://github.com/Orange-OpenSource/autosleep/releases/), go to [publish documentation] (doc/publish.md).

# How to test
Acceptance tests are available in the source code, as robotframework tests. More information [here] (doc/test.md).
39 changes: 27 additions & 12 deletions doc/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ Make a *manifest.yml* file according to the manifest.tmpl.yml template.

Autosleep service needs properties to work . The properties that are used are:

- __security.user.name__: the basic auth username for the service
- __security.user.password__: the basic auth password for the service
- __cf.client.target.endpoint__: the api endpoint of the cloudfoundry instance
- __security.user.name__: the basic auth username for the service.
- __security.user.password__: the basic auth password for the service.
- __cf.client.target.endpoint__: the api endpoint of the cloudfoundry instance.
- __cf.client.skip.ssl.validation__: set this property to _true_ if the current cloudfoundry instance use self-signed certificates.
- __cf.client.username__: the username that will be used in by the autosleep service
- __cf.client.password__: the password that will be used in by the autosleep service
- __cf.client.clientId__: the client id of the application (optional)
- __cf.client.clientSecret__: the client secret of the application (optional)
- __cf.security.password.encodingSecret__: the secret used to hash password (optional). If none provided, it will use "".
- __cf.service.broker.id__: the service broker id. If none provided, it will use "autosleep".
- __cf.service.plan.id__: the service plan id. If none provided, it will use "default".
- __cf.client.username__: the username that will be used in by the autosleep service.
- __cf.client.password__: the password that will be used in by the autosleep service.
- __cf.client.clientId__: the client id of the application (optional). If none provided, it will used ```"cf"```.
- __cf.client.clientSecret__: the client secret of the application (optional). If none provided, it will used ```""```.
- __cf.security.password.encodingSecret__: the secret used to hash password (optional). If none provided, it will use ```""```.
- __cf.service.broker.id__: the service broker id. If none provided, it will use ```"autosleep"```.
- __cf.service.plan.id__: the service plan id. If none provided, it will use ```"default"```.

There are two ways of providing these properties to autosleep.

Expand All @@ -37,5 +37,20 @@ cf push -f manifest.yml -p org.cloudfoundry.autosleep.war
Check that the autosleep application is running and retrieve its url (`cf app autosleep-app`).

Then run the following command:
```cf create-service-broker autosleep LOGIN PASSWORD http://your-autsleep-route```
where ___LOGIN___ and ___PASSWORD___ are the values you provided in the _manifest.yml_ file for environment properties ___security.user.name___ and ___security.user.password___

```cf create-service-broker <name> <login <password> <url>```

where:

- ```login``` and ```password``` are the values you provided in the _manifest.yml_ file for environment properties ___security.user.name___ and ___security.user.password___.
- ```name``` the name of the service as it will appear in the marketplace.
- ```url```: the URL of your servicde broker.


## Publish as a private broker
Currently cf does not support private service broker creation.But you may use ```cf curl``` command.
With the same parameters as above:

```cf curl /v2/service_brokers -X POST -d '{"name":"<name>","broker_url":"<url>","auth_username":"<login>","auth_password":"<password>","space_guid":"<space_id>"}'```

where ```space_id``` is the space guid where the application is deployed.
2 changes: 1 addition & 1 deletion doc/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to run the acceptance tests.

### What you need in your cloudfoundry environment
- A test application (a [static website](https://github.com/cloudfoundry/staticfile-buildpack) for instance)
- Autosleep registered as a service broker (see [how to publish on the market place](publish.md)).
- Autosleep deployed as an application in a space where you are allowed to deploy private service brokers.

## Run the tests
1. First copy `{ACCEPTANCE_TEST_DIRECTORY}/acceptance.tmpl.cfg` under `{ACCEPTANCE_TEST_DIRECTORY}/acceptance.cfg`
Expand Down

0 comments on commit d66b9e3

Please sign in to comment.