Refactor Dockerfile and nginxHandler.py

This commit is contained in:
Janis
2023-11-24 17:40:13 +01:00
parent 4160b51e22
commit b6ad4608cb
4 changed files with 12 additions and 33 deletions

View File

@@ -1,16 +0,0 @@
version: "3.9"
services:
mc_placeholder_starting:
container_name: mc_placeholder_starting
image: itzg/minecraft-server
ports:
- "20000:20000"
environment:
type: "PAPER"
EULA: "TRUE"
MOTD: "starting..."
MAX_PLAYERS: "0"
MAX_MEMORY: "200M"
SERVER_PORT: "20000"
ONLINE_MODE: "FALSE"

View File

@@ -24,6 +24,7 @@ class NginxHandler:
print(f.read())
def setup_config_file(self, port_ip_map, current_container_ip):
proxy_timeout = "300ms"
self.stop()
print('Setting up NGINX config file...')
print('port_ip_map: {}'.format(port_ip_map))
@@ -43,6 +44,12 @@ class NginxHandler:
nginx_conf.write(' server {\n')
nginx_conf.write(' listen {}:{};\n'.format(
current_container_ip, port))
nginx_conf.write(' proxy_connect_timeout {};\n'.format(
proxy_timeout))
nginx_conf.write(' proxy_timeout {};\n'.format(
proxy_timeout))
nginx_conf.write(' proxy_pass upstream_{};\n'.format(port))
nginx_conf.write(' }\n')
nginx_conf.write('}\n')