NATS
NATS is a connective technology built for the ever increasingly hyper-connected world. It is a single technology that enables applications to securely communicate across any combination of cloud vendors, on-premise, edge, web and mobile, and devices. NATS consists of a family of open source products that are tightly integrated but can be deployed easily and independently. NATS is being used globally by thousands of companies, spanning use-cases including microservices, edge computing, mobile, IoT and can be used to augment or replace traditional messaging.
- updated
- variables
- 5
- images
- 1
- author
- eggs@purpleflaghosting.com
- sha256
- d7c4a378a575
- source
- nats/egg-n-a-t-s.json
Readme
NATS
From the NATS website
NATS is a connective technology built for the ever increasingly hyper-connected world. It is a single technology that enables applications to securely communicate across any combination of cloud vendors, on-premise, edge, web and mobile, and devices. NATS consists of a family of open source products that are tightly integrated but can be deployed easily and independently. NATS is being used globally by thousands of companies, spanning use-cases including microservices, edge computing, mobile, IoT and can be used to augment or replace traditional messaging.
Configuration
Set the username/password or auth token configuration under the start variables
Server Ports
Ports required to run the server in a table format.
| Port | default |
|---|---|
| Client Port | 4222 |
Startup command
./nats-server --port {{SERVER_PORT}} --store_dir $HOME/data ${JETSTREAM:+-js} ${USERNAME:+--user "{{USERNAME}}"} ${PASSWORD:+--pass "{{PASSWORD}}"} ${AUTH_TOKEN:+--auth "{{AUTH_TOKEN}}"} The parts in blue are filled in by the panel when the server starts, from the variables below.
Docker image
- ghcr.io/ptero-eggs/yolks:alpine
Variables
5 settings
-
Username
User required for connections.
- env
- USERNAME
- default
- none
- rules
- nullable|string|max:20
- viewable
- editable
-
Password
Password required for connections.
- env
- PASSWORD
- default
- none
- rules
- nullable|string|max:20
- viewable
- editable
-
Auth Token
Authorization token required for connections. If set, Username/Password based authentication will be disabled.
- env
- AUTH_TOKEN
- default
- none
- rules
- nullable|string|max:255
- viewable
- editable
-
Enable JetStream
Enable JetStream functionality.
- env
- JETSTREAM
- default
- 1
- rules
- required|boolean|in:0,1
- viewable
- editable
-
VERSION
Version to install
- env
- VERSION
- default
- latest
- rules
- required|string|max:20
- viewable
- editable
Installation script 58 lines container ghcr.io/ptero-eggs/installers:debian entrypoint bash show hide
#!/bin/bash
# Detect OS architecture to download the correct binary
OS_ARCH=$(uname -m)
case "$OS_ARCH" in
x86_64)
OS_ARCH="amd64"
;;
aarch64 | arm64)
OS_ARCH="arm64"
;;
*)
echo "Unsupported architecture: $OS_ARCH"
exit 1
;;
esac
echo "Detected architecture: $OS_ARCH"
# Find the version and download URL from GitHub releases
if [ -z "$VERSION" ] || [ "$VERSION" = "latest" ]; then
echo "Downloading latest version..."
RELEASE_INFO=$(curl -s https://api.github.com/repos/nats-io/nats-server/releases/latest)
TAG_NAME=$(echo "$RELEASE_INFO" | jq -r .tag_name)
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r ".assets[] | select(.name | test(\"nats-server-.*-linux-$OS_ARCH.*.tar.gz\")) | .browser_download_url")
echo "Latest version is $TAG_NAME"
echo "Download URL: $DOWNLOAD_URL"
else
# Ensure VERSION starts with 'v'
VERSION=$(echo "$VERSION" | sed -E 's/^v*//')
VERSION="v$VERSION"
echo "Downloading version $VERSION..."
RELEASE_INFO=$(curl -s https://api.github.com/repos/nats-io/nats-server/releases/tags/$VERSION)
if [ "$(echo "$RELEASE_INFO" | jq -r .message)" = "Not Found" ]; then
echo "Version $VERSION not found."
exit 1
fi
TAG_NAME=$(echo "$RELEASE_INFO" | jq -r .tag_name)
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r ".assets[] | select(.name | test(\"nats-server-.*-linux-$OS_ARCH.*.tar.gz\")) | .browser_download_url")
echo "Version is $TAG_NAME"
fi
if [ -z "$DOWNLOAD_URL" ]; then
echo "No suitable download URL found for version $VERSION and architecture $OS_ARCH."
exit 1
fi
echo "Download URL: $DOWNLOAD_URL"
# Download release
wget "$DOWNLOAD_URL" -O /tmp/nats-server.tar.gz
# Extract files
tar -xzf /tmp/nats-server.tar.gz --strip-components=1 -C /tmp
# Copy nats-server binary and set permissions
cp -f /tmp/nats-server /mnt/server
chmod +x /mnt/server/nats-server