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.
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.
Set the username/password or auth token configuration under the start variables
Ports required to run the server in a table format.
Port | default |
---|---|
Client Port | 4222 |
Name | Tag |
---|---|
ghcr.io/ptero-eggs/yolks:alpine | ghcr.io/ptero-eggs/yolks:alpine |
Name | Description | Environment Variable | Default Value | User Viewable | User Editable |
---|---|---|---|---|---|
Username | User required for connections. | USERNAME | Yes | Yes | |
Password | Password required for connections. | PASSWORD | Yes | Yes | |
Auth Token | Authorization token required for connections. If set, Username/Password based authentication will be disabled. | AUTH_TOKEN | Yes | Yes | |
Enable JetStream | Enable JetStream functionality. | JETSTREAM | 1 | Yes | Yes |
VERSION | Version to install | VERSION | latest | Yes | Yes |
#!/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