mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
GitBook: [master] 60 pages and 12 assets modified
This commit is contained in:
committed by
gitbook-bot
parent
3429cc74ff
commit
0f1d9e01a8
@@ -1,50 +1,51 @@
|
||||
## Configuration Management
|
||||
# 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.
|
||||
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)
|
||||
* [Kubernetes JetStream Controller](https://github.com/nats-io/nack#jetstream-controller)
|
||||
* `nats` CLI with configuration files
|
||||
* [Terraform](https://www.terraform.io/)
|
||||
* [GitHub Actions](https://github.com/features/actions)
|
||||
* [Kubernetes JetStream Controller](https://github.com/nats-io/nack#jetstream-controller)
|
||||
|
||||
### nats Admin CLI
|
||||
## nats Admin CLI
|
||||
|
||||
The `nats` CLI can be used to manage Streams and Consumers easily using it's `--config` flag, for example:
|
||||
|
||||
### Add a new Stream
|
||||
## Add a new Stream
|
||||
|
||||
This creates a new Stream based on `orders.json`. The `orders.json` file can be extracted from an existing stream using `nats stream info ORDERS -j | jq .config`
|
||||
|
||||
```
|
||||
```text
|
||||
$ nats str add ORDERS --config orders.json
|
||||
```
|
||||
|
||||
### Edit an existing Stream
|
||||
## Edit an existing Stream
|
||||
|
||||
This edits an existing stream ensuring it complies with the configuration in `orders.json`
|
||||
```
|
||||
|
||||
```text
|
||||
$ nats str edit ORDERS --config orders.json
|
||||
```
|
||||
|
||||
### Add a New Consumer
|
||||
## Add a New Consumer
|
||||
|
||||
This creates a new Consumer based on `orders_new.json`. The `orders_new.json` file can be extracted from an existing stream using `nats con info ORDERS NEW -j | jq .config`
|
||||
|
||||
```
|
||||
```text
|
||||
$ nats con add ORDERS NEW --config orders_new.json
|
||||
```
|
||||
|
||||
### Terraform
|
||||
## Terraform
|
||||
|
||||
Terraform is a Cloud configuration tool from Hashicorp found at [terraform.io](https://www.terraform.io/), we maintain a Provider for Terraform called [terraform-provider-jetstream](https://github.com/nats-io/terraform-provider-jetstream/) that can maintain JetStream using Terraform.
|
||||
|
||||
#### Setup
|
||||
### Setup
|
||||
|
||||
Our provider is not hosted by Hashicorp so installation is a bit more complex than typical. Browse to the [Release Page](https://github.com/nats-io/terraform-provider-jetstream/releases) and download the release for your platform and extract it into your Terraform plugins directory.
|
||||
|
||||
```
|
||||
```text
|
||||
$ unzip -l terraform-provider-jetstream_0.0.2_darwin_amd64.zip
|
||||
Archive: terraform-provider-jetstream_0.0.2_darwin_amd64.zip
|
||||
Length Date Time Name
|
||||
@@ -58,7 +59,7 @@ Place the `terraform-provider-jetstream_v0.0.2` file in `~/.terraform.d/plugins/
|
||||
|
||||
In your project you can configure the Provider like this:
|
||||
|
||||
```terraform
|
||||
```text
|
||||
provider "jetstream" {
|
||||
servers = "connect.ngs.global"
|
||||
credentials = "ngs_jetstream_admin.creds"
|
||||
@@ -67,7 +68,7 @@ provider "jetstream" {
|
||||
|
||||
And start using it, here's an example that create the `ORDERS` example. Review the [Project README](https://github.com/nats-io/terraform-provider-jetstream#readme) for full details.
|
||||
|
||||
```terraform
|
||||
```text
|
||||
resource "jetstream_stream" "ORDERS" {
|
||||
name = "ORDERS"
|
||||
subjects = ["ORDERS.*"]
|
||||
@@ -103,3 +104,4 @@ output "ORDERS_SUBJECTS" {
|
||||
value = jetstream_stream.ORDERS.subjects
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
### GitHub Actions
|
||||
# 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.
|
||||
|
||||
@@ -53,3 +53,4 @@ jobs:
|
||||
message: Published new deployment via "${{ github.event_name }}" in "${{ github.repository }}"
|
||||
server: js.example.net
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
### Kubernetes JetStream Controller
|
||||
# Kubernetes Controller
|
||||
|
||||
The JetStream controllers allows you to manage NATS JetStream Streams and Consumers via K8S CRDs. You can find more info on how to deploy and usage [here](https://github.com/nats-io/nack#getting-started). Below you can find an example on how to create a stream and a couple of consumers:
|
||||
The JetStream controllers allows you to manage NATS JetStream Streams and Consumers via K8S CRDs. You can find more info on how to deploy and usage [here](https://github.com/nats-io/nack#getting-started). Below you can find an example on how to create a stream and a couple of consumers:
|
||||
|
||||
```yaml
|
||||
---
|
||||
@@ -41,7 +41,7 @@ spec:
|
||||
|
||||
Once the CRDs are installed you can use `kubectl` to manage the streams and consumers as follows:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
$ kubectl get streams
|
||||
NAME STATE STREAM NAME SUBJECTS
|
||||
mystream Created mystream [orders.*]
|
||||
@@ -55,3 +55,4 @@ my-push-consumer Created mystream my-push-consumer none
|
||||
# kubectl describe streams mystream
|
||||
# kubectl describe consumers my-pull-consumer
|
||||
```
|
||||
|
||||
|
||||
2
jetstream/configuration_mgmt/nats-admin-cli.md
Normal file
2
jetstream/configuration_mgmt/nats-admin-cli.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# NATS Admin CLI
|
||||
|
||||
2
jetstream/configuration_mgmt/terraform.md
Normal file
2
jetstream/configuration_mgmt/terraform.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# Terraform
|
||||
|
||||
Reference in New Issue
Block a user