diff --git a/README.md b/README.md index 176411f..f0f21a0 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ JetStream is the [NATS.io](https://nats.io) persistence engine that will support - [Configuration Management](#configuration-management) * [`nats` CLI](#nats-cli) * [Terraform](#terraform) + * [GitHub Actions](#github-actions) - [Model Deep Dive](#model-deep-dive) * [Stream Limits and Retention Modes](#stream-limits-and-retention-modes) * [Acknowledgement Models](#acknowledgement-models) @@ -780,7 +781,14 @@ This Consumer needs no ack, so any new message into the ORDERS system will show ## Configuration Management -In many cases managing the configuration in your application code is the best model, many teams though wish to pre-create Streams and Consumers. We support [Terraform](https://www.terraform.io/) today in addition to the `nats` CLI, more methods might be added in future, these tools can be called by your CI or other Operations Workflows. +In many cases managing the configuration in your application code is the best model, many teams though wish to pre-create Streams and Consumers. + +We support a number of tools to assist with this: + + * `nats` CLI with configuration files + * [Terraform](https://www.terraform.io/) + * [GitHub Actions](https://github.com/features/actions) + ### `nats` CLI @@ -877,6 +885,62 @@ output "ORDERS_SUBJECTS" { } ``` +### GitHub Actions + +We have a pack of GitHub Actions that let you manage an already running JetStream Server, useful for managing releases or standing up test infrastructure. + +Full details and examples are in the [jetstream-gh-actions](https://github.com/nats-io/jetstream-gh-action) repository, here's an example. + +```yaml +on: push +name: orders +jobs: + + # First we delete the ORDERS stream and consumer if they already exist + clean_orders: + runs-on: ubuntu-latest + steps: + - name: orders_stream + uses: nats-io/jetstream-gh-action/delete/stream@master + with: + missing_ok: 1 + stream: ORDERS + server: js.example.net + + # Now we create the Stream and Consumers using the same configuration files the + # nats CLI utility would use as shown above + create_orders: + runs-on: ubuntu-latest + needs: clean_orders + steps: + - uses: actions/checkout@master + - name: orders_stream + uses: nats-io/jetstream-gh-action/create/stream@master + with: + config: ORDERS.json + server: js.example.net + - name: orders_new_consumer + uses: nats-io/jetstream-gh-action/create/consumer@master + with: + config: ORDERS_NEW.json + stream: ORDERS + server: js.example.net + + # We publish a message to a specific Subject, perhaps some consumer is + # waiting there for it to kick off tests + publish_message: + runs-on: ubuntu-latest + needs: create_orders + steps: + - uses: actions/checkout@master + - name: orders_new_consumer + uses: nats-io/jetstream-gh-action@master + with: + subject: ORDERS.deployment + message: Published new deployment via "${{ github.event_name }}" in "${{ github.repository }}" + server: js.example.net +``` + ## Model Deep Dive The Orders example touched on a lot of features, but some like different Ack models and message limits, need a bit more detail. This section will expand on the above and fill in some blanks.