From a626299ce82768fe93705182cf9af27c1f39f969 Mon Sep 17 00:00:00 2001 From: Mkkbeydoun Date: Sat, 31 Oct 2026 14:32:04 -0400 Subject: [PATCH 1/2] split into plain and git eggs, organise variables --- .github/workflows/ci.yml | 29 ++- .github/workflows/release-egg.yml | 71 ++++--- README.md | 100 +++++----- egg-nginx-webhost-git.json | 304 ++++++++++++++++++++++++++++++ egg-nginx-webhost.json | 186 ++++++++---------- php-fpm/fpm.pool.d/www.conf | 4 +- start.sh | 12 +- 7 files changed, 518 insertions(+), 188 deletions(-) create mode 100644 egg-nginx-webhost-git.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbec4ec..0ebf89a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,18 +11,29 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Validate the egg + - name: Validate the eggs run: | - jq -e '.meta.version == "PTDL_v2"' egg-nginx-webhost.json >/dev/null - # tr: the panel saves the install script with Windows line endings - version=$(jq -r '.scripts.installation.script' egg-nginx-webhost.json \ - | tr -d '\r' \ - | sed -n 's/^EGG_VERSION="\([^"]*\)"$/\1/p' | head -n 1) - if [ -z "${version}" ]; then - echo "::error::EGG_VERSION not found in the egg's install script" + for egg in egg-nginx-webhost.json egg-nginx-webhost-git.json; do + jq -e '.meta.version == "PTDL_v2"' "${egg}" >/dev/null + # tr: the panel saves the install script with Windows line endings + version=$(jq -r '.scripts.installation.script' "${egg}" \ + | tr -d '\r' \ + | sed -n 's/^EGG_VERSION="\([^"]*\)"$/\1/p' | head -n 1) + if [ -z "${version}" ]; then + echo "::error::EGG_VERSION not found in ${egg}'s install script" + exit 1 + fi + echo "${egg}: version ${version}" + done + + # The two eggs only differ in name, description, update URL and the WordPress/Git + # variables; everything else has to stay the same in both + shared='{scripts, docker_images, startup, config, features, file_denylist, + variables: [.variables[] | select(.env_variable | test("^(WORDPRESS|GIT_ADDRESS|BRANCH|USERNAME|ACCESS_TOKEN|AUTO_UPDATE)$") | not)]}' + if ! diff <(jq -S "${shared}" egg-nginx-webhost.json) <(jq -S "${shared}" egg-nginx-webhost-git.json); then + echo "::error::egg-nginx-webhost.json and egg-nginx-webhost-git.json differ in a part they should share (shown above)" exit 1 fi - echo "Egg version ${version}" - uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/release-egg.yml b/.github/workflows/release-egg.yml index ee15cb5..013ba8e 100644 --- a/.github/workflows/release-egg.yml +++ b/.github/workflows/release-egg.yml @@ -1,18 +1,21 @@ name: Release egg -# Publishes egg-nginx-webhost.json as a GitHub release named after the EGG_VERSION in its -# install script (e.g. v1.0.0). Bump EGG_VERSION to make a new release. -# The egg is attached twice: egg-nginx-webhost-.json to download, and -# egg-nginx-webhost.json, which servers' update checks fetch from the latest release. +# Publishes the eggs as a GitHub release named after the EGG_VERSION in their install script +# (e.g. v1.0.0). Bump EGG_VERSION to make a new release. Attached: +# egg-nginx-webhost-.json Nginx Webhost, to download +# egg-nginx-webhost-git-.json Nginx Webhost (Git), to download +# egg-nginx-webhost.json Nginx Webhost again, servers' update checks fetch it +# from the latest release by this name on: push: branches: [main] paths: - "egg-nginx-webhost.json" + - "egg-nginx-webhost-git.json" workflow_dispatch: inputs: republish: - description: "Replace the egg in this version's existing release without bumping EGG_VERSION" + description: "Replace the eggs in this version's existing release without bumping EGG_VERSION" type: boolean default: false @@ -49,48 +52,68 @@ jobs: TAG: v${{ steps.egg.outputs.version }} REPUBLISH: ${{ inputs.republish }} run: | - name="egg-nginx-webhost-${TAG#v}.json" - versioned="${RUNNER_TEMP}/${name}" - cp egg-nginx-webhost.json "${versioned}" + assets="${RUNNER_TEMP}/assets" + mkdir -p "${assets}" + cp egg-nginx-webhost.json "${assets}/egg-nginx-webhost-${TAG#v}.json" + cp egg-nginx-webhost-git.json "${assets}/egg-nginx-webhost-git-${TAG#v}.json" + cp egg-nginx-webhost.json "${assets}/egg-nginx-webhost.json" if [ "$(gh release view "${TAG}" --json isDraft --jq .isDraft 2>/dev/null)" = "false" ]; then - gh release download "${TAG}" --pattern egg-nginx-webhost.json --output "${RUNNER_TEMP}/released.json" - if cmp -s egg-nginx-webhost.json "${RUNNER_TEMP}/released.json"; then - # Releases made before the versioned file existed get it added - if gh release view "${TAG}" --json assets --jq '.assets[].name' | grep -qxF "${name}"; then - echo "Release ${TAG} already exists with this egg, nothing to do." + released=$(gh release view "${TAG}" --json assets --jq '.assets[].name') + changed="" + missing="" + for file in "${assets}"/*.json; do + name=$(basename "${file}") + if ! printf '%s\n' "${released}" | grep -qxF "${name}"; then + missing="${missing} ${file}" + continue + fi + rm -f "${RUNNER_TEMP}/released.json" + gh release download "${TAG}" --pattern "${name}" --output "${RUNNER_TEMP}/released.json" + cmp -s "${file}" "${RUNNER_TEMP}/released.json" || changed="${changed} ${name}" + done + + if [ -z "${changed}" ]; then + # Releases made before a file existed get it added + if [ -n "${missing}" ]; then + gh release upload "${TAG}" ${missing} + echo "Added${missing//${assets}\//} to release ${TAG}." else - gh release upload "${TAG}" "${versioned}" - echo "Added ${name} to release ${TAG}." + echo "Release ${TAG} already exists with these eggs, nothing to do." fi exit 0 fi if [ "${REPUBLISH}" = "true" ]; then - # Run by hand with "republish": swap the egg in the existing release. The tag + # Run by hand with "republish": swap the eggs in the existing release. The tag # stays where it is, release tags are protected and can't be moved - gh release upload "${TAG}" egg-nginx-webhost.json "${versioned}" --clobber - echo "Replaced the egg in release ${TAG}." + gh release upload "${TAG}" "${assets}"/*.json --clobber + echo "Replaced the eggs in release ${TAG}." exit 0 fi - echo "::error::egg-nginx-webhost.json changed but EGG_VERSION is still ${TAG#v}. Bump EGG_VERSION, or run this workflow by hand with \"republish\" ticked to replace the egg in ${TAG}." + echo "::error::${changed# } changed but EGG_VERSION is still ${TAG#v}. Bump EGG_VERSION, or run this workflow by hand with \"republish\" ticked to replace the eggs in ${TAG}." exit 1 fi cat > notes.md <<'EOF' ## Install - 1. Download `EGG_FILE` below. + 1. Download the egg you want below: + - `EGG_FILE`: **Nginx Webhost**, you upload the site yourself or install WordPress + - `GIT_EGG_FILE`: **Nginx Webhost (Git)**, the site is cloned from a Git repo 2. In the panel: **Admin → Nests → Import Egg**, upload it. 3. Create a server with the egg, pick a PHP version (Docker Image), and visit `http://ip:port`. ## Update from an older version - **Admin → Nests → (nest) → Nginx Webhost → Update Egg** with this file (not Import Egg, that makes a second copy), then **Reinstall** your servers. + **Admin → Nests → (nest) → the egg → Update Egg** with its file (not Import Egg, that makes a second copy), then **Reinstall** your servers. Reinstalling replaces `nginx/`, `php-fpm/` and `start.sh` on each server (`webroot/` is kept), so back up any edits to them first. - `egg-nginx-webhost.json` is the same file, kept for the servers' update check. + `egg-nginx-webhost.json` is the same file as `EGG_FILE`, kept for the servers' update check. EOF - sed -i "s/EGG_FILE/${name}/" notes.md - gh release create "${TAG}" "${versioned}" egg-nginx-webhost.json \ + sed -i "s/GIT_EGG_FILE/egg-nginx-webhost-git-${TAG#v}.json/; s/EGG_FILE/egg-nginx-webhost-${TAG#v}.json/g" notes.md + gh release create "${TAG}" \ + "${assets}/egg-nginx-webhost-${TAG#v}.json" \ + "${assets}/egg-nginx-webhost-git-${TAG#v}.json" \ + "${assets}/egg-nginx-webhost.json" \ --title "${TAG}" \ --notes-file notes.md \ --target "${GITHUB_SHA}" diff --git a/README.md b/README.md index c89d75a..5417d19 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,21 @@ [![Build images](https://github.com/Rustix-Development/pterodactyl-nginx-egg/actions/workflows/build-images.yml/badge.svg)](https://github.com/Rustix-Development/pterodactyl-nginx-egg/actions/workflows/build-images.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) -A [Pterodactyl](https://pterodactyl.io) egg for hosting PHP and static websites with -**nginx 1.30** and **PHP 8.3 / 8.4 / 8.5** on PHP-FPM. - -- **Upload or deploy from Git**: upload files into `webroot/`, or clone a Git repo - (public or private) and optionally pull it on every start -- **WordPress**: turn on *Wordpress* when creating the server and it's downloaded for you -- **Composer**: list packages in *Composer modules* and they're installed into `webroot/` -- **Site variables**: SMTP / mail, site name and URL, Discord and Google OAuth and a database - connection string are passed to PHP, so your code reads them with `getenv()` instead of - hardcoding them +[Pterodactyl](https://pterodactyl.io) eggs for hosting PHP and static websites with +**nginx 1.30** and **PHP 8.3 / 8.4 / 8.5** on PHP-FPM. There are two, pick one per server: + +| Egg | File | For | +|-----|------|-----| +| **Nginx Webhost** | `egg-nginx-webhost-.json` | You upload the site yourself (SFTP or the file manager), or install WordPress | +| **Nginx Webhost (Git)** | `egg-nginx-webhost-git-.json` | The site is cloned from a Git repo (public or private), optionally pulled on every start | + +Both use the same image, config files and startup script. + +- **WordPress** (Nginx Webhost): turn on *Website · WordPress* when creating the server and it's downloaded for you +- **Composer**: list packages in *Website · Composer Modules* and they're installed into `webroot/` +- **Site variables**: site name and URL, Google Analytics, SMTP / mail, Cloudflare Turnstile, + Discord and Google OAuth and a database connection string are passed to PHP, so your code + reads them with `getenv()` instead of hardcoding them - **Update check**: the console says when the egg or the Docker image has an update - **Maintained images**: Debian based with PHP from packages.sury.org, `amd64` and `arm64`, rebuilt weekly for nginx and PHP security fixes @@ -27,33 +32,39 @@ A [Pterodactyl](https://pterodactyl.io) egg for hosting PHP and static websites ## Install -1. Download `egg-nginx-webhost-.json` from the - [latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest). -2. In the panel: **Admin → Nests → Import Egg**, upload it into the nest you want. +1. Download `egg-nginx-webhost-.json`, `egg-nginx-webhost-git-.json` or + both from the [latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest). +2. In the panel: **Admin → Nests → Import Egg**, upload each one into the nest you want. 3. Create a server with the egg and pick a PHP version under **Docker Image**. 4. Once it has installed, start it and visit `http://:`. You should see the - "Web server is running" page; replace it by uploading your site into `webroot/`. + "Web server is running" page (or your site, with the Git egg); with Nginx Webhost, replace + it by uploading your site into `webroot/`. The server listens on its primary allocation. To serve a domain over HTTPS, put a reverse proxy (nginx, Caddy, Cloudflare, ...) in front of that port. ## Variables -All variables can be changed later under the server's **Startup** tab. The site variables -only reach your PHP code; the egg itself doesn't use them, so leave the ones you don't need -blank. +All variables can be changed later under the server's **Startup** tab. Each name starts +with its section (*Website*, *Git*, *Site*, *Mail*, *Forms*, *Login*, *Database*, +*System*) so they stay grouped in the panel. The site variables only reach your PHP code; +the egg itself doesn't use them, so leave the ones you don't need blank. ### Website | Variable | Default | What it does | |----------|---------|--------------| -| Wordpress (`WORDPRESS`) | `0` | Install WordPress into an empty `webroot/`. Finish setup at `/wp-admin` | -| Composer modules (`COMPOSER_MODULES`) | | Space separated packages, e.g. `phpmailer/phpmailer vlucas/phpdotenv`. Pin a version with `vendor/package:^6.0` | -| Root Folder (`ROOT_FOLDER`) | | Folder in `webroot/` to serve at your domain's root, see [below](#serving-a-folder-at-the-root). Blank serves `webroot/` as is | -| 404 Page (`ERROR_404_PAGE`) | | Page to show for missing pages, see [below](#custom-404-page). Blank keeps sending them to `index.php` | -| User Uploaded Files (`USER_UPLOAD`) | `0` | Skip the Git setup, you upload the files yourself | -| Update Check (`UPDATE_CHECK`) | `1` | Say in the console when the egg or the Docker image has an update | -| Startup Command (`STARTUP_CMD`) | `./start.sh` | Leave as is unless you know you need to change it | +| Website · Root Folder (`ROOT_FOLDER`) | | Folder in `webroot/` to serve at your domain's root, see [below](#serving-a-folder-at-the-root). Blank serves `webroot/` as is | +| Website · 404 Page (`ERROR_404_PAGE`) | | Page to show for missing pages, see [below](#custom-404-page). Blank keeps sending them to `index.php` | +| Website · Composer Modules (`COMPOSER_MODULES`) | | Space separated packages, e.g. `phpmailer/phpmailer vlucas/phpdotenv`. Pin a version with `vendor/package:^6.0` | +| Website · WordPress (`WORDPRESS`) | `0` | Nginx Webhost only. Install WordPress into an empty `webroot/`. Finish setup at `/wp-admin` | + +### System + +| Variable | Default | What it does | +|----------|---------|--------------| +| System · Update Check (`UPDATE_CHECK`) | `1` | Say in the console when the egg or the Docker image has an update | +| System · Startup Command (`STARTUP_CMD`) | `./start.sh` | Leave as is unless you know you need to change it | Each Composer package is added once and then kept at that version. On every start `composer install` keeps `vendor/` in line with `composer.lock`. @@ -103,31 +114,33 @@ path is from your site's root: `webroot/`, or the **Root Folder** if you set one - If the page doesn't exist, visitors get nginx's plain 404 and the console says so. - Needs a **Reinstall** first on servers installed before the egg had this option. -### Git +### Git (Nginx Webhost (Git) only) | Variable | Default | What it does | |----------|---------|--------------| -| Git Repo Address (`GIT_ADDRESS`) | | Repo to clone your site from, e.g. `https://github.com/you/your-site` | -| Git Branch (`BRANCH`) | | Branch to clone; blank uses the repo's default branch | -| Auto Update (`AUTO_UPDATE`) | `0` | `git pull` on every start | -| Git Username (`USERNAME`) | | For private repos | -| Git Access Token (`ACCESS_TOKEN`) | | For private repos; use a personal access token, not your password | +| Git · Repo Address (`GIT_ADDRESS`) | | Repo to clone your site from, e.g. `https://github.com/you/your-site` | +| Git · Branch (`BRANCH`) | | Branch to clone; blank uses the repo's default branch | +| Git · Username (`USERNAME`) | | For private repos | +| Git · Access Token (`ACCESS_TOKEN`) | | For private repos; use a personal access token, not your password | +| Git · Auto Update (`AUTO_UPDATE`) | `0` | `git pull` on every start | The repo is only cloned into an empty `webroot/`. If `webroot/` is already a clone of the same repo, a reinstall pulls it; any other files are left alone. ### Site variables (read with `getenv()`) -| Variable | Default | Typical use | -|----------|---------|-------------| -| `SMTP_HOST`, `SMTP_PORT` | `smtp.resend.com`, `465` | Mail server. For Gmail / Google Workspace use `smtp.gmail.com` and `587` | -| `SMTP_USERNAME`, `SMTP_PASSWORD` | `resend`, | Mail login. For Resend, the password is your API key; for Gmail, an App Password | -| `MAIL_FROM_EMAIL`, `MAIL_FROM_NAME` | | Sender address and name | -| `MAIL_TO_EMAIL` | | Where contact form mail goes | -| `SITE_NAME`, `SITE_URL` | `Website`, | Your site's name and public URL (no trailing slash) | -| `DISCORD_CLIENT_ID`, `DISCORD_CLIENT_SECRET` | | Discord OAuth2 login | -| `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` | | Google OAuth2 login | -| `DB_CONNECTION_STRING` | | Database URL, e.g. `mysql://user:pass@host:3306/db` | +| Section | Variables | Default | Typical use | +|---------|-----------|---------|-------------| +| Site | `SITE_NAME`, `SITE_URL` | `Website`, | Your site's name and public URL (no trailing slash) | +| Site | `GA_MEASUREMENT_ID` | | Google Analytics 4 Measurement ID, e.g. `G-XXXXXXXXXX` | +| Mail | `SMTP_HOST`, `SMTP_PORT` | `smtp.resend.com`, `465` | Mail server. For Gmail / Google Workspace use `smtp.gmail.com` and `587` | +| Mail | `SMTP_USERNAME`, `SMTP_PASSWORD` | `resend`, | Mail login. For Resend, the password is your API key; for Gmail, an App Password | +| Mail | `MAIL_FROM_EMAIL`, `MAIL_FROM_NAME` | | Sender address and name | +| Mail | `MAIL_TO_EMAIL` | | Where contact form mail goes | +| Forms | `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | | Cloudflare Turnstile bot check on forms | +| Login | `DISCORD_CLIENT_ID`, `DISCORD_CLIENT_SECRET` | | Discord OAuth2 login | +| Login | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` | | Google OAuth2 login | +| Database | `DB_CONNECTION_STRING` | | Database URL, e.g. `mysql://user:pass@host:3306/db` | ```php .json` from the +- **the egg has an update**: download `egg-nginx-webhost-.json` (or + `egg-nginx-webhost-git-.json` for the Git egg) from the [latest release](https://github.com/Rustix-Development/pterodactyl-nginx-egg/releases/latest), then - **Admin → Nests → (nest) → Nginx Webhost → Update Egg** with it (not *Import Egg*, that + **Admin → Nests → (nest) → the egg → Update Egg** with it (not *Import Egg*, that makes a second copy), and **Reinstall** the server. - **the Docker image has an update**: restart the server, the panel downloads the latest image on every start. If it keeps showing, run @@ -185,7 +199,7 @@ Every time a server starts it checks for updates in the background and says in t egg's images: **Admin → Servers → server → Startup → Docker Image**, pick one of the egg's images. -Turn it off per server with the *Update Check* variable. +Turn it off per server with the *System · Update Check* variable. ## Troubleshooting diff --git a/egg-nginx-webhost-git.json b/egg-nginx-webhost-git.json new file mode 100644 index 0000000..6352dc1 --- /dev/null +++ b/egg-nginx-webhost-git.json @@ -0,0 +1,304 @@ +{ + "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", + "meta": { + "version": "PTDL_v2", + "update_url": "https:\/\/raw.githubusercontent.com\/Rustix-Development\/pterodactyl-nginx-egg\/HEAD\/egg-nginx-webhost-git.json" + }, + "exported_at": "2026-10-09T19:55:59+00:00", + "name": "Nginx Webhost (Git)", + "author": "mohamed@rustix.xyz", + "description": "Host any PHP or static website with nginx + PHP-FPM, cloned from a Git repo.\n\n- Git: clone your site from a Git repo, optionally pulling updates on every start\n- Composer: list packages in \"Website \u00b7 Composer Modules\" and they're installed on startup\n- Site, Mail, Forms, Login and Database variables are passed to PHP, so sites read them with getenv() instead of hardcoding them\n\nUploading the files yourself or using WordPress? Use the Nginx Webhost egg instead.\n\nBased on the WebHost egg by Sigma Productions (originally tenten8401\/pterodactyl-nginx).", + "features": [], + "docker_images": { + "PHP 8.5": "ghcr.io\/rustix-development\/pterodactyl-nginx-egg:php8.5", + "PHP 8.4": "ghcr.io\/rustix-development\/pterodactyl-nginx-egg:php8.4", + "PHP 8.3": "ghcr.io\/rustix-development\/pterodactyl-nginx-egg:php8.3" + }, + "file_denylist": [], + "startup": "{{STARTUP_CMD}}", + "config": { + "files": "{\r\n \"nginx\/conf.d\/default.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \" listen \": \" listen {{server.build.default.port}};\"\r\n }\r\n }\r\n}", + "startup": "{\n \"done\": \"Web server is running\",\n \"userInteraction\": []\n}", + "logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}", + "stop": "^C" + }, + "scripts": { + "installation": { + "script": "#!\/bin\/ash\n# Nginx Webhost installer: installs the nginx\/PHP config and sets up the website files.\n\n# Bump this whenever the egg or the repo's config files change. Servers compare it with\n# the egg on GitHub at startup and show an update notice in the console.\nEGG_VERSION=\"1.0.6\"\n\nREPO=\"https:\/\/github.com\/Rustix-Development\/pterodactyl-nginx-egg\"\n\nis_true() { [ \"$1\" = \"1\" ] || [ \"$1\" = \"true\" ]; }\n\n# Drop user:token@ from a git URL so a changed token still counts as the same repo\nstrip_auth() { printf '%s' \"$1\" | sed -E 's#^([a-z]+:\/\/)[^\/@]*@#\\1#'; }\n\ntrap 'rm -rf \/tmp\/egg' EXIT\n\n# The install container has a terminal nobody types into: never wait for a git password\nexport GIT_TERMINAL_PROMPT=0\n\ncd \/mnt\/server || exit 1\napk add --no-cache git curl || { echo \"Failed to install git and curl\"; exit 1; }\n# Server files belong to the server user, not root; let git work on them anyway\ngit config --global --add safe.directory '*'\n\necho \"Downloading config files from ${REPO}\"\nrm -rf \/tmp\/egg\ngit clone --depth 1 \"${REPO}\" \/tmp\/egg || { echo \"Failed to download config files\"; exit 1; }\nif [ ! -f \/tmp\/egg\/start.sh ] || [ ! -d \/tmp\/egg\/nginx ] || [ ! -d \/tmp\/egg\/php-fpm ]; then\n echo \"Config files are missing from ${REPO} (empty repo or wrong default branch?)\"\n exit 1\nfi\n\n# Config files are replaced on every (re)install\ncp -r \/tmp\/egg\/nginx \/tmp\/egg\/php-fpm \/mnt\/server\/ \\\n && cp \/tmp\/egg\/start.sh \/mnt\/server\/start.sh \\\n && chmod +x \/mnt\/server\/start.sh \\\n || { echo \"Failed to copy config files\"; exit 1; }\n# Left behind by older versions of this egg, it stops nginx from starting\nrm -f \/mnt\/server\/nginx\/conf.d\/nextcloud.conf\nmkdir -p \/mnt\/server\/webroot \/mnt\/server\/tmp \/mnt\/server\/logs\necho \"${EGG_VERSION}\" > \/mnt\/server\/.egg-version\necho \"Installed Nginx Webhost egg v${EGG_VERSION} config files\"\n\ncd \/mnt\/server\/webroot || exit 1\n\n# A default landing page (this egg's or an older egg's) doesn't count as a website\nif [ \"$(ls -A)\" = \"index.php\" ] && grep -qE 'Web server is running<\/h1>|Webserver Correctly Installed' index.php; then\n rm -f index.php\nfi\n\nseed_default_page() {\n if [ -z \"$(ls -A)\" ]; then\n cp \/tmp\/egg\/webroot\/index.php .\/\n fi\n}\n\n# WordPress\nif is_true \"${WORDPRESS}\"; then\n if [ -f wp-load.php ]; then\n echo \"WordPress is already installed, leaving it alone.\"\n elif [ -n \"$(ls -A)\" ]; then\n echo \"webroot already has files, not installing WordPress over them.\"\n else\n echo \"Installing WordPress...\"\n # Unpack outside webroot so a broken download never leaves files behind in it\n WP_TMP=\/mnt\/server\/.wordpress-download\n rm -rf \"${WP_TMP}\" && mkdir -p \"${WP_TMP}\"\n if ! curl -fsSL https:\/\/wordpress.org\/latest.tar.gz | tar xz -C \"${WP_TMP}\" || [ ! -f \"${WP_TMP}\/wordpress\/wp-load.php\" ]; then\n rm -rf \"${WP_TMP}\"\n echo \"Failed to download WordPress\"\n exit 1\n fi\n cp -a \"${WP_TMP}\/wordpress\/.\" . && rm -rf \"${WP_TMP}\"\n echo \"WordPress installed. Finish setup at http:\/\/ip:port\/wp-admin\"\n fi\n exit 0\nfi\n\nif is_true \"${USER_UPLOAD}\"; then\n seed_default_page\n echo \"User Uploaded Files is on, skipping website setup. Upload your files into webroot.\"\n exit 0\nfi\n\nif [ -z \"${GIT_ADDRESS}\" ]; then\n seed_default_page\n echo \"Install complete. No Git Repo Address set, upload your website into webroot.\"\n exit 0\nfi\n\n# Git\ncase \"${GIT_ADDRESS}\" in\n *.git) ;;\n *) GIT_ADDRESS=\"${GIT_ADDRESS}.git\" ;;\nesac\n\nif [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_ADDRESS#*:\/\/}\"\nfi\n\nif [ -n \"$(ls -A)\" ]; then\n if [ -d .git ]; then\n if [ \"$(strip_auth \"$(git config --get remote.origin.url)\")\" = \"$(strip_auth \"${GIT_ADDRESS}\")\" ]; then\n echo \"Pulling latest website files from git\"\n # Picks up a changed Git Username\/Access Token\n git remote set-url origin \"${GIT_ADDRESS}\"\n git pull --ff-only || echo \"git pull failed, keeping the current files.\"\n else\n echo \"webroot is a clone of a different git repo, leaving it alone.\"\n fi\n else\n echo \"webroot already has files that aren't from git, leaving them alone.\"\n fi\nelse\n echo \"Cloning website files from git\"\n if [ -n \"${BRANCH}\" ]; then\n git clone --single-branch --branch \"${BRANCH}\" \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address, Git Branch and credentials\"; exit 1; }\n else\n git clone \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address and credentials\"; exit 1; }\n fi\nfi\n\necho \"Install complete. Visit http:\/\/ip:port\/\"\n", + "container": "alpine:3.24", + "entrypoint": "ash" + } + }, + "variables": [ + { + "name": "Website \u00b7 Root Folder", + "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", + "env_variable": "ROOT_FOLDER", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", + "field_type": "text" + }, + { + "name": "Website \u00b7 404 Page", + "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", + "env_variable": "ERROR_404_PAGE", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", + "field_type": "text" + }, + { + "name": "Website \u00b7 Composer Modules", + "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", + "env_variable": "COMPOSER_MODULES", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git \u00b7 Repo Address", + "description": "Git repo to clone your website from.\n\nI.E. https:\/\/github.com\/your-name\/your-site\n\nLeave blank to upload files yourself.", + "env_variable": "GIT_ADDRESS", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git \u00b7 Branch", + "description": "What branch to pull from github.\r\n\r\nDefault is blank to pull the repo default branch", + "env_variable": "BRANCH", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git \u00b7 Username", + "description": "Username to auth with git.", + "env_variable": "USERNAME", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git \u00b7 Access Token", + "description": "Password to use with git.\r\n\r\nIt's best practice to use a Personal Access Token.\r\nhttps:\/\/github.com\/settings\/tokens\r\nhttps:\/\/gitlab.com\/-\/profile\/personal_access_tokens", + "env_variable": "ACCESS_TOKEN", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Git \u00b7 Auto Update", + "description": "Pull the latest files from the Git repo on every start.\n\n0 = false (default)\n1 = true", + "env_variable": "AUTO_UPDATE", + "default_value": "0", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" + }, + { + "name": "Site \u00b7 Name", + "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", + "env_variable": "SITE_NAME", + "default_value": "Website", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Site \u00b7 URL", + "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", + "env_variable": "SITE_URL", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Site \u00b7 Google Analytics ID", + "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", + "env_variable": "GA_MEASUREMENT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:20", + "field_type": "text" + }, + { + "name": "Mail \u00b7 SMTP Host", + "description": "SMTP server address used to send mail from this site.\r\n\r\nDefault works for Resend (recommended \u2014 works from any IP, no dedicated mailbox needed). Set to smtp.gmail.com for Gmail \/ Google Workspace instead.", + "env_variable": "SMTP_HOST", + "default_value": "smtp.resend.com", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Mail \u00b7 SMTP Port", + "description": "SMTP port. 465 (implicit TLS) is correct for Resend. Use 587 (STARTTLS) for Gmail \/ Google Workspace.", + "env_variable": "SMTP_PORT", + "default_value": "465", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|integer", + "field_type": "text" + }, + { + "name": "Mail \u00b7 SMTP Username", + "description": "The account that sends the mail.\r\n\r\nFor Resend this is always literally \"resend\" (not an email address). For Gmail\/Workspace this is the full mailbox address, e.g. info@yoursite.com.", + "env_variable": "SMTP_USERNAME", + "default_value": "resend", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Mail \u00b7 SMTP Password", + "description": "For Resend: your Resend API key (starts with \"re_\").\r\n\r\nFor Gmail \/ Google Workspace: an App Password for the mailbox above, no spaces \u2014 requires 2-Step Verification first: https:\/\/myaccount.google.com\/apppasswords. Never a normal account password.", + "env_variable": "SMTP_PASSWORD", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Mail \u00b7 From Email", + "description": "The address mail appears to come FROM, e.g. noreply@yoursite.com. Required for Resend (must be on a domain you've verified with them). For Gmail\/Workspace, leave blank to default to SMTP Username.", + "env_variable": "MAIL_FROM_EMAIL", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Mail \u00b7 From Name", + "description": "The display name shown as the sender on outgoing mail, e.g. \"My Site\".\r\n\r\nLeave blank to fall back to \"{Site \u00b7 Name} Contact Form\".", + "env_variable": "MAIL_FROM_NAME", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Mail \u00b7 To Email", + "description": "Where contact form submissions actually land, usually the office inbox for this site.", + "env_variable": "MAIL_TO_EMAIL", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Forms \u00b7 Turnstile Site Key", + "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", + "env_variable": "TURNSTILE_SITE_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Forms \u00b7 Turnstile Secret Key", + "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", + "env_variable": "TURNSTILE_SECRET_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Login \u00b7 Discord Client ID", + "description": "OAuth2 Client ID from your app at https:\/\/discord.com\/developers\/applications.\r\n\r\nLeave both this and Login \u00b7 Discord Client Secret blank to keep Discord login disabled.", + "env_variable": "DISCORD_CLIENT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Login \u00b7 Discord Client Secret", + "description": "OAuth2 Client Secret from the same Discord application (OAuth2 tab). Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL in that app's OAuth2 settings: {Site \u00b7 URL}\/discord-callback\/", + "env_variable": "DISCORD_CLIENT_SECRET", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Login \u00b7 Google Client ID", + "description": "OAuth2 Client ID from a Web application client at https:\/\/console.cloud.google.com\/apis\/credentials.\r\n\r\nLeave both this and Login \u00b7 Google Client Secret blank to keep Google login disabled. Unlike Discord, Google sign-in never creates a new account \u2014 it only works for someone whose Google email already matches an existing staff account.", + "env_variable": "GOOGLE_CLIENT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Login \u00b7 Google Client Secret", + "description": "OAuth2 Client Secret from the same Google Cloud OAuth client. Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL as an \"Authorized redirect URI\" on that client: {Site \u00b7 URL}\/google-callback\/", + "env_variable": "GOOGLE_CLIENT_SECRET", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Database \u00b7 Connection String", + "description": "Paste your database connection string here \u2014 same format the panel's own DB_CONNECTION_STRING auto-injects (e.g. \"jdbc:mysql:\/\/user:pass@host:port\/dbname\"), or a plain \"mysql:\/\/user:pass@host:port\/dbname\", or a PDO-style \"mysql:host=X;port=Y;dbname=Z;user=U;password=P\". Leave blank to rely on the panel's automatic database attachment instead.", + "env_variable": "DB_CONNECTION_STRING", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "System \u00b7 Update Check", + "description": "Check GitHub on startup and say in the console when the egg or the Docker image has an update.\n\n0 = false\n1 = true (default)", + "env_variable": "UPDATE_CHECK", + "default_value": "1", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" + }, + { + "name": "System \u00b7 Startup Command", + "description": "The command to startup the egg \r\n(Do not change if you do not know what you are doing!)", + "env_variable": "STARTUP_CMD", + "default_value": ".\/start.sh", + "user_viewable": true, + "user_editable": true, + "rules": "required|string", + "field_type": "text" + } + ] +} diff --git a/egg-nginx-webhost.json b/egg-nginx-webhost.json index 5633d84..886862b 100644 --- a/egg-nginx-webhost.json +++ b/egg-nginx-webhost.json @@ -7,7 +7,7 @@ "exported_at": "2026-10-09T19:55:59+00:00", "name": "Nginx Webhost", "author": "mohamed@rustix.xyz", - "description": "Host any PHP or static website with nginx + PHP-FPM.\n\n- Composer: list packages in \"Composer modules\" and they're installed on startup\n- WordPress: turn on the WordPress option when creating the server\n- Git: clone your site from a Git repo, optionally pulling updates on every start\n- Mail, Site, Discord, Google and database variables are passed to PHP, so sites read them with getenv() instead of hardcoding them\n\nBased on the WebHost egg by Sigma Productions (originally tenten8401\/pterodactyl-nginx).", + "description": "Host any PHP or static website with nginx + PHP-FPM. Upload your files over SFTP or the file manager, or install WordPress.\n\n- WordPress: turn on \"Website \u00b7 WordPress\" when creating the server\n- Composer: list packages in \"Website \u00b7 Composer Modules\" and they're installed on startup\n- Site, Mail, Forms, Login and Database variables are passed to PHP, so sites read them with getenv() instead of hardcoding them\n\nWant the site pulled from a Git repo? Use the Nginx Webhost (Git) egg instead.\n\nBased on the WebHost egg by Sigma Productions (originally tenten8401\/pterodactyl-nginx).", "features": [], "docker_images": { "PHP 8.5": "ghcr.io\/rustix-development\/pterodactyl-nginx-egg:php8.5", @@ -24,56 +24,36 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/ash\n# Nginx Webhost installer: installs the nginx\/PHP config and sets up the website files.\n\n# Bump this whenever the egg or the repo's config files change. Servers compare it with\n# the egg on GitHub at startup and show an update notice in the console.\nEGG_VERSION=\"1.0.5\"\n\nREPO=\"https:\/\/github.com\/Rustix-Development\/pterodactyl-nginx-egg\"\n\nis_true() { [ \"$1\" = \"1\" ] || [ \"$1\" = \"true\" ]; }\n\n# Drop user:token@ from a git URL so a changed token still counts as the same repo\nstrip_auth() { printf '%s' \"$1\" | sed -E 's#^([a-z]+:\/\/)[^\/@]*@#\\1#'; }\n\ntrap 'rm -rf \/tmp\/egg' EXIT\n\n# The install container has a terminal nobody types into: never wait for a git password\nexport GIT_TERMINAL_PROMPT=0\n\ncd \/mnt\/server || exit 1\napk add --no-cache git curl || { echo \"Failed to install git and curl\"; exit 1; }\n# Server files belong to the server user, not root; let git work on them anyway\ngit config --global --add safe.directory '*'\n\necho \"Downloading config files from ${REPO}\"\nrm -rf \/tmp\/egg\ngit clone --depth 1 \"${REPO}\" \/tmp\/egg || { echo \"Failed to download config files\"; exit 1; }\nif [ ! -f \/tmp\/egg\/start.sh ] || [ ! -d \/tmp\/egg\/nginx ] || [ ! -d \/tmp\/egg\/php-fpm ]; then\n echo \"Config files are missing from ${REPO} (empty repo or wrong default branch?)\"\n exit 1\nfi\n\n# Config files are replaced on every (re)install\ncp -r \/tmp\/egg\/nginx \/tmp\/egg\/php-fpm \/mnt\/server\/ \\\n && cp \/tmp\/egg\/start.sh \/mnt\/server\/start.sh \\\n && chmod +x \/mnt\/server\/start.sh \\\n || { echo \"Failed to copy config files\"; exit 1; }\n# Left behind by older versions of this egg, it stops nginx from starting\nrm -f \/mnt\/server\/nginx\/conf.d\/nextcloud.conf\nmkdir -p \/mnt\/server\/webroot \/mnt\/server\/tmp \/mnt\/server\/logs\necho \"${EGG_VERSION}\" > \/mnt\/server\/.egg-version\necho \"Installed Nginx Webhost egg v${EGG_VERSION} config files\"\n\ncd \/mnt\/server\/webroot || exit 1\n\n# A default landing page (this egg's or an older egg's) doesn't count as a website\nif [ \"$(ls -A)\" = \"index.php\" ] && grep -qE 'Web server is running<\/h1>|Webserver Correctly Installed' index.php; then\n rm -f index.php\nfi\n\nseed_default_page() {\n if [ -z \"$(ls -A)\" ]; then\n cp \/tmp\/egg\/webroot\/index.php .\/\n fi\n}\n\n# WordPress\nif is_true \"${WORDPRESS}\"; then\n if [ -f wp-load.php ]; then\n echo \"WordPress is already installed, leaving it alone.\"\n elif [ -n \"$(ls -A)\" ]; then\n echo \"webroot already has files, not installing WordPress over them.\"\n else\n echo \"Installing WordPress...\"\n # Unpack outside webroot so a broken download never leaves files behind in it\n WP_TMP=\/mnt\/server\/.wordpress-download\n rm -rf \"${WP_TMP}\" && mkdir -p \"${WP_TMP}\"\n if ! curl -fsSL https:\/\/wordpress.org\/latest.tar.gz | tar xz -C \"${WP_TMP}\" || [ ! -f \"${WP_TMP}\/wordpress\/wp-load.php\" ]; then\n rm -rf \"${WP_TMP}\"\n echo \"Failed to download WordPress\"\n exit 1\n fi\n cp -a \"${WP_TMP}\/wordpress\/.\" . && rm -rf \"${WP_TMP}\"\n echo \"WordPress installed. Finish setup at http:\/\/ip:port\/wp-admin\"\n fi\n exit 0\nfi\n\nif is_true \"${USER_UPLOAD}\"; then\n seed_default_page\n echo \"User Uploaded Files is on, skipping website setup. Upload your files into webroot.\"\n exit 0\nfi\n\nif [ -z \"${GIT_ADDRESS}\" ]; then\n seed_default_page\n echo \"Install complete. No Git Repo Address set, upload your website into webroot.\"\n exit 0\nfi\n\n# Git\ncase \"${GIT_ADDRESS}\" in\n *.git) ;;\n *) GIT_ADDRESS=\"${GIT_ADDRESS}.git\" ;;\nesac\n\nif [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_ADDRESS#*:\/\/}\"\nfi\n\nif [ -n \"$(ls -A)\" ]; then\n if [ -d .git ]; then\n if [ \"$(strip_auth \"$(git config --get remote.origin.url)\")\" = \"$(strip_auth \"${GIT_ADDRESS}\")\" ]; then\n echo \"Pulling latest website files from git\"\n # Picks up a changed Git Username\/Access Token\n git remote set-url origin \"${GIT_ADDRESS}\"\n git pull --ff-only || echo \"git pull failed, keeping the current files.\"\n else\n echo \"webroot is a clone of a different git repo, leaving it alone.\"\n fi\n else\n echo \"webroot already has files that aren't from git, leaving them alone.\"\n fi\nelse\n echo \"Cloning website files from git\"\n if [ -n \"${BRANCH}\" ]; then\n git clone --single-branch --branch \"${BRANCH}\" \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address, Git Branch and credentials\"; exit 1; }\n else\n git clone \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address and credentials\"; exit 1; }\n fi\nfi\n\necho \"Install complete. Visit http:\/\/ip:port\/\"\n", + "script": "#!\/bin\/ash\n# Nginx Webhost installer: installs the nginx\/PHP config and sets up the website files.\n\n# Bump this whenever the egg or the repo's config files change. Servers compare it with\n# the egg on GitHub at startup and show an update notice in the console.\nEGG_VERSION=\"1.0.6\"\n\nREPO=\"https:\/\/github.com\/Rustix-Development\/pterodactyl-nginx-egg\"\n\nis_true() { [ \"$1\" = \"1\" ] || [ \"$1\" = \"true\" ]; }\n\n# Drop user:token@ from a git URL so a changed token still counts as the same repo\nstrip_auth() { printf '%s' \"$1\" | sed -E 's#^([a-z]+:\/\/)[^\/@]*@#\\1#'; }\n\ntrap 'rm -rf \/tmp\/egg' EXIT\n\n# The install container has a terminal nobody types into: never wait for a git password\nexport GIT_TERMINAL_PROMPT=0\n\ncd \/mnt\/server || exit 1\napk add --no-cache git curl || { echo \"Failed to install git and curl\"; exit 1; }\n# Server files belong to the server user, not root; let git work on them anyway\ngit config --global --add safe.directory '*'\n\necho \"Downloading config files from ${REPO}\"\nrm -rf \/tmp\/egg\ngit clone --depth 1 \"${REPO}\" \/tmp\/egg || { echo \"Failed to download config files\"; exit 1; }\nif [ ! -f \/tmp\/egg\/start.sh ] || [ ! -d \/tmp\/egg\/nginx ] || [ ! -d \/tmp\/egg\/php-fpm ]; then\n echo \"Config files are missing from ${REPO} (empty repo or wrong default branch?)\"\n exit 1\nfi\n\n# Config files are replaced on every (re)install\ncp -r \/tmp\/egg\/nginx \/tmp\/egg\/php-fpm \/mnt\/server\/ \\\n && cp \/tmp\/egg\/start.sh \/mnt\/server\/start.sh \\\n && chmod +x \/mnt\/server\/start.sh \\\n || { echo \"Failed to copy config files\"; exit 1; }\n# Left behind by older versions of this egg, it stops nginx from starting\nrm -f \/mnt\/server\/nginx\/conf.d\/nextcloud.conf\nmkdir -p \/mnt\/server\/webroot \/mnt\/server\/tmp \/mnt\/server\/logs\necho \"${EGG_VERSION}\" > \/mnt\/server\/.egg-version\necho \"Installed Nginx Webhost egg v${EGG_VERSION} config files\"\n\ncd \/mnt\/server\/webroot || exit 1\n\n# A default landing page (this egg's or an older egg's) doesn't count as a website\nif [ \"$(ls -A)\" = \"index.php\" ] && grep -qE 'Web server is running<\/h1>|Webserver Correctly Installed' index.php; then\n rm -f index.php\nfi\n\nseed_default_page() {\n if [ -z \"$(ls -A)\" ]; then\n cp \/tmp\/egg\/webroot\/index.php .\/\n fi\n}\n\n# WordPress\nif is_true \"${WORDPRESS}\"; then\n if [ -f wp-load.php ]; then\n echo \"WordPress is already installed, leaving it alone.\"\n elif [ -n \"$(ls -A)\" ]; then\n echo \"webroot already has files, not installing WordPress over them.\"\n else\n echo \"Installing WordPress...\"\n # Unpack outside webroot so a broken download never leaves files behind in it\n WP_TMP=\/mnt\/server\/.wordpress-download\n rm -rf \"${WP_TMP}\" && mkdir -p \"${WP_TMP}\"\n if ! curl -fsSL https:\/\/wordpress.org\/latest.tar.gz | tar xz -C \"${WP_TMP}\" || [ ! -f \"${WP_TMP}\/wordpress\/wp-load.php\" ]; then\n rm -rf \"${WP_TMP}\"\n echo \"Failed to download WordPress\"\n exit 1\n fi\n cp -a \"${WP_TMP}\/wordpress\/.\" . && rm -rf \"${WP_TMP}\"\n echo \"WordPress installed. Finish setup at http:\/\/ip:port\/wp-admin\"\n fi\n exit 0\nfi\n\nif is_true \"${USER_UPLOAD}\"; then\n seed_default_page\n echo \"User Uploaded Files is on, skipping website setup. Upload your files into webroot.\"\n exit 0\nfi\n\nif [ -z \"${GIT_ADDRESS}\" ]; then\n seed_default_page\n echo \"Install complete. No Git Repo Address set, upload your website into webroot.\"\n exit 0\nfi\n\n# Git\ncase \"${GIT_ADDRESS}\" in\n *.git) ;;\n *) GIT_ADDRESS=\"${GIT_ADDRESS}.git\" ;;\nesac\n\nif [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_ADDRESS#*:\/\/}\"\nfi\n\nif [ -n \"$(ls -A)\" ]; then\n if [ -d .git ]; then\n if [ \"$(strip_auth \"$(git config --get remote.origin.url)\")\" = \"$(strip_auth \"${GIT_ADDRESS}\")\" ]; then\n echo \"Pulling latest website files from git\"\n # Picks up a changed Git Username\/Access Token\n git remote set-url origin \"${GIT_ADDRESS}\"\n git pull --ff-only || echo \"git pull failed, keeping the current files.\"\n else\n echo \"webroot is a clone of a different git repo, leaving it alone.\"\n fi\n else\n echo \"webroot already has files that aren't from git, leaving them alone.\"\n fi\nelse\n echo \"Cloning website files from git\"\n if [ -n \"${BRANCH}\" ]; then\n git clone --single-branch --branch \"${BRANCH}\" \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address, Git Branch and credentials\"; exit 1; }\n else\n git clone \"${GIT_ADDRESS}\" . || { echo \"git clone failed, check Git Repo Address and credentials\"; exit 1; }\n fi\nfi\n\necho \"Install complete. Visit http:\/\/ip:port\/\"\n", "container": "alpine:3.24", "entrypoint": "ash" } }, "variables": [ { - "name": "Startup Command", - "description": "The command to startup the egg \r\n(Do not change if you do not know what you are doing!)", - "env_variable": "STARTUP_CMD", - "default_value": ".\/start.sh", - "user_viewable": true, - "user_editable": true, - "rules": "required|string", - "field_type": "text" - }, - { - "name": "Wordpress", - "description": "Enable or disable Wordpress\r\n\r\n0 = false (default)\r\n1 = true", - "env_variable": "WORDPRESS", - "default_value": "0", - "user_viewable": true, - "user_editable": true, - "rules": "required|boolean", - "field_type": "text" - }, - { - "name": "Composer modules", - "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", - "env_variable": "COMPOSER_MODULES", + "name": "Website \u00b7 Root Folder", + "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", + "env_variable": "ROOT_FOLDER", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", "field_type": "text" }, { - "name": "Git Repo Address", - "description": "Git repo to clone your website from.\n\nI.E. https:\/\/github.com\/your-name\/your-site\n\nLeave blank to upload files yourself.", - "env_variable": "GIT_ADDRESS", + "name": "Website \u00b7 404 Page", + "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", + "env_variable": "ERROR_404_PAGE", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", "field_type": "text" }, { - "name": "Git Branch", - "description": "What branch to pull from github.\r\n\r\nDefault is blank to pull the repo default branch", - "env_variable": "BRANCH", + "name": "Website \u00b7 Composer Modules", + "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", + "env_variable": "COMPOSER_MODULES", "default_value": "", "user_viewable": true, "user_editable": true, @@ -81,19 +61,9 @@ "field_type": "text" }, { - "name": "Auto Update", - "description": "Pull the latest files from the Git repo on every start.\n\n0 = false (default)\n1 = true", - "env_variable": "AUTO_UPDATE", - "default_value": "0", - "user_viewable": true, - "user_editable": true, - "rules": "required|boolean", - "field_type": "text" - }, - { - "name": "User Uploaded Files", - "description": "Skip all the install stuff if you are letting a user upload files.\r\n\r\n0 = false (default)\r\n1 = true", - "env_variable": "USER_UPLOAD", + "name": "Website \u00b7 WordPress", + "description": "Enable or disable Wordpress\r\n\r\n0 = false (default)\r\n1 = true", + "env_variable": "WORDPRESS", "default_value": "0", "user_viewable": true, "user_editable": true, @@ -101,39 +71,19 @@ "field_type": "text" }, { - "name": "Root Folder", - "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", - "env_variable": "ROOT_FOLDER", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", - "field_type": "text" - }, - { - "name": "404 Page", - "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or the Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", - "env_variable": "ERROR_404_PAGE", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", - "field_type": "text" - }, - { - "name": "Update Check", - "description": "Check GitHub on startup and say in the console when the egg or the Docker image has an update.\n\n0 = false\n1 = true (default)", - "env_variable": "UPDATE_CHECK", - "default_value": "1", + "name": "Site \u00b7 Name", + "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", + "env_variable": "SITE_NAME", + "default_value": "Website", "user_viewable": true, "user_editable": true, - "rules": "required|boolean", + "rules": "nullable|string", "field_type": "text" }, { - "name": "Git Username", - "description": "Username to auth with git.", - "env_variable": "USERNAME", + "name": "Site \u00b7 URL", + "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", + "env_variable": "SITE_URL", "default_value": "", "user_viewable": true, "user_editable": true, @@ -141,17 +91,17 @@ "field_type": "text" }, { - "name": "Git Access Token", - "description": "Password to use with git.\r\n\r\nIt's best practice to use a Personal Access Token.\r\nhttps:\/\/github.com\/settings\/tokens\r\nhttps:\/\/gitlab.com\/-\/profile\/personal_access_tokens", - "env_variable": "ACCESS_TOKEN", + "name": "Site \u00b7 Google Analytics ID", + "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", + "env_variable": "GA_MEASUREMENT_ID", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:20", "field_type": "text" }, { - "name": "SMTP Host", + "name": "Mail \u00b7 SMTP Host", "description": "SMTP server address used to send mail from this site.\r\n\r\nDefault works for Resend (recommended \u2014 works from any IP, no dedicated mailbox needed). Set to smtp.gmail.com for Gmail \/ Google Workspace instead.", "env_variable": "SMTP_HOST", "default_value": "smtp.resend.com", @@ -161,7 +111,7 @@ "field_type": "text" }, { - "name": "SMTP Port", + "name": "Mail \u00b7 SMTP Port", "description": "SMTP port. 465 (implicit TLS) is correct for Resend. Use 587 (STARTTLS) for Gmail \/ Google Workspace.", "env_variable": "SMTP_PORT", "default_value": "465", @@ -171,7 +121,7 @@ "field_type": "text" }, { - "name": "SMTP Username", + "name": "Mail \u00b7 SMTP Username", "description": "The account that sends the mail.\r\n\r\nFor Resend this is always literally \"resend\" (not an email address). For Gmail\/Workspace this is the full mailbox address, e.g. info@yoursite.com.", "env_variable": "SMTP_USERNAME", "default_value": "resend", @@ -181,7 +131,7 @@ "field_type": "text" }, { - "name": "SMTP Password", + "name": "Mail \u00b7 SMTP Password", "description": "For Resend: your Resend API key (starts with \"re_\").\r\n\r\nFor Gmail \/ Google Workspace: an App Password for the mailbox above, no spaces \u2014 requires 2-Step Verification first: https:\/\/myaccount.google.com\/apppasswords. Never a normal account password.", "env_variable": "SMTP_PASSWORD", "default_value": "", @@ -191,7 +141,7 @@ "field_type": "text" }, { - "name": "Mail From Email", + "name": "Mail \u00b7 From Email", "description": "The address mail appears to come FROM, e.g. noreply@yoursite.com. Required for Resend (must be on a domain you've verified with them). For Gmail\/Workspace, leave blank to default to SMTP Username.", "env_variable": "MAIL_FROM_EMAIL", "default_value": "", @@ -201,8 +151,8 @@ "field_type": "text" }, { - "name": "Mail From Name", - "description": "The display name shown as the sender on outgoing mail, e.g. \"My Site\".\r\n\r\nLeave blank to fall back to \"{Site Name} Contact Form\".", + "name": "Mail \u00b7 From Name", + "description": "The display name shown as the sender on outgoing mail, e.g. \"My Site\".\r\n\r\nLeave blank to fall back to \"{Site \u00b7 Name} Contact Form\".", "env_variable": "MAIL_FROM_NAME", "default_value": "", "user_viewable": true, @@ -211,7 +161,7 @@ "field_type": "text" }, { - "name": "Mail To Email", + "name": "Mail \u00b7 To Email", "description": "Where contact form submissions actually land, usually the office inbox for this site.", "env_variable": "MAIL_TO_EMAIL", "default_value": "", @@ -221,28 +171,28 @@ "field_type": "text" }, { - "name": "Site Name", - "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", - "env_variable": "SITE_NAME", - "default_value": "Website", + "name": "Forms \u00b7 Turnstile Site Key", + "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", + "env_variable": "TURNSTILE_SITE_KEY", + "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:100", "field_type": "text" }, { - "name": "Site URL", - "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", - "env_variable": "SITE_URL", + "name": "Forms \u00b7 Turnstile Secret Key", + "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", + "env_variable": "TURNSTILE_SECRET_KEY", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:100", "field_type": "text" }, { - "name": "Discord Client ID", - "description": "OAuth2 Client ID from your app at https:\/\/discord.com\/developers\/applications.\r\n\r\nLeave both this and Discord Client Secret blank to keep Discord login disabled.", + "name": "Login \u00b7 Discord Client ID", + "description": "OAuth2 Client ID from your app at https:\/\/discord.com\/developers\/applications.\r\n\r\nLeave both this and Login \u00b7 Discord Client Secret blank to keep Discord login disabled.", "env_variable": "DISCORD_CLIENT_ID", "default_value": "", "user_viewable": true, @@ -251,8 +201,8 @@ "field_type": "text" }, { - "name": "Discord Client Secret", - "description": "OAuth2 Client Secret from the same Discord application (OAuth2 tab). Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL in that app's OAuth2 settings: {Site URL}\/discord-callback\/", + "name": "Login \u00b7 Discord Client Secret", + "description": "OAuth2 Client Secret from the same Discord application (OAuth2 tab). Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL in that app's OAuth2 settings: {Site \u00b7 URL}\/discord-callback\/", "env_variable": "DISCORD_CLIENT_SECRET", "default_value": "", "user_viewable": true, @@ -261,9 +211,9 @@ "field_type": "text" }, { - "name": "Database Connection String", - "description": "Paste your database connection string here \u2014 same format the panel's own DB_CONNECTION_STRING auto-injects (e.g. \"jdbc:mysql:\/\/user:pass@host:port\/dbname\"), or a plain \"mysql:\/\/user:pass@host:port\/dbname\", or a PDO-style \"mysql:host=X;port=Y;dbname=Z;user=U;password=P\". Leave blank to rely on the panel's automatic database attachment instead.", - "env_variable": "DB_CONNECTION_STRING", + "name": "Login \u00b7 Google Client ID", + "description": "OAuth2 Client ID from a Web application client at https:\/\/console.cloud.google.com\/apis\/credentials.\r\n\r\nLeave both this and Login \u00b7 Google Client Secret blank to keep Google login disabled. Unlike Discord, Google sign-in never creates a new account \u2014 it only works for someone whose Google email already matches an existing staff account.", + "env_variable": "GOOGLE_CLIENT_ID", "default_value": "", "user_viewable": true, "user_editable": true, @@ -271,9 +221,9 @@ "field_type": "text" }, { - "name": "Google Client ID", - "description": "OAuth2 Client ID from a Web application client at https:\/\/console.cloud.google.com\/apis\/credentials.\r\n\r\nLeave both this and Google Client Secret blank to keep Google login disabled. Unlike Discord, Google sign-in never creates a new account \u2014 it only works for someone whose Google email already matches an existing staff account.", - "env_variable": "GOOGLE_CLIENT_ID", + "name": "Login \u00b7 Google Client Secret", + "description": "OAuth2 Client Secret from the same Google Cloud OAuth client. Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL as an \"Authorized redirect URI\" on that client: {Site \u00b7 URL}\/google-callback\/", + "env_variable": "GOOGLE_CLIENT_SECRET", "default_value": "", "user_viewable": true, "user_editable": true, @@ -281,14 +231,34 @@ "field_type": "text" }, { - "name": "Google Client Secret", - "description": "OAuth2 Client Secret from the same Google Cloud OAuth client. Treat this like a password.\r\n\r\nAfter setting this, add this EXACT redirect URL as an \"Authorized redirect URI\" on that client: {Site URL}\/google-callback\/", - "env_variable": "GOOGLE_CLIENT_SECRET", + "name": "Database \u00b7 Connection String", + "description": "Paste your database connection string here \u2014 same format the panel's own DB_CONNECTION_STRING auto-injects (e.g. \"jdbc:mysql:\/\/user:pass@host:port\/dbname\"), or a plain \"mysql:\/\/user:pass@host:port\/dbname\", or a PDO-style \"mysql:host=X;port=Y;dbname=Z;user=U;password=P\". Leave blank to rely on the panel's automatic database attachment instead.", + "env_variable": "DB_CONNECTION_STRING", "default_value": "", "user_viewable": true, "user_editable": true, "rules": "nullable|string", "field_type": "text" + }, + { + "name": "System \u00b7 Update Check", + "description": "Check GitHub on startup and say in the console when the egg or the Docker image has an update.\n\n0 = false\n1 = true (default)", + "env_variable": "UPDATE_CHECK", + "default_value": "1", + "user_viewable": true, + "user_editable": true, + "rules": "required|boolean", + "field_type": "text" + }, + { + "name": "System \u00b7 Startup Command", + "description": "The command to startup the egg \r\n(Do not change if you do not know what you are doing!)", + "env_variable": "STARTUP_CMD", + "default_value": ".\/start.sh", + "user_viewable": true, + "user_editable": true, + "rules": "required|string", + "field_type": "text" } ] } diff --git a/php-fpm/fpm.pool.d/www.conf b/php-fpm/fpm.pool.d/www.conf index e4ce0d8..8bc4909 100644 --- a/php-fpm/fpm.pool.d/www.conf +++ b/php-fpm/fpm.pool.d/www.conf @@ -7,8 +7,8 @@ pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 -; Pass the server's environment (the egg's SMTP_*, MAIL_*, SITE_*, DISCORD_*, -; GOOGLE_*, DB_CONNECTION_STRING variables) through to PHP so getenv() works. +; Pass the server's environment (the egg's SITE_*, GA_*, SMTP_*, MAIL_*, TURNSTILE_*, +; DISCORD_*, GOOGLE_*, DB_CONNECTION_STRING variables) through to PHP so getenv() works. ; PHP-FPM wipes the environment by default. clear_env = no diff --git a/start.sh b/start.sh index bc4ccaf..26cbefb 100755 --- a/start.sh +++ b/start.sh @@ -57,8 +57,16 @@ check_egg_update() { log_success "Egg is up to date (v${installed})." else log_update "Egg update available: ${installed:+v${installed} -> }v${latest}" - log_update " 1. Download egg-nginx-webhost-${latest}.json from https://github.com/${EGG_REPO}/releases/latest" - log_update " and upload it in the panel: Admin -> Nests -> (nest) -> Nginx Webhost -> Update Egg" + # Only the Git egg has the Git variables + if [ -n "${GIT_ADDRESS+set}" ]; then + egg_file="egg-nginx-webhost-git-${latest}.json" + egg_name="Nginx Webhost (Git)" + else + egg_file="egg-nginx-webhost-${latest}.json" + egg_name="Nginx Webhost" + fi + log_update " 1. Download ${egg_file} from https://github.com/${EGG_REPO}/releases/latest" + log_update " and upload it in the panel: Admin -> Nests -> (nest) -> ${egg_name} -> Update Egg" log_update " 2. This server: Settings -> Reinstall Server. webroot is kept; nginx/, php-fpm/ and start.sh are replaced, so back up any edits to them first." fi From f605845a1a6ef51076b01a9a8e637a0105d14666 Mon Sep 17 00:00:00 2001 From: Mkkbeydoun Date: Sat, 31 Oct 2026 15:35:17 -0400 Subject: [PATCH 2/2] use agreed variable order --- README.md | 30 +++++----- egg-nginx-webhost-git.json | 114 ++++++++++++++++++------------------ egg-nginx-webhost.json | 116 ++++++++++++++++++------------------- 3 files changed, 130 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index 5417d19..943b1b7 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Both use the same image, config files and startup script. -- **WordPress** (Nginx Webhost): turn on *Website · WordPress* when creating the server and it's downloaded for you -- **Composer**: list packages in *Website · Composer Modules* and they're installed into `webroot/` +- **WordPress** (Nginx Webhost): turn on *Setup · WordPress* when creating the server and it's downloaded for you +- **Composer**: list packages in *Setup · Composer Modules* and they're installed into `webroot/` - **Site variables**: site name and URL, Google Analytics, SMTP / mail, Cloudflare Turnstile, Discord and Google OAuth and a database connection string are passed to PHP, so your code reads them with `getenv()` instead of hardcoding them @@ -46,25 +46,25 @@ proxy (nginx, Caddy, Cloudflare, ...) in front of that port. ## Variables All variables can be changed later under the server's **Startup** tab. Each name starts -with its section (*Website*, *Git*, *Site*, *Mail*, *Forms*, *Login*, *Database*, -*System*) so they stay grouped in the panel. The site variables only reach your PHP code; +with its section (*Site*, *Git*, *Setup*, *Mail*, *Login*, *Security*, *Analytics*, +*Database*, *Egg*) so they stay grouped in the panel. The site variables only reach your PHP code; the egg itself doesn't use them, so leave the ones you don't need blank. -### Website +### Site and setup | Variable | Default | What it does | |----------|---------|--------------| -| Website · Root Folder (`ROOT_FOLDER`) | | Folder in `webroot/` to serve at your domain's root, see [below](#serving-a-folder-at-the-root). Blank serves `webroot/` as is | -| Website · 404 Page (`ERROR_404_PAGE`) | | Page to show for missing pages, see [below](#custom-404-page). Blank keeps sending them to `index.php` | -| Website · Composer Modules (`COMPOSER_MODULES`) | | Space separated packages, e.g. `phpmailer/phpmailer vlucas/phpdotenv`. Pin a version with `vendor/package:^6.0` | -| Website · WordPress (`WORDPRESS`) | `0` | Nginx Webhost only. Install WordPress into an empty `webroot/`. Finish setup at `/wp-admin` | +| Site · Root Folder (`ROOT_FOLDER`) | | Folder in `webroot/` to serve at your domain's root, see [below](#serving-a-folder-at-the-root). Blank serves `webroot/` as is | +| Site · 404 Page (`ERROR_404_PAGE`) | | Page to show for missing pages, see [below](#custom-404-page). Blank keeps sending them to `index.php` | +| Setup · WordPress (`WORDPRESS`) | `0` | Nginx Webhost only. Install WordPress into an empty `webroot/`. Finish setup at `/wp-admin` | +| Setup · Composer Modules (`COMPOSER_MODULES`) | | Space separated packages, e.g. `phpmailer/phpmailer vlucas/phpdotenv`. Pin a version with `vendor/package:^6.0` | -### System +### Egg | Variable | Default | What it does | |----------|---------|--------------| -| System · Update Check (`UPDATE_CHECK`) | `1` | Say in the console when the egg or the Docker image has an update | -| System · Startup Command (`STARTUP_CMD`) | `./start.sh` | Leave as is unless you know you need to change it | +| Egg · Update Check (`UPDATE_CHECK`) | `1` | Say in the console when the egg or the Docker image has an update | +| Egg · Startup Command (`STARTUP_CMD`) | `./start.sh` | Leave as is unless you know you need to change it | Each Composer package is added once and then kept at that version. On every start `composer install` keeps `vendor/` in line with `composer.lock`. @@ -132,14 +132,14 @@ same repo, a reinstall pulls it; any other files are left alone. | Section | Variables | Default | Typical use | |---------|-----------|---------|-------------| | Site | `SITE_NAME`, `SITE_URL` | `Website`, | Your site's name and public URL (no trailing slash) | -| Site | `GA_MEASUREMENT_ID` | | Google Analytics 4 Measurement ID, e.g. `G-XXXXXXXXXX` | | Mail | `SMTP_HOST`, `SMTP_PORT` | `smtp.resend.com`, `465` | Mail server. For Gmail / Google Workspace use `smtp.gmail.com` and `587` | | Mail | `SMTP_USERNAME`, `SMTP_PASSWORD` | `resend`, | Mail login. For Resend, the password is your API key; for Gmail, an App Password | | Mail | `MAIL_FROM_EMAIL`, `MAIL_FROM_NAME` | | Sender address and name | | Mail | `MAIL_TO_EMAIL` | | Where contact form mail goes | -| Forms | `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | | Cloudflare Turnstile bot check on forms | | Login | `DISCORD_CLIENT_ID`, `DISCORD_CLIENT_SECRET` | | Discord OAuth2 login | | Login | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` | | Google OAuth2 login | +| Security | `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` | | Cloudflare Turnstile bot check on forms | +| Analytics | `GA_MEASUREMENT_ID` | | Google Analytics 4 Measurement ID, e.g. `G-XXXXXXXXXX` | | Database | `DB_CONNECTION_STRING` | | Database URL, e.g. `mysql://user:pass@host:3306/db` | ```php @@ -199,7 +199,7 @@ Every time a server starts it checks for updates in the background and says in t egg's images: **Admin → Servers → server → Startup → Docker Image**, pick one of the egg's images. -Turn it off per server with the *System · Update Check* variable. +Turn it off per server with the *Egg · Update Check* variable. ## Troubleshooting diff --git a/egg-nginx-webhost-git.json b/egg-nginx-webhost-git.json index 6352dc1..747acfd 100644 --- a/egg-nginx-webhost-git.json +++ b/egg-nginx-webhost-git.json @@ -31,33 +31,43 @@ }, "variables": [ { - "name": "Website \u00b7 Root Folder", - "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", - "env_variable": "ROOT_FOLDER", + "name": "Site \u00b7 Name", + "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", + "env_variable": "SITE_NAME", + "default_value": "Website", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string", + "field_type": "text" + }, + { + "name": "Site \u00b7 URL", + "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", + "env_variable": "SITE_URL", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", + "rules": "nullable|string", "field_type": "text" }, { - "name": "Website \u00b7 404 Page", - "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", - "env_variable": "ERROR_404_PAGE", + "name": "Site \u00b7 Root Folder", + "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", + "env_variable": "ROOT_FOLDER", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", "field_type": "text" }, { - "name": "Website \u00b7 Composer Modules", - "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", - "env_variable": "COMPOSER_MODULES", + "name": "Site \u00b7 404 Page", + "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", + "env_variable": "ERROR_404_PAGE", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", "field_type": "text" }, { @@ -111,35 +121,15 @@ "field_type": "text" }, { - "name": "Site \u00b7 Name", - "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", - "env_variable": "SITE_NAME", - "default_value": "Website", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string", - "field_type": "text" - }, - { - "name": "Site \u00b7 URL", - "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", - "env_variable": "SITE_URL", + "name": "Setup \u00b7 Composer Modules", + "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", + "env_variable": "COMPOSER_MODULES", "default_value": "", "user_viewable": true, "user_editable": true, "rules": "nullable|string", "field_type": "text" }, - { - "name": "Site \u00b7 Google Analytics ID", - "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", - "env_variable": "GA_MEASUREMENT_ID", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:20", - "field_type": "text" - }, { "name": "Mail \u00b7 SMTP Host", "description": "SMTP server address used to send mail from this site.\r\n\r\nDefault works for Resend (recommended \u2014 works from any IP, no dedicated mailbox needed). Set to smtp.gmail.com for Gmail \/ Google Workspace instead.", @@ -210,26 +200,6 @@ "rules": "nullable|string", "field_type": "text" }, - { - "name": "Forms \u00b7 Turnstile Site Key", - "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", - "env_variable": "TURNSTILE_SITE_KEY", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:100", - "field_type": "text" - }, - { - "name": "Forms \u00b7 Turnstile Secret Key", - "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", - "env_variable": "TURNSTILE_SECRET_KEY", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:100", - "field_type": "text" - }, { "name": "Login \u00b7 Discord Client ID", "description": "OAuth2 Client ID from your app at https:\/\/discord.com\/developers\/applications.\r\n\r\nLeave both this and Login \u00b7 Discord Client Secret blank to keep Discord login disabled.", @@ -270,6 +240,36 @@ "rules": "nullable|string", "field_type": "text" }, + { + "name": "Security \u00b7 Turnstile Site Key", + "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", + "env_variable": "TURNSTILE_SITE_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Security \u00b7 Turnstile Secret Key", + "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", + "env_variable": "TURNSTILE_SECRET_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Analytics \u00b7 Google Analytics ID", + "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", + "env_variable": "GA_MEASUREMENT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:20", + "field_type": "text" + }, { "name": "Database \u00b7 Connection String", "description": "Paste your database connection string here \u2014 same format the panel's own DB_CONNECTION_STRING auto-injects (e.g. \"jdbc:mysql:\/\/user:pass@host:port\/dbname\"), or a plain \"mysql:\/\/user:pass@host:port\/dbname\", or a PDO-style \"mysql:host=X;port=Y;dbname=Z;user=U;password=P\". Leave blank to rely on the panel's automatic database attachment instead.", @@ -281,7 +281,7 @@ "field_type": "text" }, { - "name": "System \u00b7 Update Check", + "name": "Egg \u00b7 Update Check", "description": "Check GitHub on startup and say in the console when the egg or the Docker image has an update.\n\n0 = false\n1 = true (default)", "env_variable": "UPDATE_CHECK", "default_value": "1", @@ -291,7 +291,7 @@ "field_type": "text" }, { - "name": "System \u00b7 Startup Command", + "name": "Egg \u00b7 Startup Command", "description": "The command to startup the egg \r\n(Do not change if you do not know what you are doing!)", "env_variable": "STARTUP_CMD", "default_value": ".\/start.sh", diff --git a/egg-nginx-webhost.json b/egg-nginx-webhost.json index 886862b..831e0d5 100644 --- a/egg-nginx-webhost.json +++ b/egg-nginx-webhost.json @@ -31,75 +31,65 @@ }, "variables": [ { - "name": "Website \u00b7 Root Folder", - "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", - "env_variable": "ROOT_FOLDER", - "default_value": "", + "name": "Site \u00b7 Name", + "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", + "env_variable": "SITE_NAME", + "default_value": "Website", "user_viewable": true, "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", + "rules": "nullable|string", "field_type": "text" }, { - "name": "Website \u00b7 404 Page", - "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", - "env_variable": "ERROR_404_PAGE", + "name": "Site \u00b7 URL", + "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", + "env_variable": "SITE_URL", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", + "rules": "nullable|string", "field_type": "text" }, { - "name": "Website \u00b7 Composer Modules", - "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", - "env_variable": "COMPOSER_MODULES", + "name": "Site \u00b7 Root Folder", + "description": "Folder inside webroot to serve at your domain's root, a name or a path: serves webroot\/ at \/, dev\/main serves webroot\/dev\/main. The other folders in webroot are still served at their own path (webroot\/blog at \/blog\/), and links to \/\/... redirect to \/...\n\nLeave blank to serve webroot as is (default).", + "env_variable": "ROOT_FOLDER", "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*\\\/?$\/", "field_type": "text" }, { - "name": "Website \u00b7 WordPress", - "description": "Enable or disable Wordpress\r\n\r\n0 = false (default)\r\n1 = true", - "env_variable": "WORDPRESS", - "default_value": "0", + "name": "Site \u00b7 404 Page", + "description": "Page to show when a page doesn't exist, e.g. 404.html or errors\/404.php (HTML or PHP), from your site's root (webroot, or Website \u00b7 Root Folder if set). Visitors get it with a 404 status.\n\nLeave blank to send missing pages to index.php as before (default, needed for WordPress and other apps that show their own 404).", + "env_variable": "ERROR_404_PAGE", + "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "required|boolean", + "rules": "nullable|string|max:255|regex:\/^\\\/?[A-Za-z0-9][A-Za-z0-9._-]*(\\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$\/", "field_type": "text" }, { - "name": "Site \u00b7 Name", - "description": "Short name for this site, used in the contact form's email subject line and internal error logs, e.g. \"My Site\".\r\n\r\nPurely cosmetic, doesn't need to match anything else.", - "env_variable": "SITE_NAME", - "default_value": "Website", + "name": "Setup \u00b7 WordPress", + "description": "Enable or disable Wordpress\r\n\r\n0 = false (default)\r\n1 = true", + "env_variable": "WORDPRESS", + "default_value": "0", "user_viewable": true, "user_editable": true, - "rules": "nullable|string", + "rules": "required|boolean", "field_type": "text" }, { - "name": "Site \u00b7 URL", - "description": "The public URL this site is reached at, no trailing slash, e.g. \"https:\/\/example.com\".\r\n\r\nUsed to build password reset links, unsubscribe links, email notification links, and the Discord OAuth redirect URL. Leave blank to fall back to the value baked into config.php.", - "env_variable": "SITE_URL", + "name": "Setup \u00b7 Composer Modules", + "description": "Composer packages to install into webroot, separated by spaces, e.g. \"phpmailer\/phpmailer vlucas\/phpdotenv\". Pin a version with vendor\/package:^6.0.\n\nEach package is added once and then kept at that version; on every start the server runs composer install so vendor\/ matches composer.lock.", + "env_variable": "COMPOSER_MODULES", "default_value": "", "user_viewable": true, "user_editable": true, "rules": "nullable|string", "field_type": "text" }, - { - "name": "Site \u00b7 Google Analytics ID", - "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", - "env_variable": "GA_MEASUREMENT_ID", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:20", - "field_type": "text" - }, { "name": "Mail \u00b7 SMTP Host", "description": "SMTP server address used to send mail from this site.\r\n\r\nDefault works for Resend (recommended \u2014 works from any IP, no dedicated mailbox needed). Set to smtp.gmail.com for Gmail \/ Google Workspace instead.", @@ -170,26 +160,6 @@ "rules": "nullable|string", "field_type": "text" }, - { - "name": "Forms \u00b7 Turnstile Site Key", - "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", - "env_variable": "TURNSTILE_SITE_KEY", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:100", - "field_type": "text" - }, - { - "name": "Forms \u00b7 Turnstile Secret Key", - "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", - "env_variable": "TURNSTILE_SECRET_KEY", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "nullable|string|max:100", - "field_type": "text" - }, { "name": "Login \u00b7 Discord Client ID", "description": "OAuth2 Client ID from your app at https:\/\/discord.com\/developers\/applications.\r\n\r\nLeave both this and Login \u00b7 Discord Client Secret blank to keep Discord login disabled.", @@ -230,6 +200,36 @@ "rules": "nullable|string", "field_type": "text" }, + { + "name": "Security \u00b7 Turnstile Site Key", + "description": "Cloudflare Turnstile site key (public, starts with 0x). Cloudflare dashboard \u2192 Turnstile \u2192 your widget. Forms skip the bot check until both Turnstile keys are set.", + "env_variable": "TURNSTILE_SITE_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Security \u00b7 Turnstile Secret Key", + "description": "Cloudflare Turnstile secret key from the same widget. Treat this like a password.", + "env_variable": "TURNSTILE_SECRET_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:100", + "field_type": "text" + }, + { + "name": "Analytics \u00b7 Google Analytics ID", + "description": "Google Analytics 4 Measurement ID, e.g. G-XXXXXXXXXX (Admin \u2192 Data streams \u2192 your web stream). Leave blank for no analytics.", + "env_variable": "GA_MEASUREMENT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "nullable|string|max:20", + "field_type": "text" + }, { "name": "Database \u00b7 Connection String", "description": "Paste your database connection string here \u2014 same format the panel's own DB_CONNECTION_STRING auto-injects (e.g. \"jdbc:mysql:\/\/user:pass@host:port\/dbname\"), or a plain \"mysql:\/\/user:pass@host:port\/dbname\", or a PDO-style \"mysql:host=X;port=Y;dbname=Z;user=U;password=P\". Leave blank to rely on the panel's automatic database attachment instead.", @@ -241,7 +241,7 @@ "field_type": "text" }, { - "name": "System \u00b7 Update Check", + "name": "Egg \u00b7 Update Check", "description": "Check GitHub on startup and say in the console when the egg or the Docker image has an update.\n\n0 = false\n1 = true (default)", "env_variable": "UPDATE_CHECK", "default_value": "1", @@ -251,7 +251,7 @@ "field_type": "text" }, { - "name": "System \u00b7 Startup Command", + "name": "Egg \u00b7 Startup Command", "description": "The command to startup the egg \r\n(Do not change if you do not know what you are doing!)", "env_variable": "STARTUP_CMD", "default_value": ".\/start.sh",