Skip to content

Commit 34e634b

Browse files
committed
Init NATS Server
1 parent efa8a6b commit 34e634b

File tree

8 files changed

+145
-0
lines changed

8 files changed

+145
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_STORE

nats/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# NATS Server Plugin
2+
3+
Plugin for the [`nats-server`](https://www.nixhub.io/packages/nats-server) package. This plugin configures NATS-server to use a local config, and adds a process-compose service,
4+
5+
## How to Activate
6+
7+
To install NATS Server, run `devbox add nats-server@latest`. We also recommend installing the [`natscli`](https://nixhub.io/packages/natscli) and [`nats-top`](https://nixhub.io/packages/nats-top) packages.
8+
9+
```bash
10+
11+
To activate this plugin, add the following reference to the `include` section of your `devbox.json` file.
12+
13+
```json
14+
15+
"include": [
16+
"github:jetpack-io/devbox-plugins?dir=nats"
17+
],
18+
```
19+
20+
## Services
21+
22+
* nats-server
23+
24+
Use `devbox services up nats-server` to start the nats server.
25+
26+
## Files
27+
28+
This plugin creates the following helper files:
29+
30+
* **devbox.d/nats-server/server.conf** - NATS Server configuration file
31+
* **.devbox/virtenv/nats-server/process-compose.yaml** - Defines the process to start the MongoDB server
32+
33+
## Environment Variables
34+
35+
This plugin sets the following environment variables:
36+
37+
* **NATS_SERVER_CONF** = {{.DevboxDir}}/mongod.conf

nats/config/process-compose.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: "0.5"
2+
3+
processes:
4+
nats-server:
5+
command: >
6+
if [[ -z ${NATS_SERVER_CONF} ]]; then
7+
nats-server
8+
else
9+
nats-server -c $NATS_SERVER_CONF
10+
fi
11+
availability:
12+
restart: on_failure
13+
max_restarts: 5

nats/config/server.conf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
listen: 127.0.0.1:4222
2+
http_port: 8222

nats/plugin.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "nats-server",
3+
"version": "0.0.1",
4+
"readme": "Plugin for the [`nats-server`](https://www.nixhub.io/packages/nats-server) package. This plugin configures nats-server to use a local config, and adds a process-compose service",
5+
"env": {
6+
"NATS_SERVER_CONF": "{{.DevboxDir}}/server.conf"
7+
},
8+
"create_files": {
9+
"{{.Virtenv}}/process-compose.yaml": "config/process-compose.yaml",
10+
"{{.DevboxDir}}/server.conf": "config/server.conf"
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
listen: 127.0.0.1:4222
2+
http_port: 8222

nats/test/devbox.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"packages": [
3+
"nats-server@latest",
4+
"natscli@latest",
5+
"nats-top@latest"
6+
],
7+
"shell": {
8+
"init_hook": []
9+
},
10+
"include": [
11+
"path:./../plugin.json"
12+
]
13+
}

nats/test/devbox.lock

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"nats-server@latest": {
5+
"last_modified": "2023-09-27T18:02:17Z",
6+
"resolved": "github:NixOS/nixpkgs/517501bcf14ae6ec47efd6a17dda0ca8e6d866f9#nats-server",
7+
"source": "devbox-search",
8+
"version": "2.10.1",
9+
"systems": {
10+
"aarch64-darwin": {
11+
"store_path": "/nix/store/gyh12bbfqd73r1zk423ifl3higqzjkka-nats-server-2.10.1"
12+
},
13+
"aarch64-linux": {
14+
"store_path": "/nix/store/jsqsnyf6rmkyi82ggl0477r502xa8fff-nats-server-2.10.1"
15+
},
16+
"x86_64-darwin": {
17+
"store_path": "/nix/store/jiz3wyn0gb54z26833pb44m1699and02-nats-server-2.10.1"
18+
},
19+
"x86_64-linux": {
20+
"store_path": "/nix/store/fc7qvw21bwdafw2clm9hv2mlx214wyfj-nats-server-2.10.1"
21+
}
22+
}
23+
},
24+
"nats-top@latest": {
25+
"last_modified": "2023-09-27T18:02:17Z",
26+
"resolved": "github:NixOS/nixpkgs/517501bcf14ae6ec47efd6a17dda0ca8e6d866f9#nats-top",
27+
"source": "devbox-search",
28+
"version": "0.6.1",
29+
"systems": {
30+
"aarch64-darwin": {
31+
"store_path": "/nix/store/is2y75xx1qvnys4fnmk0n87nlvkd8pmg-nats-top-0.6.1"
32+
},
33+
"aarch64-linux": {
34+
"store_path": "/nix/store/7mybshs900pcaa7z7bsn4wgxpygy6svl-nats-top-0.6.1"
35+
},
36+
"x86_64-darwin": {
37+
"store_path": "/nix/store/90ydhlcp335zc343x0v152wnviw9phyy-nats-top-0.6.1"
38+
},
39+
"x86_64-linux": {
40+
"store_path": "/nix/store/5x6zm0vi15a3w1wq7xbyr60a8mrip2ra-nats-top-0.6.1"
41+
}
42+
}
43+
},
44+
"natscli@latest": {
45+
"last_modified": "2023-09-27T18:02:17Z",
46+
"resolved": "github:NixOS/nixpkgs/517501bcf14ae6ec47efd6a17dda0ca8e6d866f9#natscli",
47+
"source": "devbox-search",
48+
"version": "0.1.1",
49+
"systems": {
50+
"aarch64-darwin": {
51+
"store_path": "/nix/store/wp934vnvgki955s246lz4dvxr10hp7g1-natscli-0.1.1"
52+
},
53+
"aarch64-linux": {
54+
"store_path": "/nix/store/yf20wfxpf67rd1rl6wh6wrx8zvhr33yx-natscli-0.1.1"
55+
},
56+
"x86_64-darwin": {
57+
"store_path": "/nix/store/ql89nvmc5clw8ibvwhv7zfxlf21n6r86-natscli-0.1.1"
58+
},
59+
"x86_64-linux": {
60+
"store_path": "/nix/store/dhgmf8j7g1piy3lq9d1fsxcbwmh9nfby-natscli-0.1.1"
61+
}
62+
}
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)