Skip to content

Commit

Permalink
Merge pull request #39 from thespad/3.20-again
Browse files Browse the repository at this point in the history
Use IP env, default to IPv6
  • Loading branch information
thespad authored May 26, 2024
2 parents bdef06d + 6387917 commit 26563f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine:3.19
FROM ghcr.io/linuxserver/baseimage-alpine:3.20

# set version label
ARG BUILD_DATE
Expand All @@ -11,6 +11,7 @@ LABEL maintainer="thespad"
LABEL org.opencontainers.image.source="https://github.com/thespad/docker-py-kms"
LABEL org.opencontainers.image.url="https://github.com/thespad/docker-py-kms"
LABEL org.opencontainers.image.description="A port of node-kms created by cyrozap, which is a port of either the C#, C++, or .NET implementations of KMS Emulator."
LABEL org.opencontainers.image.authors="thespad"

ENV PYTHONIOENCODING=utf-8 \
VIRTUAL_ENV=/pyenv \
Expand All @@ -33,7 +34,8 @@ RUN \
setuptools \
wheel && \
pip install -U --no-cache-dir pytz && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.19 -r /home/py-kms/requirements.txt && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20 -r /home/py-kms/requirements.txt && \
printf "Version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
apk del --purge \
build-dependencies && \
rm -rf \
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
[![GitHub Stars](https://img.shields.io/github/stars/thespad/docker-py-kms.svg?color=26689A&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/thespad/docker-py-kms)
[![Docker Stars](https://img.shields.io/docker/stars/thespad/py-kms.svg?color=26689A&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/thespad/py-kms)

[![ci](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-check-and-release.yml?branch=main&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Upstream%20Updates)](https://github.com/thespad/docker-py-kms/actions/workflows/call-check-and-release.yml)
[![ci](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-baseimage-update.yml?branch=main&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Baseimage%20Updates)](https://github.com/thespad/docker-py-kms/actions/workflows/call-baseimage-update.yml)
[![ci](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-build-image.yml?labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Build%20Image)](https://github.com/thespad/docker-py-kms/actions/workflows/call-build-image.yml)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-check-and-release.yml?branch=main&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Upstream%20Updates)](https://github.com/thespad/docker-py-kms/actions/workflows/call-check-and-release.yml)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-baseimage-update.yml?branch=main&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Check%20For%20Baseimage%20Updates)](https://github.com/thespad/docker-py-kms/actions/workflows/call-baseimage-update.yml)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/thespad/docker-py-kms/call-build-image.yml?labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github&label=Build%20Image)](https://github.com/thespad/docker-py-kms/actions/workflows/call-build-image.yml)

[py-kms](https://github.com/Py-KMS-Organization/py-kms) is a port of node-kms created by cyrozap, which is a port of either the C#, C++, or .NET implementations of KMS Emulator. The original version was written by CODYQX4 and is derived from the reverse-engineered code of Microsoft's official KMS. This version of py-kms is itself a fork of the original implementation by SystemRage, which was abandoned early 2021.

Expand Down Expand Up @@ -42,7 +42,6 @@ Compatible with docker-compose v2 schemas.

```yaml
---
version: "2.1"
services:
py-kms:
image: ghcr.io/thespad/py-kms:latest
Expand All @@ -51,9 +50,9 @@ services:
- PUID=1000
- PGID=1000
- TZ=Europe/London
- LEGACY_NET= #optional
- IP=0.0.0.0 #optional
volumes:
- /path/to/appdata/config:/config
- /path/to/py-kms/config:/config
ports:
- 1688:1688
restart: unless-stopped
Expand All @@ -66,10 +65,10 @@ docker run -d \
--name=py-kms \
-e PUID=1000 \
-e PGID=1000 \
-e LEGACY_NET= `#optional` \
-e IP=0.0.0.0 `#optional` \
-e TZ=Europe/London \
-p 1688:1688 \
-v /path/to/appdata/config:/config \
-v /path/to/py-kms/config:/config \
--restart unless-stopped \
ghcr.io/thespad/py-kms:latest
```
Expand All @@ -84,7 +83,7 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
| `-e LEGACY_NET=` | Set to `true` if you have an ancient host that can't support IPv6 dual stack. This will force py-kms to only bind to the IPv4 interface inside the container. |
| `-e IP=` | IP address to bind to. Use `0.0.0.0` for all IPv4 interfaces, use `::` for all IPv6 interfaces, or specify a full address. Note that for compose you must quote the full variable, e.g. `- "IP=0.0.0.0"` or `- "IP=::"`. |
| `-v /config` | Contains all relevant configuration files. |

## User / Group Identifiers
Expand All @@ -111,6 +110,7 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel

## Versions

* **26.05.24:** - Rebase to Alpine 3.20.
* **30.12.23:** - Rebase to Alpine 3.19.
* **29.10.23:** - Provide IPv4-only option for legacy hosts.
* **14.05.23:** - Rebase to Alpine 3.18. Drop support for armhf.
Expand Down
12 changes: 3 additions & 9 deletions root/etc/s6-overlay/s6-rc.d/svc-py-kms/run
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [[ ${LEGACY_NET,,} = "true" ]]; then
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \
cd /home/py-kms s6-setuidgid abc python3 -u pykms_Server.py "0.0.0.0" "${PORT}" -l "${LCID}" -c "${CLIENT_COUNT}" -a "${ACTIVATION_INTERVAL}" -r "${RENEWAL_INTERVAL}" -w "${HWID}" -V "${LOGLEVEL}" -F "${LOGFILE}"
else
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \
cd /home/py-kms s6-setuidgid abc python3 -u pykms_Server.py "::" "${PORT}" -l "${LCID}" -c "${CLIENT_COUNT}" -a "${ACTIVATION_INTERVAL}" -r "${RENEWAL_INTERVAL}" -w "${HWID}" -V "${LOGLEVEL}" -F "${LOGFILE}"
fi
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \
cd /home/py-kms s6-setuidgid abc python3 -u pykms_Server.py "${IP:-0.0.0.0}" "${PORT}" -l "${LCID}" -c "${CLIENT_COUNT}" -a "${ACTIVATION_INTERVAL}" -r "${RENEWAL_INTERVAL}" -w "${HWID}" -V "${LOGLEVEL}" -F "${LOGFILE}"

0 comments on commit 26563f9

Please sign in to comment.