|
| 1 | +# Deploying Add-ons |
| 2 | + |
| 3 | +The goal of `deis addons` is to give users the power to provision consumable services such as |
| 4 | +a postgres database, a minio bucket, or a logstash connection) to their applications. `deis addons` |
| 5 | +can work with both common on-premise services such as a local mysql database or a Redis server |
| 6 | +for a "private" or on-premise service registry, or with public SaaS applications such as MongoLab |
| 7 | +or Papertrail for a public service offering. |
| 8 | + |
| 9 | +`deis addons` is backed by a project called [service-catalog][]. Service-catalog brings integration |
| 10 | +with [service brokers][] to the Kubernetes ecosystem via the [Open Service Broker API][]. |
| 11 | + |
| 12 | +Users of Workflow use `deis addons` to provision an add-on offered by [service brokers][] for |
| 13 | +their applications. The end-goal is to provide a way for users to consume services from brokers and |
| 14 | +have their applications use those services without needing detailed knowledge about how those |
| 15 | +services are created or managed. |
| 16 | + |
| 17 | +As an example, most applications deployed by Workflow need a data store of some kind. `deis addons` |
| 18 | +allows applications to consume services like databases that exist somewhere via common environment |
| 19 | +variables like `DATABASE_URL`. |
| 20 | + |
| 21 | +## Listing Available Add-ons |
| 22 | + |
| 23 | +A user can use `deis addons:list` to see if they have a database provisioned and what plan it is |
| 24 | +using. |
| 25 | + |
| 26 | +``` |
| 27 | +$ deis addons:list | grep -i postgresql |
| 28 | +$ deis-postgresql:standard |
| 29 | +``` |
| 30 | + |
| 31 | +If the application doesn’t yet have a database provisioned, a user can create a new database using |
| 32 | +the CLI. |
| 33 | + |
| 34 | +If a user wishes to see all available addons, they can use `deis addons:services`. |
| 35 | + |
| 36 | +``` |
| 37 | +$ deis addons:services |
| 38 | +slug name |
| 39 | +--------------- ---------------------- |
| 40 | +bonsai Bonsai Elasticsearch |
| 41 | +deis-postgresql Deis Workflow Postgres |
| 42 | +librato Librato |
| 43 | +``` |
| 44 | + |
| 45 | +## Provisioning the Add-on |
| 46 | + |
| 47 | +Most service brokers offers a variety of plans, usually spread across different tiers of service: |
| 48 | +hobby, standard, premium, and enterprise. For a detailed breakdown on the available plans, check |
| 49 | +the documentation for the applicable service broker to help choose the right service tier for the |
| 50 | +application. |
| 51 | + |
| 52 | +For example, to provision a `standard` plan database: |
| 53 | + |
| 54 | +``` |
| 55 | +$ deis addons:create deis-postgresql:standard --app wooden-rowboat |
| 56 | +Creating deis-postgresql:standard... done |
| 57 | +Attaching deis-postgresql:standard to wooden-rowboat... done, v5 |
| 58 | +``` |
| 59 | + |
| 60 | +Depending on the plan, some services can take some time before it becomes available for use. Use |
| 61 | +`deis addons:wait` to wait for the service to become available. |
| 62 | + |
| 63 | +Once the service has been attached to the application, a DATABASE_URL setting will be available in |
| 64 | +the application's configuration and will contain the URL used to access the newly provisioned |
| 65 | +service. |
| 66 | + |
| 67 | +You can choose the alias that the add-on uses on the application using the `--as` flag. This will |
| 68 | +affect the name of the variable the add-on adds to the application. |
| 69 | + |
| 70 | +``` |
| 71 | +$ deis addons:attach deis-postgresql:standard --app wooden-rowboat --as POSTGRESQL_URL |
| 72 | +Creating deis-postgresql:standard... done |
| 73 | +Attaching deis-postgresql:standard to wooden-rowboat as POSTGRESQL_URL... done, v5 |
| 74 | +``` |
| 75 | + |
| 76 | +## Deprovisioning the Add-on |
| 77 | + |
| 78 | +To deprovision a `standard` plan database: |
| 79 | + |
| 80 | +``` |
| 81 | +$ deis addons:destroy deis-postgresql:standard |
| 82 | +Destroying deis-postgresql:standard... done |
| 83 | +``` |
| 84 | + |
| 85 | +## Attaching the Add-on |
| 86 | + |
| 87 | +Once the add-on is provisioned, it is bound to the user's account and can be bound to any number of |
| 88 | +applications the user has permissions to use. |
| 89 | + |
| 90 | +To attach an add-on to a new or existing application: |
| 91 | + |
| 92 | +``` |
| 93 | +$ deis addons:attach deis-postgresql:standard --app wooden-rowboat |
| 94 | +Attaching deis-postgresql:standard to wooden-rowboat... done, v5 |
| 95 | +``` |
| 96 | + |
| 97 | +Similar to `addons:create`, you can choose the alias that the add-on uses on the application using |
| 98 | +the `--as` flag. |
| 99 | + |
| 100 | +## Detaching the Add-on |
| 101 | + |
| 102 | +Similarly, an add-on can be unbound from an application, but still be available to the user for |
| 103 | +future binding to another application. |
| 104 | + |
| 105 | +``` |
| 106 | +$ deis addons:detach deis-postgresql:standard --app wooden-rowboat |
| 107 | +Detaching deis-postgresql:standard from wooden-rowboat... done, v6 |
| 108 | +``` |
| 109 | + |
| 110 | + |
| 111 | +[Open Service Broker API]: https://github.com/openservicebrokerapi/servicebroker |
| 112 | +[service-catalog]: https://github.com/kubernetes-incubator/service-catalog |
| 113 | +[service brokers]: ../reference-guide/terms.md#service-broker |
0 commit comments