luvit generic

generic
Report Issue

A generic luvit egg This will clone a git repo. It defaults to master if no branch is specified. Supports the discordia lua framework.

Contributors:
README

Lua (Luvit) Language Generic

This egg was designed to allow a user to pull their own Lua source code from a repo and run it with Luvit.

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

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"
  ]
}
Docker Images (1)
Name Image
ghcr.io/ptero-eggs/yolks:debian ghcr.io/ptero-eggs/yolks:debian
Startup Command
./luvit {{LUA_FILE}}
Variables (7)

Git Username

Username to auth with git.

Environment:
USERNAME
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string

Git Access Token

Password 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_tokens

Environment:
ACCESS_TOKEN
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string

Git Repo Address

GitHub Repo to clone I.E. https://github.com/parkervcp/repo_name

Environment:
GIT_ADDRESS
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string

User Uploaded Files

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

Environment:
USER_UPLOAD
Default:
0
User Viewable:
User Editable:
Rules:
required|boolean

Git Branch

What branch to pull from github. Default is blank to pull the repo default branch

Environment:
BRANCH
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string

lua file

The Lua file to run

Environment:
LUA_FILE
Default:
app.lua
User Viewable:
User Editable:
Rules:
required|string

Lit Packages

Lit Packages to install example SinisterRectus/discordia lduboeuf/cjson

Environment:
LIT_PACKAGES
Default:
None
User Viewable:
User Editable:
Rules:
nullable|string
Installation Script
Container: ghcr.io/ptero-eggs/installers:debian
Entrypoint: bash
#!/bin/bash
## luvit generic install script

apt update
apt install -y git curl jq file unzip

## get git files
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 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

## install luvit for install time
curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh

## Install luvit packages
./lit install ${LIT_PACKAGES}

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