-
Notifications
You must be signed in to change notification settings - Fork 13
/
egg-nginx.json
135 lines (135 loc) · 11.6 KB
/
egg-nginx.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2024-10-08T17:00:42+02:00",
"name": "Nginx",
"author": "YmoT@tuta.com",
"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.",
"features": null,
"docker_images": {
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.3-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.3-latest",
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.2-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.2-latest",
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.1-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.1-latest",
"ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest": "ghcr.io\/ym0t\/pterodactyl-nginx-egg:8.0-latest"
},
"file_denylist": [],
"startup": "if [ {{GIT_UPDATE}} == 1 ]; then {{STARTUP_COMMAND_GIT}}; fi; echo \"{{PHP_VERSION}}\" > \"php_version.txt\"; {{STARTUP_COMMAND}};",
"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 \"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}",
"startup": "{\r\n \"done\": \"[Docker] Services successfully launched\"\r\n}",
"logs": "{\r\n \"location\": \"logs\/latest.log\"\r\n}",
"stop": "^C & ^C"
},
"scripts": {
"installation": {
"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 \r\n # Extract the domain and the rest of the URL, ensuring the correct format\r\n GIT_DOMAIN=$(echo \"${GIT_ADDRESS}\" | cut -d\/ -f3)\r\n GIT_REPO=$(echo \"${GIT_ADDRESS}\" | cut -d\/ -f4-) # Rest of the URL after the domain\r\n \r\n # Construct the authenticated Git URL\r\n GIT_ADDRESS=\"https:\/\/${USERNAME}:${ACCESS_TOKEN}@${GIT_DOMAIN}\/${GIT_REPO}\"\r\n \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 [ -z \"${GIT_ADDRESS}\" ]; 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\"",
"container": "debian:bookworm-slim",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Git auto update",
"description": "Enable or disable (pull latest files). 1 = on and 0 = off",
"env_variable": "GIT_UPDATE",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
},
{
"name": "Startup Command Git",
"description": "The startup file for Git.",
"env_variable": "STARTUP_COMMAND_GIT",
"default_value": ".\/pull-git.sh",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Git Repo Address",
"description": "Git repo to clone\r\n\r\nI.E. https:\/\/github.com\/Ym0T\/pterodactyl-nginx-egg",
"env_variable": "GIT_ADDRESS",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"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",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Git 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 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": "Startup Command",
"description": "The startup file for Nginx.",
"env_variable": "STARTUP_COMMAND",
"default_value": ".\/nginx.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": "PHP Version",
"description": "Select the correct PHP version! See the tag behind the Docker image. \r\nExample: \r\nSelected image: ghcr.io\/ym0t\/nginx_php:8.3\r\nEnter in the field: 8.2 \r\nSelected image: ghcr.io\/ym0t\/nginx_php:8.1 \r\nEnter in the field: 8.1",
"env_variable": "PHP_VERSION",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|max:3",
"field_type": "text"
},
{
"name": "Memory_limit",
"description": "Change the memory_limit value from the php.ini file",
"env_variable": "memory_limit",
"default_value": "128M",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|max:20",
"field_type": "text"
}
]
}