cbef
is a simple, gitops capability provider for Couchbase eventing functions.
In production projects where code reliability is a key consideration, it is essential to control and review the implemented processes using Git.
cbef
facilitates GitOps support for the operations performed within eventing functions.
Moreover, to ensure the seamless functionality of eventing functions before deploying to the live environment, testing support is provided. This testing ensures that the functions operate as expected, offering confidence in their reliability.
In contrast to operations carried out through the UI, transitioning to a new function version is designed to be zero-downtime, allowing for rapid rollback if needed. The inclusion of revision history support further enhances the ability to track and manage changes effectively.
Note: Precompiled cbef for all arch types is available in the releases page.
Clone the cbef
repository from the given GitHub URL
git clone https://github.com/trendyol/cbef
Change the current working directory to the cbef
directory
cd cbef
Update function settings
nano ./examples/functions/basic.json
Note: JavaScript eventing code file is found automatically.
Update function file
nano ./examples/functions/basic.js
Note: If you need to example eventing functions code, click here to read official Couchbase documentation.
Download dependencies
go mod tidy
Set the environment variable CONFIG_FILE
to the path of the basic.json
configuration file
export CONFIG_FILE=./examples/functions/basic.json
Set the environment variable CI_COMMIT_AUTHOR
to the value foo
, representing the author of the commit
export CI_COMMIT_AUTHOR=foo
Run the Go program located in the cmd
directory
go run ./cmd
Pull latest image
docker pull ghcr.io/trendyol/cbef:1.0.2-amd64
Run latest image
docker run --platform=linux/amd64 ghcr.io/trendyol/cbef:1.0.2-amd64
Note: All images available in the packages page.
Just open a new repository and copy the examples folder.
The structure in examples/.gitlab-ci.yml
will help you deploy your eventing function.
Also, you can store cluster connection secrets as masked and protected in ci/cd variables.
Configurations that can be used in files with
.json
extension located in the functions folder
Field | Description | Value Type | Required | Options |
---|---|---|---|---|
cluster | Couchbase connection configurations | object | β | |
cluster.connection_string | Couchbase cluster connection string | string | β | env supported with {{ENV}} |
cluster.user | Username for cluster authentication | string | β | env supported with {{ENV}} |
cluster.pass | Password for cluster authentication | string | β | env supported with {{ENV}} |
name | Function name | string | β | |
metadata_keyspace | Metadata keyspace configurations | object | β | |
metadata_keyspace.bucket | Metadata bucket name | string | β | |
metadata_keyspace.scope | Metadata scope name | string | β | |
metadata_keyspace.collection | Metadata collection name | string | β | |
source_keyspace | Source keyspace configurations | object | β | |
source_keyspace.bucket | Source bucket name | string | β | |
source_keyspace.scope | Source scope name | string | β | |
source_keyspace.collection | Source collection name | string | β | |
bucket_bindings | Bucket bindings configurations | object array | β | |
bucket_bindings.alias | Alias for bucket binding | string | β | |
bucket_bindings.bucket | Target bucket name for binding | string | β | |
bucket_bindings.scope | Target scope name for binding | string | β | |
bucket_bindings.collection | Target collection name for binding | string | β | |
bucket_bindings.access | Access level for binding | string | β | r (read-only), rw (read-write) |
url_bindings | URL bindings configurations | object array | β | |
bucket_bindings.hostname | Hostname for URL binding | string | β | |
bucket_bindings.alias | Alias for URL binding | string | β | |
bucket_bindings.allow_cookies | Allow cookies for URL binding | bool | β | |
bucket_bindings.validate_ssl_certificate | Validate SSL certificate for URL binding | bool | β | |
bucket_bindings.auth | Authentication configurations for URL binding | object | β | |
bucket_bindings.auth.type | Authentication type for URL binding | string | β | basic, digest, bearer |
bucket_bindings.auth.user | Username for URL binding authentication | string | β | |
bucket_bindings.auth.pass | Password for URL binding authentication | string | β | |
bucket_bindings.auth.token | Token for URL binding authentication | string | β | |
constant_bindings | Constant bindings configurations | object array | β | |
constant_bindings.alias | Alias for constant binding | string | β | |
constant_bindings.literal | Literal value for constant binding | string | β | |
settings | Function configurations | object | β | |
settings.dcp_stream_boundary | The preferred deployment time feed boundary for the function | string | β | everything, from_now |
settings.description | Description for function | string | β | |
settings.log_level | Granularity of system events being captured in the log | string | β | INFO, ERROR, WARNING, DEBUG, TRACE |
settings.query_consistency | Consistency level of N1QL statements in the function | uint | β | 1 (NotBounded), 2 (RequestPlus) |
settings.worker_count | Number of workers per node to process the events | uint | β | |
settings.language_compatibility | Language compatibility of the function | string | β | 6.0.0, 6.5.0, 6.6.2 |
settings.execution_timeout | Time after which the function's execution will be timed out | uint (seconds) | β | |
settings.timer_context_size | Maximum allowed value of the timer context size in bytes | uint | β |