/

Ephemeral DB, Cache, Queues & Workers for Preview environments

Ephemeral DB, Cache, Queues & Workers for Preview environments

Ephemeral DB, Cache, Queues & Workers for Preview environments

Ephemeral DB, Cache, Queues & Workers for Preview environments

Anand Muthukrishnan

Anand Muthukrishnan

Anand Muthukrishnan

Jul 30, 2025

Using LocalOps, your developer team can already provision standard Kubernetes environments in your cloud account and spin up ephemeral Preview services for each Github pull request. This will unblock your team to test features in isolation and ship changes fast. Without sharing the same staging environment and stepping on each other.

And using ops.json, you can already provision S3 buckets, SQS queues, SNS topics, RDS database, Elastic cache clusters and other cloud resources exclusively for each pull request (Docs). These cloud resources are deleted as soon the PR is closed or merged.

Ephemeral DBs/Cache/queues for each PR:

From today, you can also define dependencies such as Postgres, MySQL, Redis, Memcache in ops.json, specifically for preview services. For each PR, they will get provisioned in your existing environment, locally in its Kubernetes cluster and get de-provisioned automatically when the PR is closed/merged.

Databases:

In ops.json, just go ahead and define previews key and have your dependencies declared.

{
    "previews": {
        "dependencies": {
            "db": [
                {
                    "id": "db",
                    "prefix": "db",
                    "engine": "postgres",
                    "version": "17.5",
                    "exports": {
                        "DB_HOST": "$host",
                        "DB_PORT": "$port",
                        "DB_USER": "$user",
                        "DB_NAME": "$db",
                        "DB_PASS": "$pass"
                    }
                }
            ]
        }
    }
}

All you have to do is to declare the database engine (postgres) and version (17.5). LocalOps will provision them with correct defaults and expose its details via exports so that you can use them in your code via environment variables.

In databases, we support postgres and mysql as of now and you can use any publicly available version published in Dockerhub.

Caching servers:

You can also define caching servers including Redis and Memcache like:

{
    "previews": {
        "dependencies": {
            "db": [
                {
                    "id": "db",
                    "prefix": "db",
                    "engine": "postgres",
                    "version": "17.5",
                    "exports": {
                        "DB_HOST": "$host",
                        "DB_PORT": "$port",
                        "DB_USER": "$user",
                        "DB_NAME": "$db",
                        "DB_PASS": "$pass"
                    }
                }
            ],
            "cache": [
                {
                    "id": "redis",
                    "prefix": "redis",
                    "engine": "redis",
                    "version": "8.0.3",
                    "exports": {
                        "REDIS_HOST": "$host",
                        "REDIS_PORT": "$port"
                    }
                }
            ]
        }
    }
}

LocalOps would provision and de-provision these for every pull request in your environment / Kubernetes cluster as your Preview services is created / destroyed based on the underlying PR.

Queueing / Messaging services:

You can go on to declare queues as well this way. RabbitMQ is supported and we aim to add support for other services soon.

{
    "previews": {
        "dependencies": {
            "db": [
                {
                    "id": "db",
                    "prefix": "db",
                    "engine": "postgres",
                    "version": "17.5",
                    "exports": {
                        "DB_HOST": "$host",
                        "DB_PORT": "$port",
                        "DB_USER": "$user",
                        "DB_NAME": "$db",
                        "DB_PASS": "$pass"
                    }
                }
            ],
            "cache": [
                {
                    "id": "redis",
                    "prefix": "redis",
                    "engine": "redis",
                    "version": "8.0.3",
                    "exports": {
                        "REDIS_HOST": "$host",
                        "REDIS_PORT": "$port"
                    }
                }
            ],
            "queues": [
                {
                    "id": "rabbitmq",
                    "prefix": "rabbitmq",
                    "engine": "rabbitmq",
                    "version": "4.1.2",
                    "exports": {
                        "QUEUE_HOST": "$host",
                        "QUEUE_PORT": "$port",
                        "QUEUE_VHOST": "$vhost",
                        "QUEUE_USER": "$user",
                        "QUEUE_PASS": "$pass"
                    }
                }
            ]
        }
    }
}
Persistence and production:

All these resources don't have persistent storage so we recommend using them only for Pull request previews / preview environments. For production services, you can define RDS or Elastic cache via same ops.json.

Supported services for Preview environments:

You can spin up and spin down any of these services for each PR, using ops.json now.

In-cluster / Inside environment:

Databases

Caching

Queues

Postgres

Redis

RabbitMQ

MySQL

Memcache


Cloud managed services:
  1. S3 buckets

  2. SQS queues

  3. SNS topics

  4. RDS databases

  5. Elastic cache clusters

Learn more in our documentation here - Ephemeral environments and Ops.json.

Get Started with LocalOps for free:

Get started with LocalOps by signing up for a free account here. If you need a 30-min demo, just schedule a call here with our team.

Cheers.