1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00
ctrl/scripts/nats-server
2021-12-07 14:20:46 +01:00
..
create-docker-compose-files created wrapper script for nats-server config 2021-10-05 15:51:30 +02:00
generate-nats-conf created wrapper script for nats-server config 2021-10-05 15:51:30 +02:00
generate-nats-node-auth-config added generate nkeys to scripts 2021-10-05 11:50:54 +02:00
generate-nkeys added generate nkeys to scripts 2021-10-05 11:50:54 +02:00
README.md updated doc 2021-12-07 14:20:46 +01:00
wrapper-docker-compose.sh created wrapper script for nats-server config 2021-10-05 15:51:30 +02:00

nats-server configuration

This folder contains several scripts to help out setting up the nats-server configuration.

You can run each script individually, or you can use one of the wrapper scripts.

Setup

Create LetsEncrypt certificate

Create a directory where you want your docker compose files, and enter that directory

First we need to create the LetsEncrypt certificates. We do that with https://github.com/RaaLabs/certupdater. To build the docker container certupdater follow the instructions in it's README.md file.

To create the certificates for your domain you will need to have your domain registered at your current public IP with your provider, and have forwarded port tcp/80 and tcp/443 to the host you are running the scripts on.

The command to generate the scripts are:

docker run -it --rm -v '<path to current folder here>:/certs/:rw' -p 80:80 -p 443:443 -e DAEMON=false -e USER_FOLDER=/certs -e PROD=true -e DOMAIN=my.super.cool.domain.com certupdater:0.1.0

Generate docker-compose files

Clone the steward repository:

mkdir my_dir
cd my_dir
git clone https://github.com/RaaLabs/steward.git

Execute the wrapper script with the following arguments:

./steward/scripts/nats-server/wrapper.sh <LetsEncrypt Cert file> <LetsEncrypt Key file> <nats-server listen port>

./steward/scripts/nats-server/wrapper.sh ../some/dir/le.crt ../some/dir/le.key 50222

This will create all files needed, but you need to add user configuration to the nats.conf file manually.

A template for the central steward instance are added by default, but you need to edit the file and replace the FILL-IN... fields with your central user key, and organization name according to the naming you want to use as node names. Read more about the naming in the main README.md.

NB: LetsEncrypt certificate can be generated by using https://github.com/RaaLabs/certupdater