-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegg-licensing-server.json
127 lines (127 loc) · 6.33 KB
/
egg-licensing-server.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
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2023-09-20T20:31:05-07:00",
"name": "Licensing Server",
"author": "[email protected]",
"description": "Licensing Server",
"features": null,
"docker_images": {
"Python 3.11": "ghcr.io\/parkervcp\/yolks:python_3.11",
"Python 3.10": "ghcr.io\/parkervcp\/yolks:python_3.10",
"Python 3.9": "ghcr.io\/parkervcp\/yolks:python_3.9",
"Python 3.8": "ghcr.io\/parkervcp\/yolks:python_3.8",
"Python 3.7": "ghcr.io\/parkervcp\/yolks:python_3.7",
"Python 2.7": "ghcr.io\/parkervcp\/yolks:python_2.7"
},
"file_denylist": [],
"startup": "python -m pip install --upgrade pip; if [[ ! -z \"{{PY_PACKAGES}}\" ]]; then pip install -U --prefix .local {{PY_PACKAGES}}; fi; if [[ -f \/home\/container\/{{REQUIREMENTS_FILE}} ]]; then pip install -U --prefix .local -r {{REQUIREMENTS_FILE}}; fi; \/usr\/local\/bin\/python \/home\/container\/{{PY_FILE}} --log-level {{LOG_LEVEL}}",
"config": {
"files": "{}",
"startup": "{\r\n \"done\": \"Database connected\"\r\n}",
"logs": "{}",
"stop": "^^C"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n#\r\n# Server Files: \/mnt\/server\r\n#!\/bin\/bash\r\n# Update and install dependencies\r\napt update\r\napt -y install mariadb-client curl\r\n# Construct the DATABASE_URL from environment variables\r\nDB_USER=${DB_USER}\r\nDB_PASSWORD=${DB_PASSWORD}\r\nDB_HOST=${DB_HOST}\r\nDB_PORT=${DB_PORT}\r\nDB_NAME=${DB_NAME}\r\nDATABASE_URL=\"mysql:\/\/${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}\/${DB_NAME}\"\r\nexport DATABASE_URL=${DATABASE_URL}\r\n# Connect to the database and create the table if it does not exist\r\nmysql -h ${DB_HOST} -P ${DB_PORT} -u ${DB_USER} -p${DB_PASSWORD} -D ${DB_NAME} <<EOF\r\nCREATE TABLE IF NOT EXISTS Licensing (\r\n license VARCHAR(255) NOT NULL PRIMARY KEY,\r\n ip VARCHAR(512) NOT NULL,\r\n discordId VARCHAR(25) NOT NULL,\r\n email VARCHAR(100) NOT NULL,\r\n UNIQUE KEY Licensing_license_ip_key (license, ip)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\r\nEOF\r\n# Create the license_check view if it does not already exist\r\nview_exists=$(mysql -h ${DB_HOST} -P ${DB_PORT} -u ${DB_USER} -p${DB_PASSWORD} -D ${DB_NAME} -N -B -e \"SELECT COUNT(*) FROM information_schema.VIEWS WHERE TABLE_NAME = 'license_check';\")\r\nif [[ ${view_exists} -eq 0 ]]; then\r\n# Create the license_check view only if it doesn't exist\r\nmysql -h ${DB_HOST} -P ${DB_PORT} -u ${DB_USER} -p${DB_PASSWORD} -D ${DB_NAME} <<EOF\r\nCREATE VIEW license_check AS\r\nSELECT license, ip FROM Licensing;\r\nEOF\r\nfi\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\necho \"Installing latest version of the licensing server from Github repo \\\"https:\/\/github.com\/Loki-101\/licensing\\\"\"\r\ncurl -LJO https:\/\/github.com\/Loki-101\/licensing\/releases\/latest\/download\/app.py -LJO https:\/\/github.com\/Loki-101\/licensing\/releases\/latest\/download\/requirements.txt\r\necho -e \"install complete\"\r\nexit 0",
"container": "python:3.8-slim",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "App py file",
"description": "The file that starts the App.",
"env_variable": "PY_FILE",
"default_value": "app.py",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Additional Python packages",
"description": "Install additional python packages.\r\n\r\nUse spaces to separate",
"env_variable": "PY_PACKAGES",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
},
{
"name": "Requirements file",
"description": "if there are other requirements files to choose from.",
"env_variable": "REQUIREMENTS_FILE",
"default_value": "requirements.txt",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "DB_HOST",
"description": "Database Host",
"env_variable": "DB_HOST",
"default_value": "172.18.0.1",
"user_viewable": false,
"user_editable": false,
"rules": "required|string|max:20",
"field_type": "text"
},
{
"name": "DB_USER",
"description": "Database User",
"env_variable": "DB_USER",
"default_value": "",
"user_viewable": false,
"user_editable": false,
"rules": "required|string|max:40",
"field_type": "text"
},
{
"name": "DB_PASSWORD",
"description": "Database Password",
"env_variable": "DB_PASSWORD",
"default_value": "",
"user_viewable": false,
"user_editable": false,
"rules": "required|string|max:40",
"field_type": "text"
},
{
"name": "DB_NAME",
"description": "Database Name",
"env_variable": "DB_NAME",
"default_value": "",
"user_viewable": false,
"user_editable": false,
"rules": "required|string|max:20",
"field_type": "text"
},
{
"name": "DB_PORT",
"description": "Database Port",
"env_variable": "DB_PORT",
"default_value": "3306",
"user_viewable": false,
"user_editable": false,
"rules": "required|string|max:5",
"field_type": "text"
},
{
"name": "LOG_LEVEL",
"description": "Can be set to DEBUG, INFO, WARNING, or ERROR (Case matters, leave them all caps)",
"env_variable": "LOG_LEVEL",
"default_value": "INFO",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|max:20",
"field_type": "text"
}
]
}