Giter VIP home page Giter VIP logo

go-pubsub-emulator's Introduction

Google Cloud Pub/Sub Emulator

This repository contains configuration for a Docker image that contains the Google Cloud Pub/Sub emulator. It is Dockerised version of https://cloud.google.com/pubsub/docs/emulator that provides additional options for configuration.

Usage

Command Line

This shell statement shows the basic usage, which will create a Pub/Sub emulator running on port 8085, with a project name of "testproject", a default topic of "testtopic" and a subscription of "testsubscription".

Basic

docker run --rm --publish 8085:8085 jamesblewis/go-pubsub-emulator:latest

Much like jesse's original pkg you can also configure the Pub/Sub project name, topic name, subscription name and exposure port:

docker run --rm --env PUBSUB_PROJECT=myproject --env PUBSUB_TOPIC=mytopic --env PUBSUB_SUBSCRIPTION=mysubscription --env PUBSUB_PORT=10101 --publish 10101:10101 jamesblewis/go-pubsub-emulator:latest

Advanced

This image allows you to specify more complex config via yaml for when you need multiple topics and subscriptions.

docker run --rm --env --mount source=./path/to/your/config,target=config/ --publish 10101:10101 jamesblewis/go-pubsub-emulator:latest

The yaml config should look something like this:

topics:
  topic1:
    - subscription1
    - subscription2
  topic2:
    - subscription3
    - subscription4

Docker Compose

This is the equivalent configuration for docker-compose, with custom environment variables for the project name, topic name, subscription name and Pub/Sub port.

version: '3'
  services:
    pubsub:
      image: jamesblewis/go-pubsub-emulator:latest
      platform: linux/amd64
      environment:
        - PUBSUB_PORT=10101
        - PUBSUB_PROJECT=myproject
        - PUBSUB_TOPIC=mytopic
        - PUBSUB_SUBSCRIPTION=mysubscription

Example with yaml config

To pass your config as yaml simply mount it inside the config folder.

Note that you will still need to pass the port and project as an environment variable but the yaml will override any other environment variable you may set.

version: '3'
  services:
    pubsub:
      image: jamesblewis/go-pubsub-emulator:latest
      platform: linux/amd64
      environment:
        - PUBSUB_PORT=10101
        - PUBSUB_PROJECT=myproject
      volumes:
        - ./pubsub-config.yaml:/config/pubsub.yaml

Attribution

This image is based on jacksonjesse/pubsub-emulator.

go-pubsub-emulator's People

Contributors

jamesblewis avatar jacksonjesse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.