diff --git a/database/sql/mariadb/egg-maria-d-b.json b/database/sql/mariadb/egg-maria-db.json similarity index 99% rename from database/sql/mariadb/egg-maria-d-b.json rename to database/sql/mariadb/egg-maria-db.json index 5b03ad6..a188cb8 100644 --- a/database/sql/mariadb/egg-maria-d-b.json +++ b/database/sql/mariadb/egg-maria-db.json @@ -32,4 +32,4 @@ } }, "variables": [] -} \ No newline at end of file +} diff --git a/database/sql/postgres/README.md b/database/sql/postgres/README.md index 317c23e..ffcbee7 100644 --- a/database/sql/postgres/README.md +++ b/database/sql/postgres/README.md @@ -1,19 +1,37 @@ -# PostgreSQL +# PostgreSQL (13–18) -## From their [Website](https://www.postgresql.org/) +## Overview -The World's Most Advanced Open Source Relational Database +This egg provides a PostgreSQL server with support for multiple versions (13 through 18) within a single configuration. -## Minimum RAM warning +Originally based on the default Pterodactyl setup, it has been manually extended to allow version selection and basic upgrade handling. Because of these modifications, behavior may differ from standard eggs. -2 Gigabytes minimum recommended +For official documentation, visit the PostgreSQL Global Development Group website: [https://www.postgresql.org/](https://www.postgresql.org/) -See here +--- + +## Important Notes + +1. This egg supports switching between PostgreSQL versions 13–18 +2. Changing the version after installation may trigger a data migration or upgrade process +3. Upgrades are best-effort and may require manual intervention depending on environment compatibility +4. Always ensure backups exist before changing versions + +--- + +## Minimum Requirements + +At least 2 GB of RAM is recommended for stable operation. + +See PostgreSQL recommendations here: +[https://www.commandprompt.com/blog/postgresql_mininum_requirements/](https://www.commandprompt.com/blog/postgresql_mininum_requirements/) + +--- ## Server Ports -Ports required to run the server in a table format. +Ports required to run the server: -| Port | default | -|---------|---------| -| Server | 5432 | +| Port | Default | +| ------ | ------- | +| Server | 5432 | diff --git a/database/sql/postgres/egg-postgres.json b/database/sql/postgres/egg-postgres.json new file mode 100644 index 0000000..05efc66 --- /dev/null +++ b/database/sql/postgres/egg-postgres.json @@ -0,0 +1,67 @@ +{ + "_comment": "WARNING: Although this file was initially generated by the Pterodactyl Panel, it has since been manually edited to support multiple Postgres versions and upgrade logic. Do not modify unless you understand the full impact of your changes.", + "meta": { + "version": "PTDL_v2", + "update_url": null + }, + "exported_at": "2026-03-03T12:40:12+00:00", + "name": "Postgres (13–18)", + "author": "itzzmateo@devflare.de", + "description": "Postgres with multi-version support (13–18) and safe upgrade handling.", + "features": [], + "docker_images": { + "ghcr.io/ptero-eggs/yolks:postgres_13": "ghcr.io/ptero-eggs/yolks:postgres_13", + "ghcr.io/ptero-eggs/yolks:postgres_14": "ghcr.io/ptero-eggs/yolks:postgres_14", + "ghcr.io/ptero-eggs/yolks:postgres_15": "ghcr.io/ptero-eggs/yolks:postgres_15", + "ghcr.io/ptero-eggs/yolks:postgres_16": "ghcr.io/ptero-eggs/yolks:postgres_16", + "ghcr.io/ptero-eggs/yolks:postgres_17": "ghcr.io/ptero-eggs/yolks:postgres_17", + "ghcr.io/ptero-eggs/yolks:postgres_18": "ghcr.io/ptero-eggs/yolks:postgres_18" + }, + "file_denylist": [], + "startup": "postgres -D /home/container/postgres_db/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", + "config": { + "files": "{\r\n \"postgres_db/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '/home/container/postgres_db/run/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '/home/container/postgres_db/run/'\"\r\n }\r\n }\r\n}", + "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", + "logs": "{}", + "stop": "\\q" + }, + "scripts": { + "installation": { + "script": "#!/bin/ash\n\nadduser -D -h /home/container container\nchown -R container: /mnt/server/\n\nDATA_DIR=\"/mnt/server/postgres_db\"\nRUN_DIR=\"$DATA_DIR/run\"\nNEW_VERSION=\"${PG_VERSION}\"\n\nmkdir -p \"$RUN_DIR\"\n\nif [ -f \"$DATA_DIR/PG_VERSION\" ]; then\n OLD_VERSION=$(cat \"$DATA_DIR/PG_VERSION\")\nelse\n OLD_VERSION=\"\"\nfi\n\necho \"Old version: $OLD_VERSION\"\necho \"New version: $NEW_VERSION\"\n\n# Fresh install\nif [ -z \"$OLD_VERSION\" ]; then\n echo \"Initializing new database...\"\n su container -c \"initdb -D $DATA_DIR -U \\\"$PGUSER\\\" --pwfile=<(echo \\\"$PGPASSWORD\\\")\"\n\nelse\n if [ \"$OLD_VERSION\" != \"$NEW_VERSION\" ]; then\n echo \"Version change detected. Creating backup...\"\n\n BACKUP_DIR=\"/mnt/server/backup_$(date +%s)\"\n cp -r \"$DATA_DIR\" \"$BACKUP_DIR\"\n echo \"Backup created at $BACKUP_DIR\"\n\n echo \"Attempting pg_upgrade...\"\n\n OLD_BIN=\"/usr/lib/postgresql/$OLD_VERSION/bin\"\n NEW_BIN=\"/usr/lib/postgresql/$NEW_VERSION/bin\"\n\n if [ -x \"$OLD_BIN/pg_ctl\" ] && [ -x \"$NEW_BIN/pg_ctl\" ]; then\n su container -c \"pg_upgrade \\\n -b $OLD_BIN \\\n -B $NEW_BIN \\\n -d $DATA_DIR \\\n -D ${DATA_DIR}_new\"\n\n if [ $? -eq 0 ]; then\n echo \"Upgrade successful\"\n rm -rf \"$DATA_DIR\"\n mv \"${DATA_DIR}_new\" \"$DATA_DIR\"\n else\n echo \"pg_upgrade failed. Keeping old data.\"\n fi\n else\n echo \"pg_upgrade not possible (missing binaries).\"\n echo \"Keeping old database. Manual upgrade required.\"\n fi\n else\n echo \"Version unchanged. Skipping upgrade.\"\n fi\nfi\n\n# Ensure pg_hba rule\nif ! grep -q \"# Custom rules\" \"$DATA_DIR/pg_hba.conf\"; then\n echo -e \"# Custom rules\\nhost all all 0.0.0.0/0 md5\" >> \"$DATA_DIR/pg_hba.conf\"\nfi\n\necho \"Done\"", + "container": "alpine:3.19", + "entrypoint": "sh" + } + }, + "variables": [ + { + "name": "Superuser Name", + "description": "The username for the postgres superuser", + "env_variable": "PGUSER", + "default_value": "pterodactyl", + "user_viewable": true, + "user_editable": false, + "rules": "required|string|max:20", + "field_type": "text" + }, + { + "name": "Superuser Password", + "description": "The postgres super user password with a strong default.\nYou should be generating new ones for each server.\nIf you don't then users can hit other users DB's", + "env_variable": "PGPASSWORD", + "default_value": "Pl3453Ch4n63M3!", + "user_viewable": true, + "user_editable": false, + "rules": "required|string|max:20", + "field_type": "text" + }, + { + "name": "Postgres Version", + "description": "Select the Postgres version to use", + "env_variable": "PG_VERSION", + "default_value": "18", + "user_viewable": true, + "user_editable": true, + "rules": "required|in:13,14,15,16,17,18", + "field_type": "text" + } + ] +} diff --git a/database/sql/postgres/egg-postgres13.json b/database/sql/postgres/egg-postgres13.json deleted file mode 100644 index 408b2f9..0000000 --- a/database/sql/postgres/egg-postgres13.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2025-01-26T01:12:12+00:00", - "name": "Postgres 13", - "author": "parker@parkervcp.com", - "description": "A default Postgres install that is not really editable.", - "features": [], - "docker_images": { - "ghcr.io\/ptero-eggs\/yolks:postgres_13": "ghcr.io\/ptero-eggs\/yolks:postgres_13" - }, - "file_denylist": [], - "startup": "postgres -D \/home\/container\/postgres_db\/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", - "config": { - "files": "{\r\n \"postgres_db\/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '\/home\/container\/postgres_db\/run\/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '\/home\/container\/postgres_db\/run\/'\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", - "logs": "{}", - "stop": "\\q" - }, - "scripts": { - "installation": { - "script": "#! \/bin\/ash\r\nadduser -D -h \/home\/container container\r\n\r\nchown -R container: \/mnt\/server\/\r\n\r\nsu container -c 'initdb -D \/mnt\/server\/postgres_db\/ -A md5 -U \"$PGUSER\" --pwfile=<(echo \"$PGPASSWORD\")'\r\n\r\nmkdir -p \/mnt\/server\/postgres_db\/run\/\r\n\r\n## Add default \"allow from all\" auth rule to pg_hba\r\nif ! grep -q \"# Custom rules\" \"\/mnt\/server\/postgres_db\/pg_hba.conf\"; then\r\n echo -e \"# Custom rules\\nhost all all 0.0.0.0\/0 md5\" >> \"\/mnt\/server\/postgres_db\/pg_hba.conf\"\r\nfi\r\n\r\necho -e \"Done\"", - "container": "postgres:13-alpine", - "entrypoint": "bash" - } - }, - "variables": [ - { - "name": "Superuser Name", - "description": "The username for the postgres superuser", - "env_variable": "PGUSER", - "default_value": "pterodactyl", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "name": "Superuser Password", - "description": "The postgres super user password with a strong default.\r\nYou should be generating new ones for each server.\r\nIf you don't then users can hit other users DB's", - "env_variable": "PGPASSWORD", - "default_value": "Pl3453Ch4n63M3!", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - } - ] -} \ No newline at end of file diff --git a/database/sql/postgres/egg-postgres14.json b/database/sql/postgres/egg-postgres14.json deleted file mode 100644 index bef5312..0000000 --- a/database/sql/postgres/egg-postgres14.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2025-01-26T01:12:12+00:00", - "name": "Postgres 14", - "author": "parker@parkervcp.com", - "description": "A default Postgres install that is not really editable.", - "features": [], - "docker_images": { - "ghcr.io\/ptero-eggs\/yolks:postgres_14": "ghcr.io\/ptero-eggs\/yolks:postgres_14" - }, - "file_denylist": [], - "startup": "postgres -D \/home\/container\/postgres_db\/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", - "config": { - "files": "{\r\n \"postgres_db\/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '\/home\/container\/postgres_db\/run\/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '\/home\/container\/postgres_db\/run\/'\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", - "logs": "{}", - "stop": "\\q" - }, - "scripts": { - "installation": { - "script": "#! \/bin\/ash\r\nadduser -D -h \/home\/container container\r\n\r\nchown -R container: \/mnt\/server\/\r\n\r\nsu container -c 'initdb -D \/mnt\/server\/postgres_db\/ -A md5 -U \"$PGUSER\" --pwfile=<(echo \"$PGPASSWORD\")'\r\n\r\nmkdir -p \/mnt\/server\/postgres_db\/run\/\r\n\r\n## Add default \"allow from all\" auth rule to pg_hba\r\nif ! grep -q \"# Custom rules\" \"\/mnt\/server\/postgres_db\/pg_hba.conf\"; then\r\n echo -e \"# Custom rules\\nhost all all 0.0.0.0\/0 md5\" >> \"\/mnt\/server\/postgres_db\/pg_hba.conf\"\r\nfi\r\n\r\necho -e \"Done\"", - "container": "postgres:14-alpine", - "entrypoint": "bash" - } - }, - "variables": [ - { - "name": "Superuser Name", - "description": "The username for the postgres superuser", - "env_variable": "PGUSER", - "default_value": "pterodactyl", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "name": "Superuser Password", - "description": "The postgres super user password with a strong default.\r\nYou should be generating new ones for each server.\r\nIf you don't then users can hit other users DB's", - "env_variable": "PGPASSWORD", - "default_value": "Pl3453Ch4n63M3!", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - } - ] -} \ No newline at end of file diff --git a/database/sql/postgres/egg-postgres15.json b/database/sql/postgres/egg-postgres15.json deleted file mode 100644 index fb1154d..0000000 --- a/database/sql/postgres/egg-postgres15.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2025-01-26T01:12:12+00:00", - "name": "Postgres 15", - "author": "parker@parkervcp.com", - "description": "A default Postgres install that is not really editable.", - "features": [], - "docker_images": { - "ghcr.io\/ptero-eggs\/yolks:postgres_15": "ghcr.io\/ptero-eggs\/yolks:postgres_15" - }, - "file_denylist": [], - "startup": "postgres -D \/home\/container\/postgres_db\/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", - "config": { - "files": "{\r\n \"postgres_db\/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '\/home\/container\/postgres_db\/run\/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '\/home\/container\/postgres_db\/run\/'\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", - "logs": "{}", - "stop": "\\q" - }, - "scripts": { - "installation": { - "script": "#! \/bin\/ash\r\nadduser -D -h \/home\/container container\r\n\r\nchown -R container: \/mnt\/server\/\r\n\r\nsu container -c 'initdb -D \/mnt\/server\/postgres_db\/ -A md5 -U \"$PGUSER\" --pwfile=<(echo \"$PGPASSWORD\")'\r\n\r\nmkdir -p \/mnt\/server\/postgres_db\/run\/\r\n\r\n## Add default \"allow from all\" auth rule to pg_hba\r\nif ! grep -q \"# Custom rules\" \"\/mnt\/server\/postgres_db\/pg_hba.conf\"; then\r\n echo -e \"# Custom rules\\nhost all all 0.0.0.0\/0 md5\" >> \"\/mnt\/server\/postgres_db\/pg_hba.conf\"\r\nfi\r\n\r\necho -e \"Done\"", - "container": "postgres:15-alpine", - "entrypoint": "bash" - } - }, - "variables": [ - { - "name": "Superuser Name", - "description": "The username for the postgres superuser", - "env_variable": "PGUSER", - "default_value": "pterodactyl", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "name": "Superuser Password", - "description": "The postgres super user password with a strong default.\r\nYou should be generating new ones for each server.\r\nIf you don't then users can hit other users DB's", - "env_variable": "PGPASSWORD", - "default_value": "Pl3453Ch4n63M3!", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - } - ] -} \ No newline at end of file diff --git a/database/sql/postgres/egg-postgres16.json b/database/sql/postgres/egg-postgres16.json deleted file mode 100644 index 3c03185..0000000 --- a/database/sql/postgres/egg-postgres16.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2025-01-26T01:12:12+00:00", - "name": "Postgres 16", - "author": "parker@parkervcp.com", - "description": "A default Postgres install that is not really editable.", - "features": [], - "docker_images": { - "ghcr.io\/ptero-eggs\/yolks:postgres_16": "ghcr.io\/ptero-eggs\/yolks:postgres_16" - }, - "file_denylist": [], - "startup": "postgres -D \/home\/container\/postgres_db\/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", - "config": { - "files": "{\r\n \"postgres_db\/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '\/home\/container\/postgres_db\/run\/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '\/home\/container\/postgres_db\/run\/'\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", - "logs": "{}", - "stop": "\\q" - }, - "scripts": { - "installation": { - "script": "#! \/bin\/ash\r\nadduser -D -h \/home\/container container\r\n\r\nchown -R container: \/mnt\/server\/\r\n\r\nsu container -c 'initdb -D \/mnt\/server\/postgres_db\/ -A md5 -U \"$PGUSER\" --pwfile=<(echo \"$PGPASSWORD\")'\r\n\r\nmkdir -p \/mnt\/server\/postgres_db\/run\/\r\n\r\n## Add default \"allow from all\" auth rule to pg_hba\r\nif ! grep -q \"# Custom rules\" \"\/mnt\/server\/postgres_db\/pg_hba.conf\"; then\r\n echo -e \"# Custom rules\\nhost all all 0.0.0.0\/0 md5\" >> \"\/mnt\/server\/postgres_db\/pg_hba.conf\"\r\nfi\r\n\r\necho -e \"Done\"", - "container": "postgres:16-alpine", - "entrypoint": "bash" - } - }, - "variables": [ - { - "name": "Superuser Name", - "description": "The username for the postgres superuser", - "env_variable": "PGUSER", - "default_value": "pterodactyl", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "name": "Superuser Password", - "description": "The postgres super user password with a strong default.\r\nYou should be generating new ones for each server.\r\nIf you don't then users can hit other users DB's", - "env_variable": "PGPASSWORD", - "default_value": "Pl3453Ch4n63M3!", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - } - ] -} \ No newline at end of file diff --git a/database/sql/postgres/egg-postgres17.json b/database/sql/postgres/egg-postgres17.json deleted file mode 100644 index 0f7936d..0000000 --- a/database/sql/postgres/egg-postgres17.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2025-01-26T01:12:12+00:00", - "name": "Postgres 17", - "author": "parker@parkervcp.com", - "description": "A default Postgres install that is not really editable.", - "features": [], - "docker_images": { - "ghcr.io\/ptero-eggs\/yolks:postgres_17": "ghcr.io\/ptero-eggs\/yolks:postgres_17" - }, - "file_denylist": [], - "startup": "postgres -D \/home\/container\/postgres_db\/ & wait-port; psql -h127.0.0.1 -p{{SERVER_PORT}} --dbname postgres", - "config": { - "files": "{\r\n \"postgres_db\/postgresql.conf\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"#port =\": \"port = {{server.build.default.port}}\",\r\n \"#external_pid_file =\": \"external_pid_file = '\/home\/container\/postgres_db\/run\/postgres.pid'\",\r\n \"#unix_socket_directories =\": \"unix_socket_directories = '\/home\/container\/postgres_db\/run\/'\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \"database system is ready to accept connections\"\r\n}", - "logs": "{}", - "stop": "\\q" - }, - "scripts": { - "installation": { - "script": "#! \/bin\/ash\r\nadduser -D -h \/home\/container container\r\n\r\nchown -R container: \/mnt\/server\/\r\n\r\nsu container -c 'initdb -D \/mnt\/server\/postgres_db\/ -A md5 -U \"$PGUSER\" --pwfile=<(echo \"$PGPASSWORD\")'\r\n\r\nmkdir -p \/mnt\/server\/postgres_db\/run\/\r\n\r\n## Add default \"allow from all\" auth rule to pg_hba\r\nif ! grep -q \"# Custom rules\" \"\/mnt\/server\/postgres_db\/pg_hba.conf\"; then\r\n echo -e \"# Custom rules\\nhost all all 0.0.0.0\/0 md5\" >> \"\/mnt\/server\/postgres_db\/pg_hba.conf\"\r\nfi\r\n\r\necho -e \"Done\"", - "container": "postgres:17-alpine", - "entrypoint": "bash" - } - }, - "variables": [ - { - "name": "Superuser Name", - "description": "The username for the postgres superuser", - "env_variable": "PGUSER", - "default_value": "pterodactyl", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "name": "Superuser Password", - "description": "The postgres super user password with a strong default.\r\nYou should be generating new ones for each server.\r\nIf you don't then users can hit other users DB's", - "env_variable": "PGPASSWORD", - "default_value": "Pl3453Ch4n63M3!", - "user_viewable": true, - "user_editable": false, - "rules": "required|string|max:20", - "field_type": "text" - } - ] -} \ No newline at end of file