Add admin instance management and system tools

- Implemented sync_dev_hosts.sh for managing local hosts entries for development.
- Created admin_instances.html for managing school instances, including creation and listing.
- Developed admin_system.html for core services management, including restart and backup operations.
- Added my_instance.html for users to view and manage their assigned instances.
- Introduced provision_instance.sh for provisioning new instances with Docker, including Nginx configuration and SSL certificate handling.
This commit is contained in:
2026-04-14 22:12:14 +02:00
parent 5ad0522770
commit c4a483a57c
17 changed files with 2631 additions and 59 deletions
+28 -34
View File
@@ -1,49 +1,43 @@
FROM python:3.12-slim AS builder
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
ARG NUITKA_JOBS=1
ARG NUITKA_LOW_MEMORY=1
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential patchelf \
&& apt-get install -y --no-install-recommends \
git \
iproute2 \
docker.io \
curl \
openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN set -eu; \
arch="$(dpkg --print-architecture)"; \
case "$arch" in \
amd64) compose_arch="x86_64" ;; \
arm64) compose_arch="aarch64" ;; \
*) echo "Unsupported architecture for compose plugin: $arch"; exit 1 ;; \
esac; \
curl -fsSL "https://download.docker.com/linux/static/stable/${compose_arch}/docker-27.1.1.tgz" \
-o /tmp/docker.tgz; \
tar -xzf /tmp/docker.tgz -C /tmp; \
install -m 0755 /tmp/docker/docker /usr/local/bin/docker; \
rm -rf /tmp/docker /tmp/docker.tgz; \
mkdir -p /usr/libexec/docker/cli-plugins; \
curl -fsSL "https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-${compose_arch}" \
-o /usr/libexec/docker/cli-plugins/docker-compose; \
chmod +x /usr/libexec/docker/cli-plugins/docker-compose
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir nuitka ordered-set zstandard
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Build a standalone binary with all required templates/static/data assets.
# Defaults are tuned for lower RAM pressure to avoid host crashes.
RUN set -eu; \
EXTRA_FLAGS=""; \
if [ "$NUITKA_LOW_MEMORY" = "1" ]; then \
EXTRA_FLAGS="--low-memory --lto=no"; \
fi; \
python -m nuitka \
--standalone \
--follow-imports \
--assume-yes-for-downloads \
--jobs="$NUITKA_JOBS" \
--remove-output \
--include-data-dir=templates=templates \
--include-data-dir=static=static \
--include-data-dir=data=data \
--output-dir=build \
$EXTRA_FLAGS \
main.py
FROM python:3.12-slim AS runtime
WORKDIR /app
COPY --from=builder /app/build/main.dist ./
RUN chmod +x /app/provision_instance.sh
EXPOSE 4999
CMD ["./main.bin"]
CMD ["python", "main.py"]