Skip to content

A Docker image for running the Google Cloud PubSub emulator

License

Notifications You must be signed in to change notification settings

raileasyuk/pubsub-emulator-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Google Cloud Pub/Sub Emulator

A Google Cloud Pub/Sub Emulator container image. The image is meant to be used for creating an standalone emulator for testing.

Environment

The following environment variables must be set:

  • PUBSUB_LISTEN_ADDRESS: The address should refer to a listen address, meaning that 0.0.0.0 can be used. The address must use the syntax HOST:PORT, for example 0.0.0.0:8432. The container must expose the port used by the Pub/Sub emulator.
  • PUBSUB_PROJECT_ID: The ID of the Google Cloud project for the emulator.

Connect application with the emulator

The following environment variables need to be set so your application connects to the emulator instead of the production Cloud Pub/Sub environment:

  • PUBSUB_EMULATOR_HOST: The listen address used by the emulator.
  • PUBSUB_PROJECT_ID: The ID of the Google Cloud project used by the emulator.

Custom commands

This image contains a script named start-pubsub (included in the PATH). This script is used to initialize the Pub/Sub emulator.

Starting an emulator

By default, the following command is called:

start-pubsub

Creating a Pub/Sub emulator with Docker Compose

The easiest way to create an emulator with this image is by using Docker Compose. The following snippet can be used as a docker-compose.yml for a Pub/Sub emulator:

version: "2"

services:
  pubsub:
    image: singularities/pubsub-emulator
    environment:
      - PUBSUB_PROJECT_ID=project-test
      - PUBSUB_LISTEN_ADDRESS=0.0.0.0:8432
    ports:
      - "8432:8432"

Persistence

The image has a volume mounted at /opt/data. To maintain states between restarts, mount a volume at this location.

About

A Docker image for running the Google Cloud PubSub emulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%