Skip to content

Commit 86918e5

Browse files
authored
Merge pull request #29 from Ym0T/feat/composer
Feat/composer
2 parents c878066 + 2b7ee5a commit 86918e5

File tree

3 files changed

+79
-20
lines changed

3 files changed

+79
-20
lines changed

Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ RUN apt-get update && apt-get install -y \
8585
php${PHP_VERSION}-maxminddb \
8686
php${PHP_VERSION}-protobuf \
8787
php${PHP_VERSION}-opcache \
88+
php${PHP_VERSION}-dev \
89+
&& wget -q -O /tmp/composer.phar https://getcomposer.org/download/latest-stable/composer.phar \
90+
&& SHA256=$(wget -q -O - https://getcomposer.org/download/latest-stable/composer.phar.sha256) \
91+
&& echo "$SHA256 /tmp/composer.phar" | sha256sum -c - \
92+
&& mv /tmp/composer.phar /usr/local/bin/composer \
93+
&& chmod +x /usr/local/bin/composer \
8894
&& rm -rf /var/lib/apt/lists/*
8995

9096
# Create user and set environment variables
@@ -100,4 +106,4 @@ STOPSIGNAL SIGINT
100106
COPY ./entrypoint.sh /entrypoint.sh
101107
RUN chmod +x /entrypoint.sh
102108

103-
CMD ["/entrypoint.sh"]
109+
CMD ["/entrypoint.sh"]

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,49 @@ With **Cloudflared**, you can create a secure tunnel to your server, making it a
7979

8080
✅ You have successfully set up Cloudflared and connected it to your server!<br><br>
8181
🔹 Info: Your web server ip and port does not have to be accessible from outside and can have a local IP such as 127.0.0.1.
82+
<br><br>
83+
## How to Use Composer Modules
84+
85+
This Pterodactyl Egg allows you to easily install additional PHP libraries (Composer modules) for your server. Here's how:
86+
87+
1. **Locate the `Composer modules` Variable:** When creating or editing your server in the Pterodactyl panel, you will find a variable named `Composer modules`.
88+
89+
2. **Specify the Modules:** In the value field of the `Composer modules` variable, enter a space-separated list of the Composer packages you wish to install. You can also specify the desired version constraints.
90+
91+
* **Basic Package:** To install the latest stable version of a package, simply enter its name:
92+
```
93+
vendor/package
94+
```
95+
Example: `symfony/http-foundation`
96+
97+
* **Specific Version:** To install a specific version or version range, use the following format:
98+
```
99+
vendor/package:version_constraint
100+
```
101+
Examples:
102+
* `monolog/monolog:^2.0` (installs the latest version within the 2.x branch)
103+
* `doctrine/orm:~2.10` (installs a version compatible with 2.10)
104+
* `nesbot/carbon:^2.50`
105+
106+
* **Multiple Modules:** To install multiple modules, separate them with spaces:
107+
```
108+
vendor/package1:version vendor/package2 vendor/package3:^1.0
109+
```
110+
Example: `symfony/http-foundation ^6.0 monolog/monolog guzzlehttp/guzzle`
111+
112+
3. **Save and Start/Restart Your Server:** After entering the desired Composer modules in the `COMPOSER_MODULES` variable, save your server configuration. If your server is already running, you will need to restart it for the changes to take effect.
113+
114+
4. **Module Installation:** During the server startup process, the Egg will automatically detect the modules listed in the `COMPOSER_MODULES` variable and attempt to install them using Composer. You can monitor the server console for the installation output.
115+
116+
**Important Notes:**
117+
118+
* Ensure that the package names and version constraints you enter are correct and exist on Packagist ([https://packagist.org/](https://packagist.org/)).
119+
* Incorrectly specified modules or version constraints may lead to installation errors. Check your server console for any error messages.
120+
* Installing a large number of modules or very complex dependencies can increase the server startup time.
121+
* This Egg assumes that Composer is already installed within the server environment.
122+
123+
By following these steps, you can easily extend the functionality of your server by adding various PHP libraries through Composer modules.
124+
82125
<br><br>
83126
## FAQ
84127

egg-nginx.json

+29-19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"version": "PTDL_v2",
55
"update_url": null
66
},
7-
"exported_at": "2025-02-03T10:01:15+01:00",
7+
"exported_at": "2025-04-03T22:34:54+02:00",
88
"name": "Pterodactyl Nginx Egg",
99
"author": "[email protected]",
10-
"description": "Pterodactyl Nginx Egg\r\n\r\nThe Pterodactyl Nginx Egg is a web server solution for Pterodactyl, featuring Nginx, PHP, Git support, Cloudflare Tunnel integration, and optional WordPress installation. It supports AMD64 & ARM64 architectures and allows users to choose their preferred PHP version (8.0 \u2013 8.4).\r\nKey Features:\r\n\r\n\u2705 Supports multiple PHP versions\r\n\u2705 Git integration for automatic deployment\r\n\u2705 Cloudflare Tunnel support for secure remote access\r\n\u2705 Optional WordPress setup\r\n\u2705 HTTPS configuration support\r\n\u2705 Automatic updates for Git repositories",
10+
"description": "Pterodactyl Nginx Egg\r\n\r\nThe Pterodactyl Nginx Egg is a web server solution for Pterodactyl, featuring Nginx, PHP, Git support, Cloudflare Tunnel integration, composer and optional WordPress installation. It supports AMD64 & ARM64 architectures and allows users to choose their preferred PHP version (8.0 \u2013 8.4).\r\nKey Features:\r\n\r\n\u2705 Supports multiple PHP versions\r\n\u2705 Git integration for automatic deployment\r\n\u2705 Cloudflare Tunnel support for secure remote access\r\n\u2705 Optional WordPress setup\r\n\u2705 HTTPS configuration support\r\n\u2705 Automatic updates for Git repositories",
1111
"features": null,
1212
"docker_images": {
1313
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.4-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.4-latest",
@@ -17,7 +17,7 @@
1717
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest"
1818
},
1919
"file_denylist": [],
20-
"startup": "echo \"{{PHP_VERSION}}\" > \"php_version.txt\";\r\n\r\nif [ \"{{GIT_UPDATE}}\" = \"1\" ]; then \r\n {{STARTUP_COMMAND_GIT}}; \r\nfi;\r\n\r\nif [ \"{{CLOUDFLARED_STATUS}}\" = \"1\" ]; then \r\n echo \"{{CLOUDFLARED_TOKEN}}\" > \"cloudflared_token.txt\";\r\n {{STARTUP_COMMAND_CLOUDFLARED}};\r\nfi;\r\n\r\n{{STARTUP_COMMAND}};",
20+
"startup": "echo \"{{PHP_VERSION}}\" > \"php_version.txt\";\r\n\r\nif [ \"{{GIT_UPDATE}}\" = \"1\" ]; then \r\n {{STARTUP_COMMAND_GIT}}; \r\nfi;\r\n\r\nif [ \"{{CLOUDFLARED_STATUS}}\" = \"1\" ]; then \r\n echo \"{{CLOUDFLARED_TOKEN}}\" > \"cloudflared_token.txt\";\r\n {{STARTUP_COMMAND_CLOUDFLARED}};\r\nfi;\r\n\r\nif [[ -n \"{{COMPOSER_MODULES}}\" ]]; then\r\n composer require {{COMPOSER_MODULES}} --working-dir=\/home\/container\/www --no-interaction --ansi;\r\nfi;\r\n\r\n{{STARTUP_COMMAND}};",
2121
"config": {
2222
"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 \"php\/php.ini\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"memory_limit =\": \"memory_limit = {{env.memory_limit}};\"\r\n }\r\n }\r\n}",
2323
"startup": "{\r\n \"done\": \"Services successfully launched\"\r\n}",
@@ -33,13 +33,13 @@
3333
},
3434
"variables": [
3535
{
36-
"name": "PHP Version",
37-
"description": "Select the correct PHP version! See the tag behind the Docker image. \r\nExample: Selected image (ghcr.io\/ym0t\/nginx_php:8.4)\r\nEnter in the field: 8.4",
38-
"env_variable": "PHP_VERSION",
39-
"default_value": "",
36+
"name": "Startup Command",
37+
"description": "The startup file for Nginx.",
38+
"env_variable": "STARTUP_COMMAND",
39+
"default_value": ".\/nginx.sh",
4040
"user_viewable": true,
4141
"user_editable": true,
42-
"rules": "required|string|max:3",
42+
"rules": "required|string",
4343
"field_type": "text"
4444
},
4545
{
@@ -53,23 +53,23 @@
5353
"field_type": "text"
5454
},
5555
{
56-
"name": "Memory_limit",
57-
"description": "Change the memory_limit value from the php.ini file",
58-
"env_variable": "memory_limit",
59-
"default_value": "128M",
56+
"name": "PHP Version",
57+
"description": "Select the correct PHP version! See the tag behind the Docker image. \r\nExample: Selected image (ghcr.io\/ym0t\/nginx_php:8.4)\r\nEnter in the field: 8.4",
58+
"env_variable": "PHP_VERSION",
59+
"default_value": "",
6060
"user_viewable": true,
6161
"user_editable": true,
62-
"rules": "required|string|max:20",
62+
"rules": "required|string|max:3",
6363
"field_type": "text"
6464
},
6565
{
66-
"name": "Startup Command",
67-
"description": "The startup file for Nginx.",
68-
"env_variable": "STARTUP_COMMAND",
69-
"default_value": ".\/nginx.sh",
66+
"name": "Memory_limit",
67+
"description": "Change the memory_limit value from the php.ini file",
68+
"env_variable": "MEMORY_LIMIT",
69+
"default_value": "128M",
7070
"user_viewable": true,
7171
"user_editable": true,
72-
"rules": "required|string",
72+
"rules": "required|string|max:20",
7373
"field_type": "text"
7474
},
7575
{
@@ -161,6 +161,16 @@
161161
"user_editable": true,
162162
"rules": "required|string",
163163
"field_type": "text"
164+
},
165+
{
166+
"name": "Composer modules",
167+
"description": "Enter a space-separated list of Composer packages with their version constraints to be installed. For example: vendor\/package1:^2.0 vendor\/package2:~1.5",
168+
"env_variable": "COMPOSER_MODULES",
169+
"default_value": "",
170+
"user_viewable": true,
171+
"user_editable": true,
172+
"rules": "nullable|string",
173+
"field_type": "text"
164174
}
165175
]
166-
}
176+
}

0 commit comments

Comments
 (0)