ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Drop gevent and the stale backend Dockerfile
Juan Denisb739a6b17e23
diff --git a/Dockerfile b/Dockerfileindex 82ef4069..f212f1f3 100644--- a/Dockerfile+++ b/Dockerfile@@ -44,7 +44,7 @@ RUN npm run build# Stage 2: Python dependency builder## The compiler toolchain (gcc, *-dev headers) is needed to build wheels for-# gevent / cryptography / lxml on platforms without a prebuilt wheel, but it is+# cryptography / lxml / psutil on platforms without a prebuilt wheel, but it is# ~280 MB and has no business in a running panel. Building into a self-contained# venv here lets the runtime stage take the result and leave the toolchain behind.FROM python:3.11-slim-bookworm AS python-builder@@ -55,8 +55,6 @@ ENV PYTHONDONTWRITEBYTECODE=1 \RUN apt-get update && apt-get install -y --no-install-recommends \gcc \python3-dev \- # Required for gevent- libevent-dev \# Required for cryptographylibffi-dev \libssl-dev \@@ -73,7 +71,7 @@ RUN pip install --no-cache-dir --upgrade pip \# surfaces as a failed image build, never as a half-installed panel on a host.## 1. Bundled test suites. Third-party packages ship their own pytest trees-# (gevent and passlib are the big ones) that no running panel imports.+# (passlib is the big one) that no running panel imports.# 2. botocore API models. botocore carries JSON models for 400+ AWS services# (~15 MB); ServerKit constructs exactly three clients — s3# (storage_provider_service), route53 (dns_provider_service) and sesdiff --git a/backend/Dockerfile b/backend/Dockerfiledeleted file mode 100644index c8986ce9..00000000--- a/backend/Dockerfile+++ /dev/null@@ -1,71 +0,0 @@-# Backend Dockerfile for ServerKit-#-# NOTE: A containerized backend CANNOT manage the host (no host Docker daemon,-# nginx, systemctl, or real /var/serverkit/apps). The canonical deployment runs-# the backend on the host via systemd (see install.sh + docker-compose.yml,-# which is frontend-only). This image is only for local/dev or all-in-one demos.-FROM python:3.11-slim-bookworm--# Set environment variables-ENV PYTHONDONTWRITEBYTECODE=1 \- PYTHONUNBUFFERED=1 \- FLASK_ENV=production \- SERVERKIT_BACKEND_PORT=5000--# Set working directory-WORKDIR /app--# Install system dependencies including ClamAV for security scanning-RUN apt-get update && apt-get install -y --no-install-recommends \- # Build dependencies- gcc \- python3-dev \- libpq-dev \- libffi-dev \- libssl-dev \- libevent-dev \- # ClamAV antivirus- clamav \- clamav-daemon \- clamav-freshclam \- # Utilities- curl \- procps \- && rm -rf /var/lib/apt/lists/* \- && apt-get clean--# Create directories for ServerKit-RUN mkdir -p /etc/serverkit /var/serverkit/apps /app/logs /var/quarantine /app/instance /var/backups/serverkit--# Copy requirements first for caching-COPY requirements.txt .--# Install Python dependencies-RUN pip install --no-cache-dir -r requirements.txt \- && pip install --no-cache-dir gunicorn gevent gevent-websocket--# Copy application code-COPY . .--# Create non-root user and set permissions. /var/serverkit must be owned by-# appuser too, otherwise the (dev/demo) backend cannot create app directories-# under /var/serverkit/apps and fails with EACCES.-RUN useradd --create-home appuser \- && chown -R appuser:appuser /app \- && chown -R appuser:appuser /app/instance \- && chown -R appuser:appuser /etc/serverkit \- && chown -R appuser:appuser /var/serverkit \- && chown -R appuser:appuser /var/quarantine \- && chown -R appuser:appuser /var/backups/serverkit--USER appuser--# Expose port-EXPOSE 5000--# Health check-HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \- CMD curl -f "http://localhost:${SERVERKIT_BACKEND_PORT:-5000}/api/v1/system/health" || exit 1--# Run with gunicorn + gevent for WebSocket support-CMD ["sh", "-c", "exec gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:${SERVERKIT_BACKEND_PORT:-5000} --timeout 120 --access-logfile - --error-logfile - run:app"]diff --git a/backend/requirements.txt b/backend/requirements.txtindex 650bff95..aa289ab2 100644--- a/backend/requirements.txt+++ b/backend/requirements.txt@@ -37,8 +37,6 @@ psutil==5.9.7# against async_mode='threading' (browser: "Invalid frame header").gunicorn==23.0.0simple-websocket==1.1.0-gevent==25.4.2-gevent-websocket==0.10.1# Environment variablespython-dotenv==1.2.2diff --git a/backend/run.py b/backend/run.pyindex 351655da..96f424a9 100644--- a/backend/run.py+++ b/backend/run.py@@ -19,7 +19,7 @@ if __name__ == '__main__':if env == 'production':print("ERROR: Do not run the development server in production!", file=sys.stderr)print("Use a production WSGI server like gunicorn instead:", file=sys.stderr)- print(" gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 run:app", file=sys.stderr)+ print(" gunicorn -w 1 --threads 100 run:app", file=sys.stderr)sys.exit(1)# Use SocketIO to run the app (supports WebSocket) - only in developmentdiff --git a/install.sh b/install.shindex 54dc9f99..ea446374 100644--- a/install.sh+++ b/install.sh@@ -1460,7 +1460,7 @@ build_virtualenv() {elsepip install -r "$INSTALL_DIR/backend/requirements.txt" --quietfi- pip install gunicorn gevent gevent-websocket --quiet+ pip install gunicorn --quietgood "Python environment ready."}diff --git a/scripts/build-release.sh b/scripts/build-release.shindex a7025c6f..a23d89af 100644--- a/scripts/build-release.sh+++ b/scripts/build-release.sh@@ -130,7 +130,7 @@ python3 -m venv --copies "$VENV_BUILD_DIR"source "$VENV_BUILD_DIR/bin/activate"pip install --upgrade pip --quietpip install -r "$BUILD_DIR/backend/requirements.txt" --quiet-pip install gunicorn gevent gevent-websocket --quiet+pip install gunicorn --quiet# Make the venv relocatable: rewrite absolute paths in activate scripts and# shebangs so the venv works at $TARGET_VENV_PATH on the target server.diff --git a/scripts/stage-remote.sh b/scripts/stage-remote.shindex 666852aa..716ddea3 100644--- a/scripts/stage-remote.sh+++ b/scripts/stage-remote.sh@@ -368,7 +368,7 @@ sr_deploy() {( # shellcheck source=/dev/nullsource "$SR_VENV/bin/activate"pip install -q -r "$STAGE_DIR/backend/requirements.txt" \- && pip install -q gunicorn gevent gevent-websocket ) \+ && pip install -q gunicorn ) \|| sr_die "pip install failed — previous staging deploy still running."elsesr_step "Building the Python virtualenv"diff --git a/scripts/test/README.md b/scripts/test/README.mdindex 3034c681..130d3bc5 100644--- a/scripts/test/README.md+++ b/scripts/test/README.md@@ -199,8 +199,8 @@ The two modes deliberately make narrower claims than a full install:- **quick** — shell syntax plus the source-level installer/update/lib/CLI suites.- **provision** — real repositories through `install.sh`, including supported- Python, venv, pip, SSL, SQLite, ctypes, and a source build/import of the pinned- gevent dependency. Ubuntu 26.04 also installs all backend requirements and+ Python, venv, pip, SSL, SQLite, ctypes, and a source build/import of gevent (a+ heavy C build that proves the toolchain). Ubuntu 26.04 also installs all backend requirements andruns `pip check`.Neither mode proves systemd, nginx, firewall behavior, Docker-in-Docker,diff --git a/scripts/test/test_provision_python.sh b/scripts/test/test_provision_python.shindex e11f67f6..f2d6d4ee 100644--- a/scripts/test/test_provision_python.sh+++ b/scripts/test/test_provision_python.sh@@ -167,12 +167,14 @@ elsebad "it cannot create a virtualenv"fi# Force a source build: a cached/platform wheel would hide missing Python.h- # and compilers, the exact gap behind issue #148. Use the production pin.- native_requirement=$(grep '^gevent==' "$REPO_DIR/backend/requirements.txt")+ # and compilers, the exact gap behind issue #148. gevent is no longer a+ # panel dependency; it stays here as a heavy C build that proves the+ # toolchain works for whatever native dependency comes next.+ native_requirement='gevent==25.4.2'if /tmp/pp-venv/bin/python -m pip install --no-cache-dir --no-binary=gevent \"$native_requirement" >/tmp/pp-native.log 2>&1 \&& /tmp/pp-venv/bin/python -c 'import gevent' >/dev/null 2>&1; then- ok "the pinned gevent dependency builds from source and imports"+ ok "a native C dependency (gevent) builds from source and imports"elsebad "native dependency build failed"tail -40 /tmp/pp-native.logdiff --git a/scripts/update.sh b/scripts/update.shindex 29543854..67c78e6c 100644--- a/scripts/update.sh+++ b/scripts/update.sh@@ -696,7 +696,7 @@ rebuild_virtualenv() {source "$target_dir/bin/activate"pip install --upgrade pip --quietpip install -r "$target_dir/../backend/requirements.txt" --quiet- pip install gunicorn gevent gevent-websocket --quiet+ pip install gunicorn --quietgood "Virtual environment rebuilt at $target_dir"}