|
4 | 4 | "version": "PTDL_v2",
|
5 | 5 | "update_url": null
|
6 | 6 | },
|
7 |
| - "exported_at": "2024-10-02T22:32:15+02:00", |
| 7 | + "exported_at": "2024-10-03T01:05:02+02:00", |
8 | 8 | "name": "Nginx",
|
9 | 9 |
|
10 | 10 | "description": "NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP\/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.",
|
|
16 | 16 | "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest"
|
17 | 17 | },
|
18 | 18 | "file_denylist": [],
|
19 |
| - "startup": "if [ {{GIT_STATUS}} == 1 ]; then {{STARTUP_COMMAND_GIT}}; fi; echo \"{{PHP_VERSION}}\" > \"php_version.txt\"; {{STARTUP_COMMAND}};", |
| 19 | + "startup": "if [ {{GIT_UPDATE}} == 1 ]; then {{STARTUP_COMMAND_GIT}}; fi; echo \"{{PHP_VERSION}}\" > \"php_version.txt\"; {{STARTUP_COMMAND}};", |
20 | 20 | "config": {
|
21 | 21 | "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}",
|
22 | 22 | "startup": "{\r\n \"done\": \"[Docker] Services successfully launched\"\r\n}",
|
|
25 | 25 | },
|
26 | 26 | "scripts": {
|
27 | 27 | "installation": {
|
28 |
| - "script": "#!\/bin\/bash\r\n\r\n# [SETUP] Install necessary packages, including git\r\necho -e \"[SETUP] Install packages\"\r\napt-get update -qq > \/dev\/null 2>&1 && apt-get install -qq > \/dev\/null 2>&1 -y git wget perl perl-doc fcgiwrap\r\n\r\n# Change to server directory\r\ncd \/mnt\/server\r\n\r\n# [SETUP] Create necessary folders\r\necho -e \"[SETUP] Create folders\"\r\nmkdir -p logs tmp www\r\n\r\n# Clone the default repository into a temporary directory\r\necho \"[Git] Cloning default repository 'https:\/\/github.com\/Ym0T\/pterodactyl-nginx-egg' into temporary directory.\"\r\ngit clone https:\/\/github.com\/Ym0T\/pterodactyl-nginx-egg \/mnt\/server\/gtemp > \/dev\/null 2>&1 && echo \"[Git] Repository cloned successfully.\" || { echo \"[Git] Error: Default repository clone failed.\"; exit 21; }\r\n\r\n# Copy the www folder and files from the temporary repository to the target directory\r\necho \"[Git] Copying folder and files from default repository.\"\r\ncp -r \/mnt\/server\/gtemp\/nginx \/mnt\/server || { echo \"[Git] Error: Copying 'nginx' folder failed.\"; exit 22; }\r\ncp -r \/mnt\/server\/gtemp\/php \/mnt\/server || { echo \"[Git] Error: Copying 'php' folder failed.\"; exit 22; }\r\ncp \/mnt\/server\/gtemp\/nginx.sh \/mnt\/server || { echo \"[Git] Error: Copying 'nginx.sh' file failed.\"; exit 22; }\r\nchmod +x \/mnt\/server\/nginx.sh\r\n\r\n# Remove the temporary cloned repository\r\nrm -rf \/mnt\/server\/gtemp\r\n\r\n# Check if GIT_STATUS is set to 1 (enabled) or 0 (disabled) as the first step\r\nif [ \"${GIT_STATUS}\" == \"1\" ] || [ \"${GIT_STATUS}\" == \"true\" ]; then\r\n echo \"[Git] Git operations are enabled.\"\r\n\r\n # Check if GIT_ADDRESS is set\r\n if [ -z \"${GIT_ADDRESS}\" ]; then\r\n echo \"[Git] Info: GIT_ADDRESS is not set.\"\r\n else\r\n # Add .git suffix to GIT_ADDRESS if it's not present\r\n if [[ ${GIT_ADDRESS} != *.git ]]; then\r\n GIT_ADDRESS=\"${GIT_ADDRESS}.git\"\r\n echo \"[Git] Added .git suffix to GIT_ADDRESS: ${GIT_ADDRESS}\"\r\n fi\r\n\r\n # If username and access token are provided, use authenticated access\r\n if [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\r\n echo \"[Git] Using authenticated Git access.\"\r\n GIT_DOMAIN=$(echo \"${GIT_ADDRESS}\" | cut -d\/ -f3)\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_DOMAIN}$(echo ${GIT_ADDRESS} | cut -d\/ -f4-)\"\r\n echo \"[Git] Updated GIT_ADDRESS for authenticated access: ${GIT_ADDRESS}\"\r\n else\r\n echo \"[Git] Using anonymous Git access.\"\r\n fi\r\n\r\n # Check if the 'www' directory exists, if not create it\r\n if [ ! -d \/mnt\/server\/www ]; then\r\n echo \"[Git] Creating \/mnt\/server\/www directory.\"\r\n mkdir -p \/mnt\/server\/www\r\n else\r\n rm -R \/mnt\/server\/www && mkdir -p \/mnt\/server\/www\r\n fi\r\n\r\n cd \/mnt\/server\/www || { echo \"[Git] Error: Could not access \/mnt\/server\/www directory.\"; exit 1; }\r\n\r\n if [ \"$(ls -A \/mnt\/server\/www)\" ]; then\r\n echo \"[Git] \/mnt\/server\/www directory is not empty.\"\r\n \r\n # Check if .git directory exists in 'www'\r\n if [ -d .git ]; then\r\n echo \"[Git] .git directory exists in 'www'.\"\r\n\r\n # Check if .git\/config exists in 'www'\r\n if [ -f .git\/config ]; then\r\n echo \"[Git] Loading repository info from git config in 'www'.\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo \"[Git] Error: .git\/config not found in 'www'. The directory may contain files, but it's not a valid Git repository.\"\r\n exit 10\r\n fi\r\n else\r\n echo \"[Git] Error: Directory contains files but no Git repository found in 'www'.\"\r\n exit 11\r\n fi\r\n\r\n # Check if origin matches the provided GIT_ADDRESS\r\n if [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\n echo \"[Git] Repository origin matches. Pulling latest changes from ${GIT_ADDRESS} in 'www'.\"\r\n git pull || { echo \"[Git] Error: git pull failed for 'www'.\"; exit 12; }\r\n else\r\n echo \"[Git] Error: Repository origin does not match the provided GIT_ADDRESS in 'www'.\"\r\n exit 13\r\n fi\r\n else\r\n # The directory is empty, clone the repository\r\n echo \"[Git] \/mnt\/server\/www directory is empty. Cloning ${GIT_ADDRESS} into \/mnt\/server\/www.\"\r\n git clone ${GIT_ADDRESS} . > \/dev\/null 2>&1 && echo \"[Git] Repository cloned successfully.\" || { echo \"[Git] Error: git clone failed for 'www'.\"; exit 14; }\r\n fi\r\n fi\r\nelse\r\n echo \"[Git] Git operations are disabled. Skipping Git actions.\"\r\nfi\r\n\r\n\r\n# Check if WordPress should be installed\r\nif [ \"${WORDPRESS}\" == \"true\" ] || [ \"${WORDPRESS}\" == \"1\" ]; then\r\n echo \"[SETUP] Install WordPress\"\r\n cd \/mnt\/server\/www\r\n wget -q http:\/\/wordpress.org\/latest.tar.gz > \/dev\/null 2>&1 || { echo \"[SETUP] Error: Downloading WordPress failed.\"; exit 16; }\r\n tar xzf latest.tar.gz >\/dev\/null 2>&1\r\n mv wordpress\/* .\r\n rm -rf wordpress latest.tar.gz\r\n echo \"[SETUP] WordPress installed - http:\/\/ip:port\/wp-admin\"\r\nfi\r\n\r\necho -e \"[DONE] Everything has been installed successfully\"\r\necho -e \"[STATUS] Start webserver\"\r\nbash \/mnt\/server\/nginx.sh", |
| 28 | + "script": "#!\/bin\/bash\r\n\r\n# [SETUP] Install necessary packages, including git\r\necho -e \"[SETUP] Install packages\"\r\napt-get update -qq > \/dev\/null 2>&1 && apt-get install -qq > \/dev\/null 2>&1 -y git wget perl perl-doc fcgiwrap\r\n\r\n# Change to server directory\r\ncd \/mnt\/server\r\n\r\n# [SETUP] Create necessary folders\r\necho -e \"[SETUP] Create folders\"\r\nmkdir -p logs tmp www\r\n\r\n# Clone the default repository into a temporary directory\r\necho \"[Git] Cloning default repository 'https:\/\/github.com\/Ym0T\/pterodactyl-nginx-egg' into temporary directory.\"\r\ngit clone https:\/\/github.com\/Ym0T\/pterodactyl-nginx-egg \/mnt\/server\/gtemp > \/dev\/null 2>&1 && echo \"[Git] Repository cloned successfully.\" || { echo \"[Git] Error: Default repository clone failed.\"; exit 21; }\r\n\r\n# Copy the www folder and files from the temporary repository to the target directory\r\necho \"[Git] Copying folder and files from default repository.\"\r\ncp -r \/mnt\/server\/gtemp\/nginx \/mnt\/server || { echo \"[Git] Error: Copying 'nginx' folder failed.\"; exit 22; }\r\ncp -r \/mnt\/server\/gtemp\/php \/mnt\/server || { echo \"[Git] Error: Copying 'php' folder failed.\"; exit 22; }\r\ncp \/mnt\/server\/gtemp\/nginx.sh \/mnt\/server || { echo \"[Git] Error: Copying 'nginx.sh' file failed.\"; exit 22; }\r\ncp \/mnt\/server\/gtemp\/pull-git.sh \/mnt\/server || { echo \"[Git] Error: Copying 'pull-git.sh' file failed.\"; exit 22; }\r\nchmod +x \/mnt\/server\/nginx.sh && chmod +x \/mnt\/server\/pull-git.sh\r\n\r\n# Remove the temporary cloned repository\r\nrm -rf \/mnt\/server\/gtemp\r\n\r\n# Check if GIT_ADDRESS is set\r\nif [ -z \"${GIT_ADDRESS}\" ]; then\r\n echo \"[Git] Info: GIT_ADDRESS is not set.\"\r\n echo \"[Git] Git operations are disabled. Skipping Git actions.\"\r\nelse\r\n # Add .git suffix to GIT_ADDRESS if it's not present\r\n if [[ ${GIT_ADDRESS} != *.git ]]; then\r\n GIT_ADDRESS=\"${GIT_ADDRESS}.git\"\r\n echo \"[Git] Added .git suffix to GIT_ADDRESS: ${GIT_ADDRESS}\"\r\n fi\r\n\r\n # If username and access token are provided, use authenticated access\r\n if [ -n \"${USERNAME}\" ] && [ -n \"${ACCESS_TOKEN}\" ]; then\r\n echo \"[Git] Using authenticated Git access.\"\r\n GIT_DOMAIN=$(echo \"${GIT_ADDRESS}\" | cut -d\/ -f3)\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_DOMAIN}$(echo ${GIT_ADDRESS} | cut -d\/ -f4-)\"\r\n echo \"[Git] Updated GIT_ADDRESS for authenticated access: ${GIT_ADDRESS}\"\r\n else\r\n echo \"[Git] Using anonymous Git access.\"\r\n fi\r\n\r\n # Check if the 'www' directory exists, if not create it\r\n if [ ! -d \/mnt\/server\/www ]; then\r\n echo \"[Git] Creating \/mnt\/server\/www directory.\"\r\n mkdir -p \/mnt\/server\/www\r\n else\r\n rm -R \/mnt\/server\/www && mkdir -p \/mnt\/server\/www\r\n fi\r\n\r\n cd \/mnt\/server\/www || { echo \"[Git] Error: Could not access \/mnt\/server\/www directory.\"; exit 1; }\r\n\r\n if [ \"$(ls -A \/mnt\/server\/www)\" ]; then\r\n echo \"[Git] \/mnt\/server\/www directory is not empty.\"\r\n \r\n # Check if .git directory exists in 'www'\r\n if [ -d .git ]; then\r\n echo \"[Git] .git directory exists in 'www'.\"\r\n\r\n # Check if .git\/config exists in 'www'\r\n if [ -f .git\/config ]; then\r\n echo \"[Git] Loading repository info from git config in 'www'.\"\r\n ORIGIN=$(git config --get remote.origin.url)\r\n else\r\n echo \"[Git] Error: .git\/config not found in 'www'. The directory may contain files, but it's not a valid Git repository.\"\r\n exit 10\r\n fi\r\n else\r\n echo \"[Git] Error: Directory contains files but no Git repository found in 'www'.\"\r\n exit 11\r\n fi\r\n\r\n # Check if origin matches the provided GIT_ADDRESS\r\n if [ \"${ORIGIN}\" == \"${GIT_ADDRESS}\" ]; then\r\n echo \"[Git] Repository origin matches. Pulling latest changes from ${GIT_ADDRESS} in 'www'.\"\r\n git pull || { echo \"[Git] Error: git pull failed for 'www'.\"; exit 12; }\r\n else\r\n echo \"[Git] Error: Repository origin does not match the provided GIT_ADDRESS in 'www'.\"\r\n exit 13\r\n fi\r\n else\r\n # The directory is empty, clone the repository\r\n echo \"[Git] \/mnt\/server\/www directory is empty. Cloning ${GIT_ADDRESS} into \/mnt\/server\/www.\"\r\n git clone ${GIT_ADDRESS} . > \/dev\/null 2>&1 && echo \"[Git] Repository cloned successfully.\" || { echo \"[Git] Error: git clone failed for 'www'.\"; exit 14; }\r\n fi\r\nfi\r\n\r\n# Check if WordPress should be installed\r\nif [ \"${WORDPRESS}\" == \"true\" ] || [ \"${WORDPRESS}\" == \"1\" ]; then\r\n echo \"[SETUP] Install WordPress\"\r\n cd \/mnt\/server\/www\r\n wget -q http:\/\/wordpress.org\/latest.tar.gz > \/dev\/null 2>&1 || { echo \"[SETUP] Error: Downloading WordPress failed.\"; exit 16; }\r\n tar xzf latest.tar.gz >\/dev\/null 2>&1\r\n mv wordpress\/* .\r\n rm -rf wordpress latest.tar.gz\r\n echo \"[SETUP] WordPress installed - http:\/\/ip:port\/wp-admin\"\r\n elif [ \"${GIT_STATUS}\" == \"0\" ] || [ \"${GIT_STATUS}\" == \"false\" ]; then\r\n # Create a simple PHP info page if WordPress is not installed\r\n echo \"<?php phpinfo(); ?>\" > \"www\/index.php\"\r\nfi\r\n\r\necho -e \"[DONE] Everything has been installed successfully\"\r\necho -e \"[INFO] You can now start the nginx web server\"", |
29 | 29 | "container": "debian:bookworm-slim",
|
30 | 30 | "entrypoint": "bash"
|
31 | 31 | }
|
32 | 32 | },
|
33 | 33 | "variables": [
|
34 | 34 | {
|
35 |
| - "name": "Git Status + Auto update", |
36 |
| - "description": "Enable (git + pull latest files onstartup) or disable git. 1 = on and 0 = off", |
37 |
| - "env_variable": "GIT_STATUS", |
| 35 | + "name": "Git auto update", |
| 36 | + "description": "Enable or disable (pull latest files). 1 = on and 0 = off", |
| 37 | + "env_variable": "GIT_UPDATE", |
38 | 38 | "default_value": "0",
|
39 | 39 | "user_viewable": true,
|
40 | 40 | "user_editable": true,
|
|
0 commit comments