Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
}
},
"variables": []
}
}
38 changes: 28 additions & 10 deletions database/sql/postgres/README.md
Original file line number Diff line number Diff line change
@@ -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 <https://www.commandprompt.com/blog/postgresql_mininum_requirements/>
---

## 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 |
67 changes: 67 additions & 0 deletions database/sql/postgres/egg-postgres.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
52 changes: 0 additions & 52 deletions database/sql/postgres/egg-postgres13.json

This file was deleted.

52 changes: 0 additions & 52 deletions database/sql/postgres/egg-postgres14.json

This file was deleted.

52 changes: 0 additions & 52 deletions database/sql/postgres/egg-postgres15.json

This file was deleted.

52 changes: 0 additions & 52 deletions database/sql/postgres/egg-postgres16.json

This file was deleted.

Loading