From 633b084c6054ca017ad57c89ebec20648395c222 Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:53:51 +0100 Subject: [PATCH 1/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e9e8a74c..84756656 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ If you are reading this it looks like you are looking to add an egg to your serv * [java](/generic/java/) * [lua](/generic/lua/) * [nodejs](/generic/nodejs/) +* [bun](/generic/bun/) * [nodemon](/generic/nodemon/) * [python](/generic/python/) * [rust](/generic/rust/) From 3d8d7aacfcb259f82892f18ec4b40cf5752bd7b4 Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:57:12 +0100 Subject: [PATCH 2/7] Create egg-bun.json --- generic/bun/egg-bun.json | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 generic/bun/egg-bun.json diff --git a/generic/bun/egg-bun.json b/generic/bun/egg-bun.json new file mode 100644 index 00000000..96a90df0 --- /dev/null +++ b/generic/bun/egg-bun.json @@ -0,0 +1,122 @@ +{ + "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", + "meta": { + "version": "PTDL_v2", + "update_url": null + }, + "exported_at": "2023-08-27T01:47:23+02:00", + "name": "Bun", + "author": "mratox@protonmail.com", + "description": "Bun is an incredibly fast JavaScript runtime, transpiler bundler, and npm package manager all-in-one.", + "features": null, + "docker_images": { + "ghcr.io\/mratox\/images:bun": "ghcr.io\/mratox\/images:bun" + }, + "file_denylist": [], + "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"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; {{STARTUP_COMMAND}};", + "config": { + "files": "{}", + "startup": "{\r\n \"done\": \"\"\r\n}", + "logs": "{}", + "stop": "^^C" + }, + "scripts": { + "installation": { + "script": "#!\/bin\/bash\r\n# Bun App Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y git curl jq file unzip make gcc g++ python python-dev libtool\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\nif [ \"${USER_UPLOAD}\" == \"true\" ] || [ \"${USER_UPLOAD}\" == \"1\" ]; then\r\necho -e \"assuming user knows what they are doing have a good day.\"\r\nexit 0\r\nfi\r\n## add git ending if it's not on the address\r\nif [[ ${GIT_ADDRESS} != *.git ]]; then\r\nGIT_ADDRESS=${GIT_ADDRESS}.git\r\nfi\r\nif [ -z \"${GIT_USERNAME}\" ] && [ -z \"${GIT_ACCESS_TOKEN}\" ]; then\r\necho -e \"using anon api call.\"\r\nelse\r\nGIT_ADDRESS=\"https:\/\/${USERNAME}:${GIT_ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d\/ -f3-)\"\r\nfi\r\n## pull git js repo\r\nif [ \"$(ls -A \/mnt\/server)\" ]; then\r\necho -e \"\/mnt\/server directory is not empty.\"\r\nif [ -d .git ]; then\r\necho -e \".git directory exists.\"\r\nif [ -f .git\/config ]; then\r\necho -e \"loading information from git config.\"\r\nORIGIN=$(git config --get remote.origin.url)\r\nelse\r\necho -e \"files found with no git config.\"\r\necho -e \"closing out without touching things to not break anything.\"\r\nexit 10\r\nfi\r\nfi\r\nif [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\necho \"pulling latest files from the git repository.\"\r\ngit pull\r\nfi\r\nelse\r\necho -e \"\/mnt\/server is empty.\\ncloning files into repo\"\r\nif [ -z ${GIT_BRANCH} ]; then\r\necho -e \"cloning default branch\"\r\ngit clone ${GIT_ADDRESS} .\r\nelse\r\necho -e \"cloning ${GIT_BRANCH}'\"\r\ngit clone --single-branch --branch ${GIT_BRANCH} ${GIT_ADDRESS} .\r\nfi\r\nfi\r\necho \"Installing bun packages\"\r\nif [[ ! -z ${BUN_PACKAGES} ]]; then\r\nbun install ${BUN_PACKAGES}\r\nfi\r\nif [ -f \/mnt\/server\/package.json ]; then\r\nbun install --production\r\nfi\r\necho -e \"install complete\"\r\nexit 0", + "container": "debian:buster-slim", + "entrypoint": "bash" + } + }, + "variables": [ + { + "name": "Git Repository Address", + "description": "The Git repository address to clone .", + "env_variable": "GIT_ADDRESS", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git Branch", + "description": "The Git branch to install.", + "env_variable": "GIT_BRANCH", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "User Uploaded Files", + "description": "Skip all the install stuff if you are letting a user upload files.\r\n0 = false (default)\r\n1 = true", + "env_variable": "USER_UPLOAD", + "default_value": "0", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" + }, + { + "name": "Auto Update", + "description": "Pull the latest files on startup when using a Git Repository.\r\n0 = false (default)\r\n1 = true", + "env_variable": "AUTO_UPDATE", + "default_value": "0", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" + }, + { + "name": "Git Username", + "description": "Git username for authentication.", + "env_variable": "GIT_USERNAME", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git Access Token", + "description": "Git access token for authentication.", + "env_variable": "GIT_ACCESS_TOKEN", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Startup Command", + "description": "The command used to start the server.", + "env_variable": "STARTUP_COMMAND", + "default_value": "bun run index.js", + "user_viewable": true, + "user_editable": true, + "rules": "required|string", + "field_type": "text" + }, + { + "name": "Additional Bun Packages", + "description": "Install additional bun packages.\r\nUse spaces to separate", + "env_variable": "BUN_PACKAGES", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Uninstall Bun Packages", + "description": "Uninstall bun packages.\r\nUse spaces to separate", + "env_variable": "RMBUN_PACKAGES", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + } + ] +} From e725261626c137d07eb2e9f7a5efdeb6ab59e63c Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:59:29 +0100 Subject: [PATCH 3/7] Create README.md --- generic/bun/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 generic/bun/README.md diff --git a/generic/bun/README.md b/generic/bun/README.md new file mode 100644 index 00000000..6f2b7adc --- /dev/null +++ b/generic/bun/README.md @@ -0,0 +1,24 @@ +# Bun - JavaScript & TypeScript Generic + +## From their [site](https://bun.sh/) + +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](https://user-images.githubusercontent.com/10975908/126516861-c5cb4630-9f25-405c-8199-97bf5ec15a7f.png) + +You can use arrays to have multiple different values when different bots are being used + +```json +{ + "done":[ + "change this text 1", + "change this text 2" + ] +} From 9c31dec600813a554abb8c6d9c8c4712166015d9 Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 01:01:00 +0100 Subject: [PATCH 4/7] Update README.md --- generic/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generic/README.md b/generic/README.md index f18701ea..a549b2d4 100644 --- a/generic/README.md +++ b/generic/README.md @@ -35,6 +35,11 @@ A generic Lua (Luvit) language egg [nodejs](https://nodejs.org) A generic Node.JS egg +### [Bun](bun) + +[bun](https://bun.sh) +A generic Bun egg + ### [nodemon](nodemon) [nodemon](https://nodemon.io/) From 66d0af68d80d46958b5cc43de0fb3be517aaaa30 Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 01:03:32 +0100 Subject: [PATCH 5/7] Update egg-bun.json --- generic/bun/egg-bun.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/bun/egg-bun.json b/generic/bun/egg-bun.json index 96a90df0..9d932c32 100644 --- a/generic/bun/egg-bun.json +++ b/generic/bun/egg-bun.json @@ -16,7 +16,7 @@ "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"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; {{STARTUP_COMMAND}};", "config": { "files": "{}", - "startup": "{\r\n \"done\": \"\"\r\n}", + "startup": "{\r\n \"done\": [\r\n \"change this text 1\",\r\n \"change this text 2\"\r\n ]\r\n}", "logs": "{}", "stop": "^^C" }, From 640ff589f1a4d7379fb3adf00ab0f7567775b924 Mon Sep 17 00:00:00 2001 From: mratox <143298194+mratox@users.noreply.github.com> Date: Sun, 27 Aug 2023 01:50:13 +0100 Subject: [PATCH 6/7] Update egg-bun.json --- generic/bun/egg-bun.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/bun/egg-bun.json b/generic/bun/egg-bun.json index 9d932c32..095b4695 100644 --- a/generic/bun/egg-bun.json +++ b/generic/bun/egg-bun.json @@ -10,7 +10,7 @@ "description": "Bun is an incredibly fast JavaScript runtime, transpiler bundler, and npm package manager all-in-one.", "features": null, "docker_images": { - "ghcr.io\/mratox\/images:bun": "ghcr.io\/mratox\/images:bun" + "ghcr.io\/parkervcp\/yolks:bun": "ghcr.io\/parkervcp\/yolks:bun" }, "file_denylist": [], "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"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; {{STARTUP_COMMAND}};", From abe8ed59311e07a28ebf03b3f6e41f9eb8237d99 Mon Sep 17 00:00:00 2001 From: Quinten <67589015+QuintenQVD0@users.noreply.github.com> Date: Sun, 27 Aug 2023 11:48:11 +0200 Subject: [PATCH 7/7] cleanup --- generic/bun/egg-bun.json | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/generic/bun/egg-bun.json b/generic/bun/egg-bun.json index 095b4695..9ce16e7c 100644 --- a/generic/bun/egg-bun.json +++ b/generic/bun/egg-bun.json @@ -4,16 +4,17 @@ "version": "PTDL_v2", "update_url": null }, - "exported_at": "2023-08-27T01:47:23+02:00", + "exported_at": "2023-08-27T11:46:37+02:00", "name": "Bun", "author": "mratox@protonmail.com", "description": "Bun is an incredibly fast JavaScript runtime, transpiler bundler, and npm package manager all-in-one.", "features": null, "docker_images": { - "ghcr.io\/parkervcp\/yolks:bun": "ghcr.io\/parkervcp\/yolks:bun" + "Bun Latest": "ghcr.io\/parkervcp\/yolks:bun_latest", + "Bun Canary": "ghcr.io\/parkervcp\/yolks:bun_canary" }, "file_denylist": [], - "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"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; {{STARTUP_COMMAND}};", + "startup": "if [[ -d .git ]] && [[ {{AUTO_UPDATE}} == \"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 {{MAIN_FILE}}", "config": { "files": "{}", "startup": "{\r\n \"done\": [\r\n \"change this text 1\",\r\n \"change this text 2\"\r\n ]\r\n}", @@ -22,8 +23,8 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/bash\r\n# Bun App Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y git curl jq file unzip make gcc g++ python python-dev libtool\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\nif [ \"${USER_UPLOAD}\" == \"true\" ] || [ \"${USER_UPLOAD}\" == \"1\" ]; then\r\necho -e \"assuming user knows what they are doing have a good day.\"\r\nexit 0\r\nfi\r\n## add git ending if it's not on the address\r\nif [[ ${GIT_ADDRESS} != *.git ]]; then\r\nGIT_ADDRESS=${GIT_ADDRESS}.git\r\nfi\r\nif [ -z \"${GIT_USERNAME}\" ] && [ -z \"${GIT_ACCESS_TOKEN}\" ]; then\r\necho -e \"using anon api call.\"\r\nelse\r\nGIT_ADDRESS=\"https:\/\/${USERNAME}:${GIT_ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d\/ -f3-)\"\r\nfi\r\n## pull git js repo\r\nif [ \"$(ls -A \/mnt\/server)\" ]; then\r\necho -e \"\/mnt\/server directory is not empty.\"\r\nif [ -d .git ]; then\r\necho -e \".git directory exists.\"\r\nif [ -f .git\/config ]; then\r\necho -e \"loading information from git config.\"\r\nORIGIN=$(git config --get remote.origin.url)\r\nelse\r\necho -e \"files found with no git config.\"\r\necho -e \"closing out without touching things to not break anything.\"\r\nexit 10\r\nfi\r\nfi\r\nif [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\necho \"pulling latest files from the git repository.\"\r\ngit pull\r\nfi\r\nelse\r\necho -e \"\/mnt\/server is empty.\\ncloning files into repo\"\r\nif [ -z ${GIT_BRANCH} ]; then\r\necho -e \"cloning default branch\"\r\ngit clone ${GIT_ADDRESS} .\r\nelse\r\necho -e \"cloning ${GIT_BRANCH}'\"\r\ngit clone --single-branch --branch ${GIT_BRANCH} ${GIT_ADDRESS} .\r\nfi\r\nfi\r\necho \"Installing bun packages\"\r\nif [[ ! -z ${BUN_PACKAGES} ]]; then\r\nbun install ${BUN_PACKAGES}\r\nfi\r\nif [ -f \/mnt\/server\/package.json ]; then\r\nbun install --production\r\nfi\r\necho -e \"install complete\"\r\nexit 0", - "container": "debian:buster-slim", + "script": "#!\/bin\/bash\r\n# Bun App Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y git curl jq file unzip make gcc g++ python python-dev libtool\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\nif [ \"${USER_UPLOAD}\" == \"true\" ] || [ \"${USER_UPLOAD}\" == \"1\" ]; then\r\n echo -e \"assuming user knows what they are doing have a good day.\"\r\n exit 0\r\nfi\r\n\r\n## add git ending if it's not on the address\r\nif [[ ${GIT_ADDRESS} != *.git ]]; then\r\n GIT_ADDRESS=${GIT_ADDRESS}.git\r\nfi\r\n\r\nif [ -z \"${USERNAME}\" ] && [ -z \"${ACCESS_TOKEN}\" ]; then\r\n echo -e \"using anon api call\"\r\nelse\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d\/ -f3-)\"\r\nfi\r\n\r\n## pull git js bot repo\r\nif [ \"$(ls -A \/mnt\/server)\" ]; then\r\n echo -e \"\/mnt\/server directory is not empty.\"\r\n if [ -d .git ]; then\r\n echo -e \".git directory exists\"\r\n if [ -f .git\/config ]; then\r\n echo -e \"loading info from git config\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo -e \"files found with no git config\"\r\n echo -e \"closing out without touching things to not break anything\"\r\n exit 10\r\n fi\r\n fi\r\n\r\n if [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\n echo \"pulling latest from github\"\r\n git pull\r\n fi\r\nelse\r\n echo -e \"\/mnt\/server is empty.\\ncloning files into repo\"\r\n if [ -z ${BRANCH} ]; then\r\n echo -e \"cloning default branch\"\r\n git clone ${GIT_ADDRESS} .\r\n else\r\n echo -e \"cloning ${BRANCH}'\"\r\n git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} .\r\n fi\r\nfi\r\n\r\n\r\necho \"Installing bun packages\"\r\nif [[ ! -z ${BUN_PACKAGES} ]]; then\r\n bun install ${BUN_PACKAGES}\r\nfi\r\n\r\nif [ -f \/mnt\/server\/package.json ]; then\r\n bun install --production\r\nfi\r\n\r\n## install end\r\necho \"-----------------------------------------\"\r\necho \"Installation completed...\"\r\necho \"-----------------------------------------\"", + "container": "debian:bullseye-slim", "entrypoint": "bash" } }, @@ -89,10 +90,10 @@ "field_type": "text" }, { - "name": "Startup Command", - "description": "The command used to start the server.", - "env_variable": "STARTUP_COMMAND", - "default_value": "bun run index.js", + "name": "Main file", + "description": "The main file passed to the bun run command", + "env_variable": "MAIN_FILE", + "default_value": "index.js", "user_viewable": true, "user_editable": true, "rules": "required|string", @@ -119,4 +120,4 @@ "field_type": "text" } ] -} +} \ No newline at end of file