mirror of
https://github.com/Py-KMS-Organization/py-kms.git
synced 2025-05-23 11:37:09 -04:00
parent
dada9c5204
commit
858fb14cab
3 changed files with 7 additions and 5 deletions
|
@ -12,6 +12,7 @@ ENV HWID RANDOM
|
||||||
ENV LOGLEVEL INFO
|
ENV LOGLEVEL INFO
|
||||||
ENV LOGFILE STDOUT
|
ENV LOGFILE STDOUT
|
||||||
ENV LOGSIZE ""
|
ENV LOGSIZE ""
|
||||||
|
ENV WEBUI 0
|
||||||
|
|
||||||
COPY docker/docker-py3-kms-minimal/requirements.txt /home/py-kms/requirements.txt
|
COPY docker/docker-py3-kms-minimal/requirements.txt /home/py-kms/requirements.txt
|
||||||
RUN apk add --no-cache --update \
|
RUN apk add --no-cache --update \
|
||||||
|
|
|
@ -16,6 +16,7 @@ ENV LOGLEVEL INFO
|
||||||
ENV LOGFILE STDOUT
|
ENV LOGFILE STDOUT
|
||||||
ENV LOGSIZE ""
|
ENV LOGSIZE ""
|
||||||
ENV TZ America/Chicago
|
ENV TZ America/Chicago
|
||||||
|
ENV WEBUI 1
|
||||||
|
|
||||||
COPY docker/docker-py3-kms/requirements.txt /home/py-kms/
|
COPY docker/docker-py3-kms/requirements.txt /home/py-kms/
|
||||||
RUN apk add --no-cache --update \
|
RUN apk add --no-cache --update \
|
||||||
|
|
|
@ -27,7 +27,7 @@ if log_level_bootstrap == "MININFO":
|
||||||
log_file = os.environ.get('LOGFILE', 'STDOUT')
|
log_file = os.environ.get('LOGFILE', 'STDOUT')
|
||||||
listen_ip = os.environ.get('IP', '::').split()
|
listen_ip = os.environ.get('IP', '::').split()
|
||||||
listen_port = os.environ.get('PORT', '1688')
|
listen_port = os.environ.get('PORT', '1688')
|
||||||
want_webui = os.environ.get('WEBUI', '0')
|
want_webui = os.environ.get('WEBUI', '0') == '1' # if the variable is not provided, we assume the user does not want the webui
|
||||||
|
|
||||||
def start_kms():
|
def start_kms():
|
||||||
# Make sure the full path to the db exists
|
# Make sure the full path to the db exists
|
||||||
|
@ -40,14 +40,14 @@ def start_kms():
|
||||||
if env in os.environ and os.environ.get(env) != '':
|
if env in os.environ and os.environ.get(env) != '':
|
||||||
command.append(arg)
|
command.append(arg)
|
||||||
command.append(os.environ.get(env))
|
command.append(os.environ.get(env))
|
||||||
|
if want_webui: # add this command directly before the "connect" subparser - otherwise you'll get silent crashes!
|
||||||
|
command.append('-s')
|
||||||
|
command.append(db_path)
|
||||||
if len(listen_ip) > 1:
|
if len(listen_ip) > 1:
|
||||||
command.append("connect")
|
command.append("connect")
|
||||||
for i in range(1, len(listen_ip)):
|
for i in range(1, len(listen_ip)):
|
||||||
command.append("-n")
|
command.append("-n")
|
||||||
command.append(listen_ip[i] + "," + listen_port)
|
command.append(listen_ip[i] + "," + listen_port)
|
||||||
if want_webui:
|
|
||||||
command.append('-s')
|
|
||||||
command.append(db_path)
|
|
||||||
|
|
||||||
loggersrv.debug("server_cmd: %s" % (" ".join(str(x) for x in command).strip()))
|
loggersrv.debug("server_cmd: %s" % (" ".join(str(x) for x in command).strip()))
|
||||||
pykms_process = subprocess.Popen(command)
|
pykms_process = subprocess.Popen(command)
|
||||||
|
@ -63,7 +63,7 @@ def start_kms():
|
||||||
pykms_webui_env['PYKMS_VERSION_PATH'] = '/VERSION'
|
pykms_webui_env['PYKMS_VERSION_PATH'] = '/VERSION'
|
||||||
pykms_webui_process = subprocess.Popen(['gunicorn', '--log-level', os.environ.get('LOGLEVEL'), 'pykms_WebUI:app'], env=pykms_webui_env)
|
pykms_webui_process = subprocess.Popen(['gunicorn', '--log-level', os.environ.get('LOGLEVEL'), 'pykms_WebUI:app'], env=pykms_webui_env)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
loggersrv.error("Failed to start webui: %s" % e)
|
loggersrv.error("Failed to start webui (ignoring and continuing anyways): %s" % e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pykms_process.wait()
|
pykms_process.wait()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue