Update egg-web-host-egg.json

Add namelessmc config and install option as a variable to the egg
This commit is contained in:
finnie2006 authored and GitHub committed 2024-12-28 21:16:15 +01:00
1 parent dec152d464
commit 286aa135f6
1 file changed
+12 -2
+12 -2
View File
@@ -4,7 +4,7 @@
"version": "PTDL_v2", "version": "PTDL_v2",
"update_url": null "update_url": null
}, },
"exported_at": "2024-12-28T19:54:34+01:00", "exported_at": "2024-12-28T21:14:39+01:00",
"name": "WebHost Egg", "name": "WebHost Egg",
"author": "[email protected]", "author": "[email protected]",
"description": "Introducing a versatile hosting solution for any website!\r\n\r\nWith built-in Composer support, simply specify the packages you need in the \u201cPackages\u201d box, and they\u2019ll be installed automatically when the server starts. Want to set up WordPress? Just toggle the WordPress slider during server setup, and WordPress will be ready to go in moments.\r\n\r\n\u00a9 Sigma Productions 2025", "description": "Introducing a versatile hosting solution for any website!\r\n\r\nWith built-in Composer support, simply specify the packages you need in the \u201cPackages\u201d box, and they\u2019ll be installed automatically when the server starts. Want to set up WordPress? Just toggle the WordPress slider during server setup, and WordPress will be ready to go in moments.\r\n\r\n\u00a9 Sigma Productions 2025",
@@ -26,7 +26,7 @@
}, },
"scripts": { "scripts": {
"installation": { "installation": {
"script": "#!\/bin\/ash\r\n\r\n# Set working directory\r\ncd \/mnt\/server || exit 1\r\napk --update add git || { echo \"Failed to install Git\"; exit 1; }\r\n\r\n# Clone the repository containing nginx and php configurations\r\nif git clone https:\/\/github.com\/Sigma-Production\/ptero-eggs .\/temp; then\r\n cp -r .\/temp\/nginx .\/temp\/php-fpm .\/temp\/webroot \/mnt\/server\/\r\n cp .\/temp\/start.sh \/mnt\/server\/\r\n chmod +x \/mnt\/server\/start.sh\r\n rm -rf .\/temp\r\nelse\r\n echo \"Failed to clone repository\"; exit 1\r\nfi\r\n\r\n# Prepare directories\r\nmkdir -p \/mnt\/server\/tmp \/mnt\/server\/logs\r\n\r\n# WordPress installation\r\nif [ \"${WORDPRESS}\" = \"true\" ] || [ \"${WORDPRESS}\" = \"1\" ]; then\r\n echo \"Installing WordPress...\"\r\n cd \/mnt\/server\/webroot || exit 1\r\n if wget -q http:\/\/wordpress.org\/latest.tar.gz; then\r\n tar xzf latest.tar.gz && mv wordpress\/* . && rm -rf wordpress latest.tar.gz\r\n echo \"WordPress installation complete. Visit http:\/\/ip:port\/wp-admin\"\r\n else\r\n echo \"Failed to download WordPress\"; exit 1\r\n fi\r\n exit 0\r\nelse\r\n echo \"Installation complete. Visit http:\/\/ip:port\/\"\r\nfi\r\n\r\n# Check for user-uploaded content\r\nif [ \"${USER_UPLOAD}\" = \"true\" ] || [ \"${USER_UPLOAD}\" = \"1\" ]; then\r\n echo \"User upload enabled. Assuming custom setup.\"\r\n exit 0\r\nfi\r\n\r\n# Configure Git repository if provided\r\ncd \/mnt\/server\/webroot || exit 1\r\n\r\n# Ensure .git extension for GIT_ADDRESS\r\n[ \"${GIT_ADDRESS##*.}\" != \"git\" ] && GIT_ADDRESS=\"${GIT_ADDRESS}.git\"\r\n\r\n# Authenticate if username and access token are provided\r\nif [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_ADDRESS#https:\/\/}\"\r\nfi\r\n\r\n# Handle Git repository cloning or updating\r\nif [ -n \"$(ls -A \/mnt\/server\/webroot 2>\/dev\/null)\" ]; then\r\n echo \"\/mnt\/server\/webroot directory is not empty.\"\r\n if [ -d .git ] && [ -f .git\/config ]; then\r\n ORIGIN=$(git config --get remote.origin.url)\r\n if [ \"${ORIGIN}\" = \"${GIT_ADDRESS}\" ]; then\r\n echo \"Pulling latest changes from GitHub\"\r\n git pull || { echo \"Git pull failed\"; exit 1; }\r\n else\r\n echo \"Different Git origin detected; skipping pull to avoid conflicts.\"\r\n fi\r\n else\r\n echo \"Directory contains files without a Git configuration.\"\r\n exit 10\r\n fi\r\nelse\r\n echo \"\/mnt\/server\/webroot is empty. Cloning repository...\"\r\n if [ -n \"${BRANCH}\" ]; then\r\n echo \"Cloning branch ${BRANCH}\"\r\n git clone --single-branch --branch \"${BRANCH}\" \"${GIT_ADDRESS}\" .\r\n else\r\n echo \"Cloning default branch\"\r\n git clone \"${GIT_ADDRESS}\" .\r\n fi\r\nfi", "script": "#!\/bin\/ash\r\n\r\n# Set working directory\r\ncd \/mnt\/server || exit 1\r\napk --update add git unzip curl || { echo \"Failed to install Git and required packages\"; exit 1; }\r\n\r\n# Clone the repository containing nginx and php configurations\r\nif git clone https:\/\/github.com\/Sigma-Production\/ptero-eggs .\/temp; then\r\n cp -r .\/temp\/nginx .\/temp\/php-fpm .\/temp\/webroot \/mnt\/server\/\r\n cp .\/temp\/start.sh \/mnt\/server\/\r\n chmod +x \/mnt\/server\/start.sh\r\n rm -rf .\/temp\r\nelse\r\n echo \"Failed to clone repository\"; exit 1\r\nfi\r\n\r\n# Prepare directories\r\nmkdir -p \/mnt\/server\/tmp \/mnt\/server\/logs\r\n\r\n# WordPress installation\r\nif [ \"${WORDPRESS}\" = \"true\" ] || [ \"${WORDPRESS}\" = \"1\" ]; then\r\n echo \"Installing WordPress...\"\r\n cd \/mnt\/server\/webroot || exit 1\r\n if wget -q https:\/\/wordpress.org\/latest.zip; then\r\n unzip latest.zip && mv wordpress\/* . && rm -rf wordpress latest.zip\r\n echo \"WordPress installation complete. Visit http:\/\/ip:port\/wp-admin\"\r\n else\r\n echo \"Failed to download WordPress\"; exit 1\r\n fi\r\n exit 0\r\nfi\r\n\r\n# NamelessMC installation\r\nif [ \"${NAMELESSMC}\" = \"true\" ] || [ \"${NAMELESSMC}\" = \"1\" ]; then\r\n echo \"Installing NamelessMC...\"\r\n cd \/mnt\/server\/webroot || exit 1\r\n curl -L \"https:\/\/github.com\/NamelessMC\/Nameless\/releases\/latest\/download\/nameless-deps-dist.tar.xz\" | \\\r\n tar -xJ -C \/mnt\/server\/webroot || { echo \"Failed to download or extract NamelessMC\"; exit 1; }\r\n\r\n # Configure Nginx for NamelessMC\r\n echo \"Configuring Nginx for NamelessMC...\"\r\n cd \/mnt\/server\/nginx\/conf.d || { echo \"Failed to navigate to Nginx configuration directory\"; exit 1; }\r\n rm -f default.conf # Remove the default configuration file if it exists\r\n curl -LO https:\/\/raw.githubusercontent.com\/Sigma-Production\/ptero-eggs\/NamelessMC\/nginx\/conf.d\/default.conf || { echo \"Failed to download Nginx configuration\"; exit 1; }\r\n \r\n echo \"NamelessMC installation and configuration completed.\"\r\n exit 0\r\nfi\r\n\r\n# Check for user-uploaded content\r\nif [ \"${USER_UPLOAD}\" = \"true\" ] || [ \"${USER_UPLOAD}\" = \"1\" ]; then\r\n echo \"User upload enabled. Assuming custom setup.\"\r\n exit 0\r\nfi\r\n\r\n# Configure Git repository if provided\r\ncd \/mnt\/server\/webroot || exit 1\r\n\r\n# Ensure .git extension for GIT_ADDRESS\r\n[ \"${GIT_ADDRESS##*.}\" != \"git\" ] && GIT_ADDRESS=\"${GIT_ADDRESS}.git\"\r\n\r\n# Authenticate if username and access token are provided\r\nif [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_ADDRESS#https:\/\/}\"\r\nfi\r\n\r\n# Handle Git repository cloning or updating\r\nif [ -n \"$(ls -A \/mnt\/server\/webroot 2>\/dev\/null)\" ]; then\r\n echo \"\/mnt\/server\/webroot directory is not empty.\"\r\n if [ -d .git ] && [ -f .git\/config ]; then\r\n ORIGIN=$(git config --get remote.origin.url)\r\n if [ \"${ORIGIN}\" = \"${GIT_ADDRESS}\" ]; then\r\n echo \"Pulling latest changes from GitHub\"\r\n git pull || { echo \"Git pull failed\"; exit 1; }\r\n else\r\n echo \"Different Git origin detected; skipping pull to avoid conflicts.\"\r\n fi\r\n else\r\n echo \"Directory contains files without a Git configuration.\"\r\n exit 10\r\n fi\r\nelse\r\n echo \"\/mnt\/server\/webroot is empty. Cloning repository...\"\r\n if [ -n \"${BRANCH}\" ]; then\r\n echo \"Cloning branch ${BRANCH}\"\r\n git clone --single-branch --branch \"${BRANCH}\" \"${GIT_ADDRESS}\" .\r\n else\r\n echo \"Cloning default branch\"\r\n git clone \"${GIT_ADDRESS}\" .\r\n fi\r\nfi\r\n\r\necho \"Installation complete. Visit http:\/\/ip:port\/\"",
"container": "alpine:latest", "container": "alpine:latest",
"entrypoint": "ash" "entrypoint": "ash"
} }
@@ -121,6 +121,16 @@
"user_editable": true, "user_editable": true,
"rules": "nullable|string", "rules": "nullable|string",
"field_type": "text" "field_type": "text"
},
{
"name": "NamelessMC install",
"description": "Enable this if you want to install namelessmc.\r\n\r\nhttps:\/\/namelessmc.com\/",
"env_variable": "NAMELESSMC",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
} }
] ]
} }