{"id":31904413,"url":"https://github.com/cloudfoundry-community/cf-containers-broker","last_synced_at":"2025-10-13T13:49:43.256Z","repository":{"id":19770405,"uuid":"23028537","full_name":"cloudfoundry-community/cf-containers-broker","owner":"cloudfoundry-community","description":"A generic \"Containers\" broker for the Cloud Foundry v2 services API","archived":false,"fork":false,"pushed_at":"2022-12-14T07:24:03.000Z","size":324,"stargazers_count":38,"open_issues_count":31,"forks_count":31,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-14T22:47:38.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudfoundry-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-16T22:37:02.000Z","updated_at":"2024-02-09T14:28:54.000Z","dependencies_parsed_at":"2023-01-11T20:35:53.284Z","dependency_job_id":null,"html_url":"https://github.com/cloudfoundry-community/cf-containers-broker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudfoundry-community/cf-containers-broker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry-community%2Fcf-containers-broker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry-community%2Fcf-containers-broker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry-community%2Fcf-containers-broker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry-community%2Fcf-containers-broker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudfoundry-community","download_url":"https://codeload.github.com/cloudfoundry-community/cf-containers-broker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfoundry-community%2Fcf-containers-broker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015348,"owners_count":26085686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T13:49:00.247Z","updated_at":"2025-10-13T13:49:43.250Z","avatar_url":"https://github.com/cloudfoundry-community.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Known Vulnerabilities](https://snyk.io/test/github/cloudfoundry-community/cf-containers-broker/badge.svg)](https://snyk.io/test/github/cloudfoundry-community/cf-containers-broker)\n\n# Containers Service Broker for Cloud Foundry\n\nThis is a generic `Containers` broker for the Cloud Foundry [v2 services API](http://docs.cloudfoundry.org/services/api.html).\n\nThis service broker allows users to provision services that runs inside a\n[compatible container backend](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/README.md#prerequisites)\nand bind applications to the service. The management tasks that the broker can perform are:\n\n * Provision a service container with random credentials and service arbitrary parameters\n * Bind a service container to an application:\n    * Expose the credentials to access the provisioned service (see [CREDENTIALS.md](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/CREDENTIALS.md) for details)\n    * Provide a syslog drain service for your application logs (see [SYSLOG_DRAIN.md](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/SYSLOG_DRAIN.md) for details)\n * Unbind a service container from an application\n * Unprovision a service container\n * Expose a service container management dashboard\n\nMore details can be found at this [Pivotal P.O.V Blog post](https://content.pivotal.io/blog/docker-service-broker-for-cloud-foundry).\n\n## Disclaimer\n\nThis is not presently a production ready service broker. This is a work in progress. It is suitable for\nexperimentation and may not become supported in the future.\n\n## Usage\n\n### Prerequisites\n\nThis service broker does not include any container backend. Instead, it is meant to be deployed alongside any\ncompatible container backend, which it manages:\n\n * [Docker](https://www.docker.com/): Instructions to configure the service broker with a Docker backend can be found\n  at [DOCKER.md](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/DOCKER.md).\n\n### Configuration\n\nConfigure the application settings according to the instructions found at [SETTINGS.md](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/SETTINGS.md).\n\n### Run\n\n#### Standalone\n\nStart the service broker:\n\n```\nbundle\nbundle exec rackup\n```\n\nThe service broker will listen by default at port 9292. View the catalog API at [http://localhost:9292/v2/catalog](http://localhost:9292v2/catalog). The basic auth username is `containers` and secret is `secret`.\n\n#### As a Docker container\n\n##### Build the image\n\nThis step is optional, you can use the already built Docker image located at the\n[Docker Hub Registry](https://registry.hub.docker.com/u/frodenas/cf-containers-broker/).\n\nIf you want to create locally the image `frodenas/cf-containers-broker`\n([Dockerfile](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/Dockerfile)) execute the following\ncommand on a local cloned `cf-containers-broker` repository:\n\n```\ndocker build -t frodenas/cf-containers-broker .\n```\n\n##### Run the image\n\nTo run the image and bind it to host port 80:\n\n```\ndocker run -d --name cf-containers-broker \\\n       --publish 80:80 \\\n       --volume /var/run:/var/run \\\n       frodenas/cf-containers-broker\n```\n\nSome aspects of configuration can be overridden with environment variables. See `config/settings.yml` for documentation and environment variables.\n\n```\ndocker run -d --name cf-containers-broker \\\n       --publish 80:80 \\\n       --volume /var/run:/var/run \\\n       -e BROKER_USERNAME=broker \\\n       -e BROKER_PASSWORD=password \\\n       -e EXTERNAL_HOST=localhost \\\n       frodenas/cf-containers-broker\n```\n\nIf you want to override the entire configuration, then create a directory with the configuration files, and mount this directory into the container's `/config` directory:\n\n```\nmkdir -p /tmp/cf-containers-broker/config\ncp config/settings.yml /tmp/cf-containers-broker/config\ncp config/unicorn.conf.rb /tmp/cf-containers-broker/config\nvi /tmp/cf-containers-broker/config/settings.yml\ndocker run -d --name cf-containers-broker \\\n       --publish 80:80 \\\n       --volume /var/run:/var/run \\\n       --volume /tmp/cf-containers-broker/config:/config \\\n       frodenas/cf-containers-broker\n```\n\nIf you want to expose the application logs, create a host directory and mount the container's directory `/app/log`\ninto the previous host directory:\n\n```\nmkdir -p /tmp/cf-containers-broker/logs\ndocker run -d --name cf-containers-broker \\\n       --publish 80:80 \\\n       --volume /var/run:/var/run \\\n       --volume /tmp/cf-containers-broker/logs:/app/log \\\n       frodenas/cf-containers-broker\n```\n\n\n#### Using CF/BOSH\n\nThis service broker can be deployed alongside:\n\n* [Docker CF-BOSH release](https://github.com/cloudfoundry-community/docker-boshrelease) if you plan to use Docker as backend.\n\n### Enable the service broker at your Cloud Foundry environment\n\nAdd the service broker to Cloud Foundry as described by [the service broker documentation](http://docs.cloudfoundry.org/services/managing-service-brokers.html).\n\nA quick way to register the service broker and to enable all service offerings is running:\n\n```\ncf create-service-broker docker-broker containers secret http://\u003cBROKER IP ADDRESS\u003e\nwhile read p __; do\n    cf enable-service-access \"$p\";\ndone \u003c \u003c(cf service-access | awk '/orgs/{y=1;next}y \u0026\u0026 NF' | sort | uniq)\n```\n\n### Bindings\n\nThe way that each service is configured determines how binding credentials are generated.\n\nA service that exposes only a single port and has no other credentials configuration will include the minimal host and port in its credentials:\n\n```json\n{ \"host\": \"10.11.12.13\", \"port\": 61234, \"ports\": [\"8080/tcp\": 61234] }\n```\n\nIn the example above, the container exposed an internal port `8080` and it was bound to port `61234` on the host machine `10.11.12.13`.\n\nIf a service exposes more than a single port, then you must specify the port you want to bind using the `credentials.uri.port` property,\notherwise the binding will not contain a port.\n\n```json\n{ \"host\": \"10.11.12.13\", \"port\": 61234, \"ports\": [\"8080/tcp\": 61234, \"8081/tcp\": 61235] }\n```\n\nIn the example above, the container exposed internal ports `8080` and `8081`, and it was bound to port `61234` on the\nhost machine `10.11.12.13` because the `credentials.uri.port` property was set to `8080/tcp`.\n\nFor more details, see the [CREDENTIALS.md](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/CREDENTIALS.md) file.\n\n#### Self-discovery of host port bindings\n\nOptionally, each exposed host port for an instantiated container will passed into the container via environment variables, if you enable the `enable_host_port_envvar: true` setting.\n\nIf a Docker image exposes an internal port `5432`, then each instantiated container will be provided a `DOCKER_HOST_PORT_5432` environment variable containing the host's port allocation.\n\nImplementation detail: In order to support this feature, provisioning new Docker containers requires two steps:\n\n1. Instantiate a Docker container and allow Docker to allocate host ports.\n2. Restart the Docker container with the additional `DOCKER_HOST_PORT_nnnn` environment variables.\n\nIf you wish to enable this feature, provide `enable_host_port_envvar: true` in `config/settings.yml`.\n\n### Updating Containers\n\nWhen new images become available or configuration of the plans change it can become desirable to restart the running containers to pick up the latest version of their image and/or update their configuration.\n\n`bin/update_all_containers` will attempt to find all running containers managed by the broker and restart them with the latest configuration.\n\nThe mapping between running containers and configured plans is achieved by adding the labels `plan_id` and `instance_id` to the containers at create time. Containers that don't have these labels will be ignored by the update script.\n\nIf you are updating cf-containers-broker from an older version that didn't add the required labels you can force the broker to recreate the containers via `cf update-service \u003cservice-id\u003e`. After this the labels will be available and the `bin/update_all_containers` script will be able to identify the containers for automatic updating.\n\nIn order for `cf update-service \u003cservice-id\u003e` to work the service must declare `plan_updateable: true`.\n\n\n### Tests\n\nTo run all specs:\n\n```\nbundle\nbundle exec rake spec\n```\n\nBe aware that this project does not yet provide a full set of tests. Contributions are welcomed!\n\n## Contributing\n\nIn the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help\nimprove this project.\n\nHere are some ways *you* can contribute:\n\n* by using alpha, beta, and prerelease versions\n* by reporting bugs\n* by suggesting new features\n* by writing or editing documentation\n* by writing specifications\n* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)\n* by refactoring code\n* by closing [issues](https://github.com/cloudfoundry-community/cf-containers-broker/issues)\n* by reviewing patches\n\n\n### Submitting an Issue\n\nWe use the [GitHub issue tracker](https://github.com/cloudfoundry-community/cf-containers-broker/issues) to track bugs and\nfeatures. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You\ncan indicate support for an existing issue by voting it up. When submitting a bug report, please include a\n[Gist](http://gist.github.com/) that includes a stack trace and any details that may be necessary to reproduce the bug,\nincluding your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request\nwith failing specs.\n\n### Submitting a Pull Request\n\n1. Fork the project.\n2. Create a topic branch.\n3. Implement your feature or bug fix.\n4. Commit and push your changes.\n5. Submit a pull request.\n\n## Copyright\n\nSee [LICENSE](https://github.com/cloudfoundry-community/cf-containers-broker/blob/master/LICENSE) for details.\nCopyright (c) 2014 [Pivotal Software, Inc](http://www.gopivotal.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfoundry-community%2Fcf-containers-broker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudfoundry-community%2Fcf-containers-broker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfoundry-community%2Fcf-containers-broker/lists"}