├── log └── .keep ├── lib ├── tasks │ └── .keep ├── settings.rb ├── exceptions.rb ├── container_images.rb ├── container_lifecycle.rb ├── cloud_controller_http_client.rb ├── configuration.rb ├── uaa_session.rb ├── request_response_logger.rb └── docker_host_port_allocator.rb ├── app ├── models │ ├── concerns │ │ └── .keep │ ├── catalog.rb │ ├── container_manager.rb │ ├── service.rb │ ├── plan.rb │ ├── credentials.rb │ └── docker_manager.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── application_controller.rb │ ├── v2 │ │ ├── catalogs_controller.rb │ │ ├── base_controller.rb │ │ ├── service_bindings_controller.rb │ │ └── service_instances_controller.rb │ └── manage │ │ ├── auth_controller.rb │ │ └── instances_controller.rb ├── assets │ ├── stylesheets │ │ ├── application.css.scss │ │ └── cf-containers-broker.css │ └── images │ │ ├── favicon.ico │ │ └── icon-container.png └── views │ ├── errors │ ├── not_authorized.html.erb │ └── approvals_error.html.erb │ ├── layouts │ └── application.html.erb │ └── manage │ └── instances │ └── show.html.erb ├── .rspec ├── bin ├── rake ├── bundle ├── rails ├── fetch_container_images ├── update_all_containers └── run.sh ├── config ├── unicorn.conf.rb ├── boot.rb ├── environment.rb ├── initializers │ ├── wrap_parameters.rb │ ├── secret_token.rb │ └── omniauth.rb ├── routes.rb ├── environments │ ├── development.rb │ ├── test.rb │ ├── assets.rb │ └── production.rb ├── application.rb └── settings.yml ├── config.ru ├── .travis.yml ├── Rakefile ├── Gemfile ├── .dockerignore ├── .gitignore ├── spec ├── lib │ ├── container_images_spec.rb │ ├── cloud_controller_http_client_spec.rb │ ├── configuration_spec.rb │ ├── request_response_logger_spec.rb │ ├── docker_host_port_allocator_spec.rb │ └── uaa_session_spec.rb ├── controllers │ ├── v2 │ │ ├── catalogs_controller_spec.rb │ │ ├── service_bindings_controller_spec.rb │ │ └── service_instances_controller_spec.rb │ └── manage │ │ ├── auth_controller_spec.rb │ │ └── instances_controller_spec.rb ├── spec_helper.rb ├── support │ └── controller_helpers.rb └── models │ ├── catalog_spec.rb │ ├── plan_spec.rb │ ├── container_manager_spec.rb │ ├── service_spec.rb │ └── credentials_spec.rb ├── Dockerfile ├── SYSLOG_DRAIN.md ├── SETTINGS.md ├── CREDENTIALS.md ├── Gemfile.lock ├── DOCKER.md ├── README.md └── LICENSE /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format progress 3 | --profile 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | @import 'pivotal-styles-full'; 2 | @import 'cf-containers-broker'; 3 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudfoundry-community/cf-containers-broker/HEAD/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/icon-container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudfoundry-community/cf-containers-broker/HEAD/app/assets/images/icon-container.png -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/unicorn.conf.rb: -------------------------------------------------------------------------------- 1 | # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete documentation. 2 | worker_processes 1 3 | listen 80 4 | timeout 120 5 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | CfContainersBroker::Application.initialize! 6 | -------------------------------------------------------------------------------- /bin/fetch_container_images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path('../../config/application', __FILE__) 4 | require 'container_images' 5 | 6 | Rails.logger = Logger.new(STDOUT) 7 | ContainerImages.fetch 8 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | class ApplicationController < ActionController::Base 4 | protect_from_forgery 5 | end 6 | -------------------------------------------------------------------------------- /bin/update_all_containers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path('../../config/application', __FILE__) 4 | require 'container_lifecycle' 5 | 6 | Rails.logger = Logger.new(STDOUT) 7 | ContainerLifecycle.update_all 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | 3 | branches: 4 | only: 5 | - master 6 | 7 | rvm: 8 | - 2.5 9 | 10 | bundler_args: --deployment --without development 11 | 12 | script: bundle exec rspec spec 13 | 14 | sudo: false 15 | 16 | cache: bundler 17 | -------------------------------------------------------------------------------- /app/views/errors/not_authorized.html.erb: -------------------------------------------------------------------------------- 1 |
6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | CfContainersBroker::Application.load_tasks 7 | -------------------------------------------------------------------------------- /lib/settings.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | ENV['SETTINGS_PATH'] ||= File.expand_path('../../config/settings.yml', __FILE__) 4 | 5 | class Settings < Settingslogic 6 | source ENV['SETTINGS_PATH'] 7 | namespace Rails.env 8 | end 9 | -------------------------------------------------------------------------------- /app/controllers/v2/catalogs_controller.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | class V2::CatalogsController < V2::BaseController 4 | def show 5 | render status: 200, json: { services: Catalog.services.map { |service| service.to_hash } } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Fetch Containers Images 4 | if [[ "${SKIP_FETCHING_IMAGES:-X}" == "X" ]]; then 5 | echo "Fetching Containers Images..." 6 | bin/fetch_container_images 7 | else 8 | echo "Skipping fetching container images." 9 | fi 10 | 11 | # Start CF-Containers-Broker 12 | echo "Starting CF-Containers-Broker..." 13 | $@ 14 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper 4 | 5 | # Enable parameter wrapping for JSON. 6 | # ActiveSupport.on_load(:action_controller) do 7 | # wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 8 | # end 9 | 10 | -------------------------------------------------------------------------------- /lib/exceptions.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | module Exceptions 4 | class ArgumentError < StandardError; end 5 | class BackendError < StandardError; end 6 | class NotFound < StandardError; end 7 | class NotImplemented < StandardError; end 8 | class NotSupported < StandardError; end 9 | end 10 | -------------------------------------------------------------------------------- /lib/container_images.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | require Rails.root.join('app/models/catalog') 4 | 5 | module ContainerImages 6 | extend self 7 | 8 | def fetch 9 | Rails.logger.info('Looking for container images at the Services Catalog') 10 | Catalog.plans.each do |plan| 11 | plan.container_manager.fetch_image 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/container_lifecycle.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | require Rails.root.join('app/models/catalog') 4 | 5 | module ContainerLifecycle 6 | extend self 7 | 8 | def update_all 9 | Rails.logger.info('Updating all labeled containers') 10 | Catalog.plans.each do |plan| 11 | plan.container_manager.update_all_containers 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/errors/approvals_error.html.erb: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | ruby '~> 2.5.5' 4 | 5 | gem 'rails', '~> 4' 6 | gem 'rails-api' 7 | gem 'settingslogic' 8 | gem 'omniauth-uaa-oauth2' 9 | gem 'nats' 10 | gem 'sass-rails', '>= 6.0.0' 11 | gem 'docker-api' 12 | gem 'tzinfo-data' 13 | 14 | group :production do 15 | gem 'unicorn' 16 | gem 'lograge' 17 | end 18 | 19 | group :development, :test do 20 | gem 'rspec-rails' 21 | end 22 | 23 | group :development do 24 | gem 'guard-rails' 25 | gem 'shotgun' 26 | end 27 | 28 | group :test do 29 | gem 'webmock' 30 | end 31 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | CfContainersBroker::Application.routes.draw do 2 | namespace :v2 do 3 | resource :catalog, only: [:show] 4 | resources :service_instances, only: [:update, :patch, :destroy] do 5 | resources :service_bindings, only: [:update, :destroy] 6 | end 7 | end 8 | 9 | namespace :manage do 10 | get 'auth/cloudfoundry/callback' => 'auth#create' 11 | get 'auth/failure' => 'auth#failure' 12 | get 'instances/:service_guid/:plan_guid/:instance_guid' => 'instances#show', :as => :instance 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | .DS_Store 7 | .idea 8 | .git/ 9 | 10 | # Ignore bundler config. 11 | /.bundle 12 | 13 | # Ignore the default SQLite database. 14 | /db/*.sqlite3 15 | /db/*.sqlite3-journal 16 | 17 | # Ignore all logfiles and tempfiles. 18 | /log/*.log 19 | /tmp 20 | 21 | # Ignore vendored gems 22 | vendor/bundle/ 23 | vendor/cache/ 24 | public/assets/ 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | .DS_Store 7 | .idea 8 | 9 | # Ignore bundler config. 10 | /.bundle 11 | 12 | # Ignore the default SQLite database. 13 | /db/*.sqlite3 14 | /db/*.sqlite3-journal 15 | 16 | # Ignore all logfiles and tempfiles. 17 | /log/*.log 18 | /tmp 19 | 20 | # Ignore vendored gems 21 | vendor/bundle/ 22 | vendor/cache/ 23 | public/assets/ 24 | 25 | # Ignore developer's settings files 26 | config/settings.*.yml 27 | -------------------------------------------------------------------------------- /app/models/catalog.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | require Rails.root.join('lib/settings') 4 | require Rails.root.join('app/models/service') 5 | 6 | class Catalog 7 | class << self 8 | def find_service_by_guid(service_guid) 9 | services.find { |service| service.id == service_guid } 10 | end 11 | 12 | def services 13 | (Settings['services'] || []).map { |attrs| Service.build(attrs) } 14 | end 15 | 16 | def find_plan_by_guid(plan_guid) 17 | plans.find { |plan| plan.id == plan_guid } 18 | end 19 | 20 | def plans 21 | services.map { |service| service.plans }.flatten 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | CfContainersBroker::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | # config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | end 22 | -------------------------------------------------------------------------------- /spec/lib/container_images_spec.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | require 'spec_helper' 4 | 5 | describe ContainerImages do 6 | let(:subject) { described_class } 7 | let(:plans) { [plan] } 8 | let(:plan) { double('Plan') } 9 | let(:container_manager) { double('ContainerManager') } 10 | 11 | describe '#fetch' do 12 | it 'fetches the image using the container manager' do 13 | expect(Catalog).to receive(:plans).and_return(plans) 14 | expect(plan).to receive(:container_manager).and_return(container_manager) 15 | expect(container_manager).to receive(:fetch_image) 16 | 17 | subject.fetch 18 | end 19 | 20 | context 'when the catalog is empty' do 21 | it 'does nothing' do 22 | expect(Catalog).to receive(:plans).and_return([]) 23 | 24 | subject.fetch 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure your secret_key_base is kept private 11 | # if you're sharing your code publicly. 12 | 13 | # Although this is not needed for an api-only application, rails4 14 | # requires secret_key_base or secret_token to be defined, otherwise an 15 | # error is raised. 16 | # Using secret_token for rails3 compatibility. Change to secret_key_base 17 | # to avoid deprecation warning. 18 | # Can be safely removed in a rails3 api-only application. 19 | CfContainersBroker::Application.config.secret_key_base = ENV['SECRET_TOKEN'] || 'none' 20 | -------------------------------------------------------------------------------- /lib/cloud_controller_http_client.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | class CloudControllerHttpClient 4 | attr_reader :auth_header 5 | 6 | def initialize(auth_header = nil) 7 | @auth_header = auth_header 8 | end 9 | 10 | def get(path) 11 | uri = cc_uri(path) 12 | http = build_http(uri) 13 | 14 | request = Net::HTTP::Get.new(uri) 15 | request['Authorization'] = auth_header 16 | 17 | response = http.request(request) 18 | 19 | JSON.parse(response.body) 20 | end 21 | 22 | private 23 | 24 | def cc_uri(path) 25 | URI.parse("#{Settings.cc_api_uri.gsub(/\/$/, '')}/#{path.gsub(/^\//, '')}") 26 | end 27 | 28 | def build_http(uri) 29 | http = Net::HTTP.new(uri.hostname, uri.port) 30 | http.use_ssl = uri.scheme == 'https' 31 | http.verify_mode = Settings.skip_ssl_validation ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER 32 | 33 | http 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/configuration.rb: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # Copyright (c) 2014 Pivotal Software, Inc. All Rights Reserved. 3 | module Configuration 4 | extend self 5 | 6 | def documentation_url 7 | Settings.services.first.metadata.documentationUrl rescue nil 8 | end 9 | 10 | def support_url 11 | Settings.services.first.metadata.supportUrl rescue nil 12 | end 13 | 14 | def manage_user_profile_url 15 | "#{auth_server_url}/profile" 16 | end 17 | 18 | def auth_server_url 19 | cc_api_info['authorization_endpoint'] 20 | end 21 | 22 | def token_server_url 23 | cc_api_info['token_endpoint'] 24 | end 25 | 26 | def clear 27 | store.clear 28 | end 29 | 30 | private 31 | 32 | def cc_api_info 33 | return store[:cc_api_info] unless store[:cc_api_info].nil? 34 | 35 | cc_client = CloudControllerHttpClient.new 36 | response = cc_client.get('/info') 37 | 38 | store[:cc_api_info] = response 39 | end 40 | 41 | def store 42 | @store ||= {} 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.3.3 2 | LABEL maintainers Ferran Rodenas| Field | 18 |Required | 19 |Type | 20 |Description | 21 |
|---|---|---|---|
| syslog_drain_port | 24 |N | 25 |String | 26 |Container port to be exposed (format: port</protocol>). | 27 |
| syslog_drain_protocol | 30 |N | 31 |String | 32 |Syslog protocol (syslog, syslog-tls, https). | 33 |
Service: <%= @service_name %>
7 |Plan: <%= @plan_name %>
8 |Instance GUID: <%= @instance_guid %>
9 |Provider: <%= @instance_provider %>
10 | <% if @instance_details && !@instance_details.empty? %> 11 | <% @instance_details.each do |title, details| %> 12 |<%= title %>:
13 || User | 41 |PID | 42 |PPID | 43 |C | 44 |Start Time | 45 |Time | 46 |TTY | 47 |Command | 48 |
|---|---|---|---|---|---|---|---|
| <%= process['UID'] %> | 54 |<%= process['PID'] %> | 55 |<%= process['PPID'] %> | 56 |<%= process['C'] %> | 57 |<%= process['STIME'] %> | 58 |<%= process['TTY'] %> | 59 |<%= process['TIME'] %> | 60 |<%= process['CMD'] %> | 61 |
<%= @instance_stdout %>73 |
<%= @instance_stderr %>82 |
| Field | 11 |Required | 12 |Type | 13 |Description | 14 |
|---|---|---|---|
| auth_username | 17 |Y | 18 |String | 19 |Username for authentication access to the service broker. | 20 |
| auth_password | 23 |Y | 24 |String | 25 |Password for authentication access to the service broker. | 26 |
| cookie_secret | 29 |Y | 30 |String | 31 |Session secret key for Rack::Session::Cookie. | 32 |
| session_expiry | 35 |Y | 36 |String | 37 |Session expiry for Rack::Session::Cookie. | 38 |
| cc_api_uri | 41 |Y | 42 |String | 43 |Cloud Foundry API URI. | 44 |
| external_ip | 47 |Y | 48 |String | 49 |Broker external IP address | 50 |
| external_host | 53 |Y | 54 |String | 55 |Hostname to use when exposing the dashboard url. | 56 |
| ssl_enabled | 59 |N | 60 |Boolean | 61 |Set if the service broker must use SSL or not (`false` by default). | 62 |
| skip_ssl_validation | 65 |N | 66 |Boolen | 67 |Set if the service broker must skip SSL validation or not when connecting to the CC API (`false` by 68 | default). | 69 |
| host_directory | 72 |Y | 73 |String | 74 |Host directory prefix to use when containers bind a volume to a host directory. | 75 |
| max_containers | 78 |N | 79 |String | 80 |Maximum number of containers allowed to provision. If not set or if the value is 0, it would mean users can 81 | provision unlimited containers. | 82 |
| allocate_docker_host_ports | 85 |N | 86 |Boolean | 87 |Allocate automatically host ports when binding a Docker container. This is useful in order to preserve the container exposed host ports in case of a VM restart. | 88 |
| services | 91 |Y | 92 |Array | 93 |Services that the service broker provides [1]. | 94 |
| services.plans | 97 |Y | 98 |Array | 99 |Service Plans that the service broker provides [2]. | 100 |
| Field | 16 |Required | 17 |Type | 18 |Description | 19 |
|---|---|---|---|
| credentials | 22 |N | 23 |Hash | 24 |Credentials properties. | 25 |
| credentials.username | 28 |N | 29 |Hash | 30 |Properties to build the `username` credentials field [1]. | 31 |
| credentials.username.key | 34 |N | 35 |String | 36 |Name of the environment variable to pass to the container to set the service username. | 37 |
| credentials.username.value | 40 |N | 41 |String | 42 |Username to send to the container via the environment variable. If not set, and 43 | `credentials.username.key` is set, the broker will create a random username. | 44 |
| credentials.password | 47 |N | 48 |Hash | 49 |Properties to build the `password` credentials field [1]. | 50 |
| credentials.password.key | 53 |N | 54 |String | 55 |Name of the environment variable to pass to the container to set the service password. | 56 |
| credentials.password.value | 59 |N | 60 |String | 61 |Password to send to the container via the environment variable. If not set, and 62 | `credentials.password.key` is set, the broker will create a random password. | 63 |
| credentials.dname | 66 |N | 67 |Hash | 68 |Properties to build the `dbname` to append to the `uri` credentials field [1]. | 69 |
| credentials.dbname.key | 72 |N | 73 |String | 74 |Name of the environment variable to pass to the container to set the service dbname. | 75 |
| credentials.dbname.value | 78 |N | 79 |String | 80 |Dbname to send to the container via the environment variable. If not set, and 81 | `credentials.dbname.key` is set, the broker will create a random dbname. | 82 |
| credentials.uri | 85 |N | 86 |Hash | 87 |Properties to build the `uri` credentials field [1]. | 88 |
| credentials.uri.prefix | 91 |N | 92 |String | 93 |Prefix (ie `dbtype`) to add at the `uri` part of the credentials. | 94 |
| credentials.uri.port | 97 |N | 98 |String | 99 |Container port to be exposed at the the `uri` part of the credentials (format: port</protocol>). The 100 | broker will translate this port to the real exposed host port. This field is not required unless your container 101 | exposes more than 1 port (ie the server port and the web ui port) and you just want to send one of them to the 102 | application binding. | 103 |
| Field | 54 |Required | 55 |Type | 56 |Description | 57 |
|---|---|---|---|
| container | 60 |Y | 61 |Hash | 62 |Properties of the container to deploy. | 63 |
| container.backend | 66 |Y | 67 |String | 68 |Container Backend. It must be `docker`. | 69 |
| container.image | 72 |Y | 73 |String | 74 |Name of the image fo fetch and run. The image will be pre-fetched at broker startup. | 75 |
| container.tag | 78 |N | 79 |String | 80 |Tag of the image. If not set, it will use `latest` by default. | 81 |
| container.command | 84 |N | 85 |String | 86 |Command to run the container (including arguments). | 87 |
| container.entrypoint | 90 |N | 91 |Array of Strings | 92 |Entrypoint for the container (only if you want to override the default entrypoint set by the image). | 93 |
| container.workdir | 96 |N | 97 |String | 98 |Working directory inside the container. | 99 |
| container.restart | 102 |N | 103 |String | 104 |Restart policy to apply when a container exits (no, on-failure, always). If not set, 105 | it will use `always` by default. The restart policy will apply also in case the VM hosting the container is 106 | killed and CF/BOSH resurrects it. Might happen that the new VM gets a new IP address, and probably the containers 107 | will use a new random port. In order to make any application bound to a container work again, 108 | the user must unbind/bind the application to the service again in order to pick the new IP/port. If you want to preserve the bound host ports, you must set `allocate_docker_host_ports` setting [1]. | 109 |
| container.environment[] | 112 |N | 113 |Array of Strings | 114 |Environment variables to pass to the container. | 115 |
| container.expose_ports[] | 118 |N | 119 |Array of Strings | 120 |Network ports to map from the container to random host ports (format: port</protocol>). If not set, 121 | the broker will inspect the Docker image and it will expose all declared container ports [2] to a random host 122 | port. | 123 |
| container.persistent_volumes[] | 126 |N | 127 |Array of Strings | 128 |Volume mountpoints to bind from the container to a host directory. The broker will create automatically a 129 | host directory and it will bind it to the container volume mountpoint. | 130 |
| container.user | 133 |N | 134 |String | 135 |Username or UID to run the first container process. | 136 |
| container.memory | 139 |N | 140 |String | 141 |Memory limit to assign to the container (format: number<optional unit>, where unit = b, k, m or g). | 142 |
| container.memory_swap | 145 |N | 146 |String | 147 |Memory swap limit to assign to the container (format: number<optional unit>, where unit = b, k, m or g). | 148 |
| container.cpu_shares | 151 |N | 152 |String | 153 |CPU shares to assign to the container (relative weight). | 154 |
| container.privileged | 157 |N | 158 |Boolean | 159 |Enable/disable extended privileges for this container. | 160 |
| container.cap_adds[] | 163 |N | 164 |Array of Strings | 165 |Linux capabilities to add | 166 |
| container.cap_drops[] | 169 |N | 170 |Array of Strings | 171 |Linux capabilities to drop | 172 |