Skip to content

Bun

Bun is an incredibly fast JavaScript runtime, transpiler bundler, and npm package manager all-in-one.

egg-bun.json

updated

Install

Installer image
ghcr.io/ptero-eggs/installers:debian
Install script
73 lines

Images

New servers use the first image. Users can change it on the Startup page.

  • Bun Latest default ghcr.io/ptero-eggs/yolks:bun_latest
  • Bun Canary ghcr.io/ptero-eggs/yolks:bun_canary

Startup

The Panel runs this command to start the server. It replaces each variable in the command with the value of that variable.

9 variables

Startup command

if [[ -d .git ]] && [[ 0 == "1" ]]; then git pull; fi; if [[ ! -z {{BUN_PACKAGES}} ]]; then bun install {{BUN_PACKAGES}}; fi; if [[ ! -z {{RMBUN_PACKAGES}} ]]; then bun remove {{RMBUN_PACKAGES}}; fi; if [ -f /home/container/package.json ]; then bun install; fi; bun run index.js
  • The Git repository address to clone .

    GIT_ADDRESSUsers can edit

    nullable|string

  • Skip all the install stuff if you are letting a user upload files. 0 = false (default) 1 = true

    USER_UPLOADUsers can edit

    required|boolean

  • Pull the latest files on startup when using a Git Repository. 0 = false (default) 1 = true

    AUTO_UPDATEUsers can edit

    required|boolean

  • The main file passed to the bun run command

    MAIN_FILEUsers can edit

    required|string

  • Install additional bun packages. Use spaces to separate

    BUN_PACKAGESUsers can edit

    nullable|string

  • Uninstall bun packages. Use spaces to separate

    RMBUN_PACKAGESUsers can edit

    nullable|string

  • The Git branch to install.

    BRANCHUsers can edit

    nullable|string

  • Git username for authentication.

    USERNAMEUsers can edit

    nullable|string

  • Git access token for authentication.

    ACCESS_TOKENUsers can edit

    nullable|string

Wings

Stop command
^^C
Running when the console shows
change this text 1
change this text 2

Readme

Bun - JavaScript & TypeScript Generic

From their site

This egg is designed to run any generic Bun application, allowing users to pull their own Bun source code from a Git repository.

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

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"
  ]
}

Changes

  1. Fix docker image case

    · Daniel Barton · c6218f8

  2. Update repo names and remove some GH stuff for now

    · Daniel Barton · 8a5189b

  3. Append the forgotten commit

    · QuintenQVD0 · b047ae6

  4. change over for pelican-eggs layout

    · Michael (Parker) Parker · 9a21770

  5. Update egg-bun.json (#2466)

    · Shinaii · 83fa92a

  6. cleanup

    · Quinten · abe8ed5

All changes on GitHub

Problem with this egg?

Open an issue on GitHub. Include your Panel and Wings versions.

Install script 73 lines bash in ghcr.io/ptero-eggs/installers:debian Show
#!/bin/bash
# Bun App 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


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 bun packages"
if [[ ! -z ${BUN_PACKAGES} ]]; then
    bun install ${BUN_PACKAGES}
fi

if [ -f /mnt/server/package.json ]; then
    bun install --production
fi

## install end
echo "-----------------------------------------"
echo "Installation completed..."
echo "-----------------------------------------"