Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #193 from ripienaar/gh_actions
Browse files Browse the repository at this point in the history
mention github actions
  • Loading branch information
ripienaar authored May 13, 2020
2 parents d2c430e + d02ad5a commit 7d652e9
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7d652e9

Please sign in to comment.