0.2.38 • Published 5 months ago

@datocms/cubo v0.2.38

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Cubo CLI

Cubo is an opinionated CLI designed to simplify the deployment and management of containerized applications on AWS EKS. It serves as a local or CI/CD automation tool—your cluster remains lean, running only plain Kubernetes resources and your app.

With a "convention over configuration" approach, Cubo reads a single JSON manifest (cubo.json5) to:

  • Build and deploy your app:
    • Support multiple environments targeting different clusters
    • Choose between rolling or recreate deployment strategies
  • Wrap common kubectl commands with a Heroku-like developer experience:
    • Run remote commands (cubo run and cubo run:detached)
    • Toggle maintenance mode (cubo maintenance:on and cubo maintenance:off)
    • Manage processes (cubo ps:scale, cubo ps:restart, etc.)
    • Manage environment variables (cubo config:set, cubo config:unset, etc.)
    • View/filter logs (cubo logs)

K8S requirements

To support Cubo deployments, your EKS Kubernetes cluster must have the following components installed:

  • KEDA: Enables event-driven autoscaling based on external metrics.
  • External Secrets: Manages secrets by syncing them from AWS Secrets Manager.

What You Can Do

Cubo allows you to define and manage different types of workloads:

  • HTTP servers: Exposed via AWS ALB, with optional autoscaling (CPU or queue-time based)
  • Workers: Long-running services with autoscaling (CPU or custom metrics, like queue latency)
  • Cron jobs: Schedule recurring tasks with safe concurrency controls
  • TCP/UDP servers: Exposed via AWS NLB for lower-level protocols

Installation

$ npm i --save-dev @datocms/cubo
$ cubo --help

Configuration via cubo.json5

All configuration for your deployment is handled through a single cubo.json5 file. This file defines how your services are built, deployed, and scaled.

To see all available configuration options and their structure, refer to the JSON Schema:

{
  "$schema": "https://unpkg.com/@datocms/cubo@<VERSION>/schemas/cubo-config-schema.json",
  // ...
}

Secrets Management

Cubo integrates AWS Secrets Manager and the External Secrets Operator to keep your environment variables secure and out of your codebase.

  • Create an AWS Secret with the exact name of your Kubernetes namespace (as defined by environment.kubernetes.namespace in your Cubo config).
  • Store your environment variables as a top-level JSON object in the secret.
  • Include a .dockerconfigjson key with your Docker auth JSON if pulling from private registries.

queueTime Scale Strategy

For deployments classified as web, you can implement a scaling strategy based on request queue times. When a request reaches your application, it will include the X-Request-Start header, indicating when the request first entered the proxy queue.

Your application must respond with an X-Queue-Time header. This value should represent the time difference between the current server time and the timestamp provided in X-Request-Start, effectively measuring how long the request waited in the queue.

These queue times are emitted as a StatsD metric via UDP, using the following format:

cloudwatch.cubo.http_queue_time.namespace.${environment.kubernetes.namespace}.deployment.${deploymentName}.storage-resolution.1

The StatsD server aggregates these values into a 30-second average, and forwards the result to CloudWatch. From there, a KEDA ScaledObject uses the queue time data to automatically scale your application based on traffic pressure.

api Scale Strategy

For deployments classified as background, you can implement a scaling strategy based on custom application metrics (such as queue latency). Your application must expose a JSON endpoint that provides the relevant metric.

A KEDA ScaledObject will periodically query this endpoint and use the reported value to drive autoscaling decisions, allowing your background processes to scale dynamically in response to workload demands.


Development

To publish a new cubo version:

$ np
0.2.38

5 months ago

0.2.37

5 months ago

0.2.36

5 months ago

0.2.35

5 months ago

0.2.34

6 months ago

0.2.33

6 months ago

0.2.32

6 months ago

0.2.31

6 months ago

0.2.30

6 months ago

0.2.29

6 months ago

0.2.28

6 months ago

0.2.27

6 months ago

0.2.26

6 months ago

0.2.25

6 months ago

0.2.24

6 months ago

0.2.23

6 months ago

0.2.22

6 months ago

0.2.21

6 months ago

0.2.20

6 months ago

0.2.19

6 months ago

0.2.18

6 months ago

0.2.17

6 months ago

0.2.16

6 months ago

0.2.15

6 months ago

0.2.13

6 months ago

0.2.12

6 months ago

0.2.11

6 months ago

0.2.10

6 months ago

0.2.9

6 months ago

0.2.8

6 months ago

0.2.7

6 months ago

0.2.6

6 months ago

0.2.5

6 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.44

7 months ago

0.1.43

7 months ago

0.1.42

7 months ago

0.1.41

7 months ago

0.1.40

7 months ago

0.1.39

7 months ago

0.1.37

7 months ago

0.1.36

7 months ago

0.1.35

7 months ago

0.1.34

7 months ago

0.1.33

7 months ago

0.1.32

7 months ago

0.1.31

7 months ago

0.1.30

7 months ago

0.1.29

7 months ago

0.1.28

7 months ago

0.1.27

7 months ago

0.1.26

7 months ago

0.1.25

7 months ago

0.1.22

7 months ago

0.1.21

7 months ago

0.1.20

7 months ago

0.1.19

7 months ago

0.1.18

7 months ago

0.1.17

7 months ago

0.1.16

7 months ago

0.1.15

7 months ago

0.1.14

7 months ago

0.1.13

7 months ago

0.1.12

7 months ago

0.1.11

7 months ago

0.1.10

7 months ago

0.1.9

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago