Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koslib/go-nats-demo
Super basic nats example project
https://github.com/koslib/go-nats-demo
go nats nats-messaging
Last synced: about 2 months ago
JSON representation
Super basic nats example project
- Host: GitHub
- URL: https://github.com/koslib/go-nats-demo
- Owner: koslib
- Created: 2020-02-06T13:24:49.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-27T14:48:37.000Z (over 4 years ago)
- Last Synced: 2024-01-05T04:46:34.816Z (about 1 year ago)
- Topics: go, nats, nats-messaging
- Language: Go
- Homepage:
- Size: 336 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-nats-demo
Me, playing around with [nats](https://nats.io/).
Just a simple playground for exploring nats, try proto code and experiment before actually using something in prod.
In the `main.go` file you can find examples for:
1. Setting up a consumer/producer for an async example
2. Setting up a request/reply model example for synchronous messages consumption## Running it
For running locally a nats server through docker:
```
docker run --name nats -p 6222:6222 -p 4222:4222 -p 8222:8222 nats:latest
```For a demonstration of the whole functionality (just logs printing, nothing fancy), you can run:
```
docker-compose up
```and remember to rebuild if you change the code while experimenting:
```
docker-compose up --build
```and when you're done tear down:
```
docker-compose down
```> Note: the docker-compose setup includes two nats services, to showcase a cluster example.
## Nats-operator
### Deploy dummy service on k8s
#### Deploy with custom helm chart
```
helm upgrade --install test http://www.koslib.com/mycharts/servicetpl-0.5.3.tgz -f .chart/values.yaml --wait --set image.tag=
```#### Deploy with simple kubernetes deployment
```bash
kubectl create deployment test --image=
```### Deploying the nats operator and cluster
nats-operator [link](https://github.com/nats-io/nats-operator). Will do the namespace-scope installation.
When the operator has been installed, create a nats cluster:
```bash
cat <