This buildpack allows to deploy Kibana as an app in Cloud Foundry.
You want to automatically connect to an Elasticsearch service.
In this case you have nothing to configure. Just deploy an empty Kibana
file and use a Cloud Foundry manifest.yml
file where you bind a service instance with your app.
The buildpack is only able to do a connection if exactly one service of the same service type (Elasticsearch) is bound to the app. The buildpack finds the service by comparing the service tags (they should be set as "elasticsearch' or "elastic").
You don't want to use pre-defined templates and you deliver all Kibana config files in the expected file structure as described later. You are still able to deliver additional plugins and certificates but you are responsible for the service bindings.
When you deliver config files in the "conf.d" folder no pre-defined templates are applied.
manual Kibana
file:plugins:
- x-pack
certificates:
- elasticsearch
You want to use only some of pre-defined templates and you deliver also some own Kibana config files in the expected file structure. Depending of which templates you use you are responsible for the service bindings or not. You are able to deliver additional plugins and certificates.
When you deliver config files in the "conf.d" folder no pre-defined templates are applied by default. If you still want to use some pre-defined templates you have to explicitly define them in the "Kibana" file.
mixed Kibana
file with automatic binding:config-templates:
- name: cf-kibana
service-instance-name: my-elasticsearch
plugins:
- x-pack
certificates:
- elasticsearch
A Kibana Cloud Foundry App has the following structure:
.
├── certificates
│ └── elasticsearch.crt
├── conf.d
│ ├── my-kibana.yml
│ ├── my-additional-kibana-setting.yml
│ └── my-xpack-settings.yml
├── plugins
│ └── x-pack-6.0.0.gem
├── Kibana
└── manifest.yml
The Kibana
file in the root directory of the app is required. It is used by the buildpack to detect if the app is in fact a Kibana app. Furthermore it allows to configure the buildpack / the deployment of the app in yaml format.
The following settings are allowed:
certificates
: additional certificates to install (array of certificate names, without file extension). Defaults to none.cmd-args
: Additional command line arguments for Kibana. Empty by defaultconfig-templates
: Defines which config templates should be used (array). Defaults to none config.templates.name
: Name of a pre-defined config templateconfig.template.service-instance-name
: Service Instance Name to which should be connected heap-percentage
: Percentage of memory (Total memory - reserved memory) which can be used by the heap memory: Default is 75node-options
: Additional node-js arguments. Empty by default plugins
: Additional plugins to install (array of plugin names). Defaults to none. If you are in a disconnected environment put the plugin binaries into the plugin folder.reserved-memory
: Reserved memory in MB which should not be used by heap memory. Default is 300version
: Version of Kibana to be deployed. Defaults to 6.0.0cf-kibana:
- defines listening port
- connects to cf elasticsearch service-instance
Kibana
file:version: 6.0.0
cmd-args: ""
node-options: ""
reserved-memory: 300
heap-percentage: 75
config-templates:
- name: cf-kibana
service-instance-name: my-elasticsearch
plugins:
- x-pack
certificates:
- elasticsearch
This is the Cloud Foundry application manifest file which is used by cf push
.
This file may be used to set the service binding
Put any additional required certificate in this folder. They will be added to the node-js cacert truststore used by Kibana. You don't have to do further configuration in the Kibana config files.
In the folder conf.d
the Kibana configuration is provided. The folder is optional. All files in this directory are used as part of the Kibana configuration.
Prior to the start of Kibana, all files in this directory are processed by dockerize as templates.
This allows to update the configuration files based on the environment variables provided by Cloud Foundry (e.g. VCAP_APPLICATION, VCAP_SERVICES).
The supported functions for the templates are documented in dockerize - using templates and golang - template.
Put any additional required plugin (.gem or .zip) in this folder. Also define them in the Kibana file.
To deploy the Kibana app to Cloud Foundry using this buildpack, use the following command:
cf push -b https://github.com/swisscom/kibana-buildpack.git
You find more details in the Cloud Foundry documentation
To build this buildpack, run the following command from the buildpack's directory:
Source the .envrc file in the buildpack directory.
source .envrc
To simplify the process in the future, install direnv which will automatically source .envrc when you change directories.
Install buildpack-packager
(cd src/go/vendor/github.com/cloudfoundry/libbuildpack/packager/buildpack-packager && go install)
Build the buildpack
buildpack-packager [ --cached | --uncached ]
Use in Cloud Foundry
Upload the buildpack to your Cloud Foundry and optionally specify it by name
cf create-buildpack [BUILDPACK_NAME] [BUILDPACK_ZIP_FILE_PATH] 1
cf push my_app [-b BUILDPACK_NAME]
Buildpacks use the Cutlass framework for running integration tests.
To test this buildpack, run the following command from the buildpack's directory:
Source the .envrc file in the buildpack directory.
source .envrc
To simplify the process in the future, install direnv which will automatically source .envrc when you change directories.
Run unit tests
./scripts/unit.sh
Run integration tests
./scripts/integration.sh
More information can be found on Github cutlass.
Inspired by the Heroku buildpack and the Go(Lang) Buildpack