Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add egg-pumpkin.json #425

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Commandcracker
Copy link
Contributor

Description

Add egg for Pterodactyl

Testing

Checklist

Things need to be done before this Pull Request can be merged.

  • Code is well-formatted and adheres to project style guidelines: cargo fmt
  • Code does not produce any clippy warnings: cargo clippy
  • All unit tests pass: cargo test
  • I added new unit tests, so other people don't accidentally break my code by changing other parts of the codebase. How?

Copy link
Contributor

@Yimura Yimura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the installation script here to make it readable for everyone:

#!/bin/ash
set -eux

apk add --no-cache musl-dev git
mkdir -p /mnt/server

REPO_URL="${GIT_URL:-https://github.com/Snowiiii/Pumpkin.git}"

if [ -n "$GIT_BRANCH" ]; then
    git clone --depth 1 --single-branch --branch "$GIT_BRANCH" "$REPO_URL"
else
    git clone --depth 1 --single-branch "$REPO_URL"
fi

if [ -n "$GIT_COMMIT" ]; then
    git checkout "$GIT_COMMIT"
fi

cd Pumpkin

if [[ "$BUILD_RELEASE" == "1" || "$BUILD_RELEASE" == "true" ]]; then
    cargo build --release
    strip target/release/pumpkin
    cp target/release/pumpkin /mnt/server/pumpkin
else
    cargo build
    cp target/debug/pumpkin /mnt/server/pumpkin
fi

egg-pumpkin.json Show resolved Hide resolved
egg-pumpkin.json Outdated
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\r\nset -eux\r\n\r\napk add --no-cache musl-dev git\r\nmkdir -p \/mnt\/server\r\n\r\nREPO_URL=\"${GIT_URL:-https:\/\/github.com\/Snowiiii\/Pumpkin.git}\"\r\n\r\nif [ -n \"$GIT_BRANCH\" ]; then\r\n git clone --depth 1 --single-branch --branch \"$GIT_BRANCH\" \"$REPO_URL\"\r\nelse\r\n git clone --depth 1 --single-branch \"$REPO_URL\"\r\nfi\r\n\r\nif [ -n \"$GIT_COMMIT\" ]; then\r\n git checkout \"$GIT_COMMIT\"\r\nfi\r\n\r\ncd Pumpkin\r\n\r\nif [[ \"$BUILD_RELEASE\" == \"1\" || \"$BUILD_RELEASE\" == \"true\" ]]; then\r\n cargo build --release\r\n strip target\/release\/pumpkin\r\n cp target\/release\/pumpkin \/mnt\/server\/pumpkin\r\nelse\r\n cargo build\r\n cp target\/debug\/pumpkin \/mnt\/server\/pumpkin\r\nfi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cargo build command will build a generic image, since this will most likely be deployed on server with one specific set of hardware we can add additional instructions to optimize for this server's hardware. Through setting the following environment variables:

RUSTFLAGS="-C target-feature=-crt-static -C target-cpu=native"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to tweak the images a bit

Error loading shared library libgcc_s.so.1: No such file or directory (needed by ./pumpkin)
Error relocating ./pumpkin: _Unwind_Resume: symbol not found
Error relocating ./pumpkin: _Unwind_GetTextRelBase: symbol not found
Error relocating ./pumpkin: _Unwind_GetIPInfo: symbol not found
Error relocating ./pumpkin: _Unwind_GetIP: symbol not found
Error relocating ./pumpkin: _Unwind_SetGR: symbol not found
Error relocating ./pumpkin: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating ./pumpkin: _Unwind_Backtrace: symbol not found
Error relocating ./pumpkin: _Unwind_GetRegionStart: symbol not found
Error relocating ./pumpkin: _Unwind_SetIP: symbol not found
Error relocating ./pumpkin: _Unwind_RaiseException: symbol not found
Error relocating ./pumpkin: _Unwind_GetDataRelBase: symbol not found
Error relocating ./pumpkin: _Unwind_DeleteException: symbol not found

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I was honestly wondering on if the pumpkin executable could run without libgcc. I guess this answers that.

What we'd need to do is provide our own runtime container with libgcc installed. I had done that in my own repository for a pumpkin egg however I didn't bother building an ARM64 variant. Which the alpine yolk has.

@Snowiiii would you be fine with adding another container image for Pumpkin to run on Pterodactyl?
Probably tagged along the lines of ghcr.io/snowiiii/pumpkin:yolk.

egg-pumpkin.json Outdated Show resolved Hide resolved
@Yimura
Copy link
Contributor

Yimura commented Dec 27, 2024

What have you done exactly to test it? I don't see anything specified in regards to that.

Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

@Commandcracker
Copy link
Contributor Author

What have you done exactly to test it? I don't see anything specified in regards to that.

Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

egg-pumpkin.json Outdated Show resolved Hide resolved
@Yimura
Copy link
Contributor

Yimura commented Dec 28, 2024

Ran into the following issue after setting the CARGO_BUILD_JOBS environment value to a number and then emptying out the field.
image

error: could not parse ``. Number of parallel jobs should be `default` or a number.

You may need to setup better fallbacks with the following scripting syntax:

# takes CARGO_BUILD_JOBS env variable, if empty assigns "default".
CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-default}

Edit:
This seems to be an issue with a fresh install as well, better default will probably prevent this.

@DataM0del
Copy link
Contributor

What have you done exactly to test it? I don't see anything specified in regards to that.
Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

Windows (dies inside)

@Commandcracker
Copy link
Contributor Author

What have you done exactly to test it? I don't see anything specified in regards to that.
Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

Windows (dies inside)

Need to play league of legends and I don't want to clutter my Debian server. I also have a dual boot with fedora, but I have not used it for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants