Merge pull request #43 from 6ec123321/master

Update py3-kms docker-container
This commit is contained in:
Matteo ℱan 2019-10-05 22:22:30 +02:00 committed by GitHub
commit 096323f1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 121 additions and 30 deletions

View File

@ -31,8 +31,9 @@ docker run -d --name py3-kms \
-e IP=0.0.0.0 \ -e IP=0.0.0.0 \
-e PORT=1688 \ -e PORT=1688 \
-e SQLITE=true \ -e SQLITE=true \
-e HWID=random \ -e HWID=RANDOM \
-e LOGLEVEL=INFO \ -e LOGLEVEL=INFO \
-e LOGSIZE=2 \
-e LOGFILE=/var/log/py3-kms.log \ -e LOGFILE=/var/log/py3-kms.log \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \ -v /var/log:/var/log:rw \
@ -94,7 +95,7 @@ ENV SQLITE false
ENV HWID 364F463A8863D35F ENV HWID 364F463A8863D35F
# Use this flag to specify a HWID. # Use this flag to specify a HWID.
# The HWID must be an 16-character string of hex characters. # The HWID must be an 16-character string of hex characters.
# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. # The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
@ -105,6 +106,11 @@ ENV LOGLEVEL ERROR
# RU: Лог-файл # RU: Лог-файл
ENV LOGFILE /var/log/pykms_logserver.log ENV LOGFILE /var/log/pykms_logserver.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log".
# EN: log file size in MB
# RU: Максимальный размер Лог-файл в мегабайтах
ENV LOGSIZE ""
# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.
``` ```
# Other Important Stuff # Other Important Stuff

View File

@ -53,7 +53,7 @@ ENV SQLITE false
ENV HWID 364F463A8863D35F ENV HWID 364F463A8863D35F
# Use this flag to specify a HWID. # Use this flag to specify a HWID.
# The HWID must be an 16-character string of hex characters. # The HWID must be an 16-character string of hex characters.
# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. # The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
@ -65,13 +65,18 @@ ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log ENV LOGFILE /var/log/pykms_logserver.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log".
# EN: log file size in MB
# RU: Максимальный размер Лог-файл в мегабайтах
ENV LOGSIZE ""
# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.
# EN: Startup script # EN: Startup script
# RU: Скрипт автозапуска # RU: Скрипт автозапуска
COPY start.sh /usr/bin/start.sh COPY start.sh /usr/bin/start.sh
# EN: Software installation # EN: Software installation
# RU: Установка программного обеспечения # RU: Установка программного обеспечения
RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \ RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \
apk update && \ apk update && \
apk upgrade && \ apk upgrade && \
apk add --update \ apk add --update \
@ -80,17 +85,19 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/a
python2 \ python2 \
py2-argparse \ py2-argparse \
py2-tz \ py2-tz \
py2-pysqlite \
py2-flask \ py2-flask \
py2-pygments \ py2-pygments \
python2-tkinter \ python2-tkinter \
py2-pysqlite \
py2-pip && \ py2-pip && \
# EN: Clone git-repo # EN: Clone git-repo
# RU: Клонирование git-репозитория # RU: Клонирование git-репозитория
git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \ git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \ git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \ mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \ rm -rf /tmp/sqlite_web && \
pip install peewee tzlocal && \ pip install peewee tzlocal && \
@ -103,7 +110,7 @@ chmod a+x /usr/bin/start.sh && \
apk del git py2-pip apk del git py2-pip
# Set Workdir # Set Workdir
WORKDIR /home/py-kms/py-kms WORKDIR /home/py-kms
# Expose ports # Expose ports
EXPOSE ${PORT}/tcp EXPOSE ${PORT}/tcp

View File

@ -1,12 +1,16 @@
docker stop py2-kms
docker rm py2-kms
docker run -d --name py2-kms \ docker run -d --name py2-kms \
-p 8080:8080 \ -p 8080:8080 \
-p 1688:1688 \ -p 1688:1688 \
-e IP=0.0.0.0 \ -e IP=0.0.0.0 \
-e PORT=1688 \ -e PORT=1688 \
-e CLIENT_COUNT=30 \
-e SQLITE=true \ -e SQLITE=true \
-e HWID=random \ -e HWID=RANDOM \
-e LOGLEVEL=INFO \ -e LOGLEVEL=INFO \
-e LOGFILE=/var/log/py2-kms.log \ -e LOGFILE=/var/log/py2-kms.log \
-e LOGSIZE=2 \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \ -v /var/log:/var/log:rw \
--restart unless-stopped pykms/pykms:py2-kms --restart unless-stopped pykms/pykms:py2-kms

View File

@ -1,20 +1,52 @@
#!/bin/bash #!/bin/bash
# EN: Start daemons # EN: Start daemons
# RU: Запуск демонов # RU: Запуск демонов
cd /home/py-kms/py-kms cd /home/py-kms
if [ "$SQLITE" == false ]; if [ "$SQLITE" == false ];
then then
if [ "$EPID" == "" ]; if [ "$EPID" == "" ];
then
if [ "$LOGSIZE" == "" ];
then then
/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} /usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}
else else
/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} /usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE}
fi
else
if [ "$LOGSIZE" == "" ];
then
/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}
else
/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE}
fi
fi fi
else else
if [ "$EPID" == "" ]; if [ "$EPID" == "" ];
then then
/bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db if [ "$LOGSIZE" == "" ];
then
/bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &"
sleep 5
/usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
else else
/bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db /bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &"
sleep 5
/usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
fi
else
if [ "$LOGSIZE" == "" ];
then
/bin/bash -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &"
sleep5
/usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
else
/bin/sh -c "/usr/bin/python pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &"
sleep 5
/usr/bin/python pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
fi
fi fi
fi fi

View File

@ -50,10 +50,10 @@ ENV SQLITE false
# EN: hwid # EN: hwid
# RU: hwid # RU: hwid
ENV HWID 364F463A8863D35F ENV HWID "364F463A8863D35F"
# Use this flag to specify a HWID. # Use this flag to specify a HWID.
# The HWID must be an 16-character string of hex characters. # The HWID must be an 16-character string of hex characters.
# The default is "364F463A8863D35F" or type "random" to auto generate the HWID. # The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG") # RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
@ -65,21 +65,25 @@ ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log ENV LOGFILE /var/log/pykms_logserver.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log". # Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log".
# EN: log file size in MB
# RU: Максимальный размер Лог-файл в мегабайтах
ENV LOGSIZE ""
# Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.
# EN: Startup script # EN: Startup script
# RU: Скрипт автозапуска # RU: Скрипт автозапуска
COPY start.sh /usr/bin/start.sh COPY start.sh /usr/bin/start.sh
# EN: Software installation # EN: Software installation
# RU: Установка программного обеспечения # RU: Установка программного обеспечения
RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \ RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \
apk update && \ apk update && \
apk upgrade && \ apk upgrade && \
apk add --update \ apk add --update \
bash \ bash \
git \ git \
python3 \
py3-argparse \ py3-argparse \
py3-tz \ # py3-tz \
py3-flask \ py3-flask \
py3-pygments \ py3-pygments \
python3-tkinter \ python3-tkinter \
@ -88,11 +92,13 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/a
# EN: Clone git-repo # EN: Clone git-repo
# RU: Клонирование git-репозитория # RU: Клонирование git-репозитория
git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \ git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \ git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \ mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \ rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal && \ pip3 install peewee tzlocal pysqlite3 && \
# EN: Change permissions # EN: Change permissions
# RU: Меняем права доступа # RU: Меняем права доступа
@ -100,10 +106,10 @@ chmod a+x /usr/bin/start.sh && \
# EN: Clear after install software # EN: Clear after install software
# RU: Очистка после установки программного обеспечения # RU: Очистка после установки программного обеспечения
apk del git py3-pip apk del git
# Set Workdir # Set Workdir
WORKDIR /home/py-kms/py-kms WORKDIR /home/py-kms
# Expose ports # Expose ports
EXPOSE ${PORT}/tcp EXPOSE ${PORT}/tcp

View File

@ -1,12 +1,16 @@
docker stop py3-kms
docker rm py3-kms
docker run -d --name py3-kms \ docker run -d --name py3-kms \
-p 8080:8080 \ -p 8080:8080 \
-p 1688:1688 \ -p 1688:1688 \
-e IP=0.0.0.0 \ -e IP=0.0.0.0 \
-e PORT=1688 \ -e PORT=1688 \
-e SQLITE=true \ -e SQLITE=true \
-e HWID=random \ -e HWID=RANDOM \
-e LOGLEVEL=INFO \ -e LOGLEVEL=INFO \
-e LOGFILE=/var/log/py3-kms.log \ -e LOGFILE=/var/log/py3-kms.log \
-e LOGSIZE=2 \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \ -v /var/log:/var/log:rw \
--restart unless-stopped pykms/pykms:py3-kms --restart unless-stopped pykms/pykms:py3-kms
# --restart unless-stopped ekonprof18/pykms:py3-kms

View File

@ -1,20 +1,52 @@
#!/bin/bash #!/bin/bash
# EN: Start daemons # EN: Start daemons
# RU: Запуск демонов # RU: Запуск демонов
cd /home/py-kms/py-kms cd /home/py-kms
if [ "$SQLITE" == false ]; if [ "$SQLITE" == false ];
then then
if [ "$EPID" == "" ]; if [ "$EPID" == "" ];
then
if [ "$LOGSIZE" == "" ];
then then
/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}
else else
/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE}
fi
else
if [ "$LOGSIZE" == "" ];
then
/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}
else
/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE}
fi
fi fi
else else
if [ "$EPID" == "" ]; if [ "$EPID" == "" ];
then then
/bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only if [ "$LOGSIZE" == "" ];
then
/bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &"
sleep 5
/usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
else else
/bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &" && /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only /bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &"
sleep 5
/usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
fi
else
if [ "$LOGSIZE" == "" ];
then
/bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} &"
sleep5
/usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
else
/bin/sh -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE} -S ${LOGSIZE} &"
sleep 5
/usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 &
/usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
fi
fi fi
fi fi