SystemRage / py-kms

KMS Server Emulator written in Python
The Unlicense
2.04k stars 618 forks source link

Docker with SQLite fails to start due to incorrect parms #122

Open ARGO1960 opened 3 years ago

ARGO1960 commented 3 years ago

Great work!. Really like it helps me in small Lab without internet connections. Now I was wondering what the SQLite version had to offer. So I tried to run the python3 tag of the container. But it complains about the -s parameter witch you can not set from the docker ENV..

I changed the start.sh where the -s param is handled. FROM /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}

/bin/bash -c "/usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${PWD}/pykms_database.db -w ${HWID} -V ${LOGLEVEL}

now it works.

simonmicro commented 3 years ago

@SystemRage Did this change, or did I just messed that one up?

ARGO1960 commented 3 years ago

Well I liked the SQLITE stuff just to see whats activated. then I found the db is lost every time I rebuild the container, witch is default behavior..

So I did some changes for my self but maybe an idea to put in for the python3 TAG. First I changed again the start.sh where the -s parameter is set. Like this: (Only show one line) 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 ${SQLITEDIR}/pykms_database.db -w ${HWID} -V ${LOGLEVEL} -F ${LOG$ sleep 5 /usr/bin/python3 pykms_Client.py ${IP} ${PORT} -m Windows10 & /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${SQLITEDIR}/pykms_database.db --read-only

THEN in the Dockerfile add ENV SQLITEDIR /home/py-kms/db

This way you can override the directory you would like to have the DB. NOW in the docker-compose.yaml environment: - SQLITEDIR=/home/py-kms/db/ volumes: - ./:/home/py-kms/db:rw

regards Arnold

simonmicro commented 3 years ago

Yes and no - I think I would modify the path to point to a more "well known" data path like /data, which could be easily mounted into volumes. The same for the log files, I think we should move them to /log, so you could more easily access them, without having to know the container structure... Also note that into the docs! Maybe we should even start to clean everything up? Like move the pykms files into /srv?

Has anyone some thoughts on this? 🤔