Egg Repository

Pterodactyl Community Egg Repository

nodemon

Nodemon javascript egg that automatically restarts the node application when file changes in the directory are detected This will clone a git repo for a bot. it defaults to master if no branch is specified. Installs the node_modules on install. If you set user_upload, then I assume you know what you are doing.

Read Me

Nodemon (JavaScript & TypeScript)

Tired of manually restarting your bot? Nodemon will do it by itself.

Nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected. Nodemon does not require any additional changes to your code or method of development.

This egg is designed to run any generic Javascript application, allowing users to pull their own JavaScript or TypeScript source code from a Github repository.

There is an option to allow a user to upload their own files to run a bot.

The startup configs and commands may need changing to actually function properly.

Configuration

The server will be stuck as starting until the egg Start Configuration is modified. You have to edit the text to match something your bot will print for Pterodactyl panel to detect it as running. image

You can use arrays to have multiple different values when different bots are being used

{
  "done":[
    "change this text 1",
    "change this text 2"
  ]
}
Yolks
NameTag
ghcr.io/ptero-eggs/yolks:nodejs_21ghcr.io/ptero-eggs/yolks:nodejs_21
ghcr.io/ptero-eggs/yolks:nodejs_20ghcr.io/ptero-eggs/yolks:nodejs_20
ghcr.io/ptero-eggs/yolks:nodejs_19ghcr.io/ptero-eggs/yolks:nodejs_19
ghcr.io/ptero-eggs/yolks:nodejs_18ghcr.io/ptero-eggs/yolks:nodejs_18
ghcr.io/ptero-eggs/yolks:nodejs_17ghcr.io/ptero-eggs/yolks:nodejs_17
ghcr.io/ptero-eggs/yolks:nodejs_16ghcr.io/ptero-eggs/yolks:nodejs_16
ghcr.io/ptero-eggs/yolks:nodejs_15ghcr.io/ptero-eggs/yolks:nodejs_15
ghcr.io/ptero-eggs/yolks:nodejs_14ghcr.io/ptero-eggs/yolks:nodejs_14
ghcr.io/ptero-eggs/yolks:nodejs_12ghcr.io/ptero-eggs/yolks:nodejs_12
Variables
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
Git Repo AddressGitHub Repo to clone I.E. https://github.com/nickdevnl/repo_nameGIT_ADDRESSYesYes
Install BranchThe branch of the bot to install.BRANCHYesYes
User Uploaded FilesSkip all the install stuff if you are letting a user upload files. 0 = false (default) 1 = trueUSER_UPLOAD0YesYes
Auto UpdatePull the latest files on startup when using a GitHub repo. You must have .git folder, reinstall if you are missing it.AUTO_UPDATE0YesYes
Bot js fileThe file that starts the bot.BOT_JS_FILEindex.jsYesYes
Additional Node packagesInstall additional node packages. Use spaces to separate.NODE_PACKAGESYesYes
Uninstall Node packagesUninstall node packages. Use spaces to separate.UNNODE_PACKAGESYesYes
Git UsernameUsername to auth with git.USERNAMEYesYes
Git Access TokenPassword to use with git. It's best practice to use a Personal Access Token. https://github.com/settings/tokens https://gitlab.com/-/profile/personal_access_tokensACCESS_TOKENYesYes
Install Script
#!/bin/bash
# NodeJS Bot Installation Script
#
# Server Files: /mnt/server
apt update
apt install -y git curl jq file unzip make gcc g++ python python-dev libtool

mkdir -p /mnt/server
cd /mnt/server

if [ "${USER_UPLOAD}" == "true" ] || [ "${USER_UPLOAD}" == "1" ]; then
    echo -e "assuming user knows what they are doing have a good day."
    exit 0
fi

## add git ending if it's not on the address
if [[ ${GIT_ADDRESS} != *.git ]]; then
    GIT_ADDRESS=${GIT_ADDRESS}.git
fi

if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
    echo -e "using anon api call"
else
    GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
fi

## pull git js bot repo
if [ "$(ls -A /mnt/server)" ]; then
    echo -e "/mnt/server directory is not empty."
    if [ -d .git ]; then
        echo -e ".git directory exists"
        if [ -f .git/config ]; then
            echo -e "loading info from git config"
            ORIGIN=$(git config --get remote.origin.url)
        else
            echo -e "files found with no git config"
            echo -e "closing out without touching things to not break anything"
            exit 10
        fi
    fi

    if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
        echo "pulling latest from github"
        git pull
    fi
else
    echo -e "/mnt/server is empty.\ncloning files into repo"
    if [ -z ${BRANCH} ]; then
        echo -e "cloning default branch"
        git clone ${GIT_ADDRESS} .
    else
        echo -e "cloning ${BRANCH}'"
        git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} .
    fi

fi

echo "Installing nodejs packages"
if [[ ! -z ${NODE_PACKAGES} ]]; then
    /usr/local/bin/npm install ${NODE_PACKAGES}
fi

if [ -f /mnt/server/package.json ]; then
    /usr/local/bin/npm install --production
fi

echo -e "install complete"
exit 0