Egg Repository

Pterodactyl Community Egg Repository

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.

Read Me

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.

Portdefault
Client Port4222
Yolks
NameTag
ghcr.io/ptero-eggs/yolks:alpineghcr.io/ptero-eggs/yolks:alpine
Variables
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
UsernameUser required for connections.USERNAMEYesYes
PasswordPassword required for connections.PASSWORDYesYes
Auth TokenAuthorization token required for connections. If set, Username/Password based authentication will be disabled.AUTH_TOKENYesYes
Enable JetStreamEnable JetStream functionality.JETSTREAM1YesYes
VERSIONVersion to installVERSIONlatestYesYes
Install Script
#!/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