Resource Pool

ResourcePool allows you create pools of reusable resources which you can use during your app deployment.

Examples:

  • You can create a Pool of Subdomains, so that you can pre-allocate URLs which work with any auth (third-party auth's such as google auth only work with configured URLs). So, If your app uses google auth, Now you can pre-allocate URLs in google auth and create resource pool with a list of subdomains, And then dockup can use the subdomain from the resource pool during deployment for the app.

  • You can create a Pool of Database deployments, so that your app deployment can use the the database deployment in your app. Creating and Seeding a database deployment is a time consuming task, Now, you can do that at leisure time so that you can save time during the peak hours.

How To Use?

  • You create a Resource Pool

  • Add a Pool Item

Now you can use Environment Variable Substitutions in your Container Spec for Resource Pool

Dockup will interpolate the DOCKUP_POOL_<RESOURCE_POOL_NAME> with a pool item form the RESOURCE_POOL_NAME Resource during Deployment.

You can even refer the same pool item multiple times in the same container or different containers (in the same blueprint) using the same environment variable.

${DOCKUP_POOL_databases_ID_dbpool} => "foo"
${DOCKUP_POOL_databases_ID_dbpool} => "foo"
# Any number of calls return the same value as long as identifier "dbpool" is same.
‚Äč
${DOCKUP_POOL_databases} => "bar"
# Calling without an identifier will return a new pool item

A Resource Pool can also get it's items from the external endpoints. For that you set the urls for pool items resource and deletion of pool items at pool_items_endpoint and delete_endpoint fields. dockup will call these endpoints when acquiring or releasing a pool item. The external endpoints should follow the below semantics,

  • pool_items_endpoint: dockup will periodically call this endpoint to fetch pool items. It expects server to respond with list of pool_items with the following parameters: value and external_id as a json response and a 200 status code at the callback url passed by the previous request. Example:

    [{
    "value": "http://db1.example.com:8824",
    "external_id": "1"
    }, {
    "value": "http://db2.example.com:8824",
    "external_id": "2"
    }]
  • delete_endpoint: Similarly dockup will make a POST request to the delete endpoint. It expects the service to return a 200 status code.