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
Consolidate templates into backend/templates marketplace
Juan Deniscab18a32b711
diff --git a/backend/templates/index.json b/backend/templates/index.jsonindex eff204f7..805ad331 100644--- a/backend/templates/index.json+++ b/backend/templates/index.json@@ -407,6 +407,27 @@"version": "2.9","description": "Simple, fast, privacy-focused analytics","categories": ["analytics", "privacy", "monitoring"]+ },+ {+ "id": "php-app",+ "name": "PHP Application",+ "version": "8.3",+ "description": "Custom PHP application with Apache. Supports PHP 8.0-8.3.",+ "categories": ["development", "web", "custom"]+ },+ {+ "id": "python-app",+ "name": "Python Application",+ "version": "3.12",+ "description": "Custom Python application. Supports Flask, FastAPI, Django.",+ "categories": ["development", "api", "custom"]+ },+ {+ "id": "node-app",+ "name": "Node.js Application",+ "version": "20",+ "description": "Custom Node.js application. Supports Express, Next.js.",+ "categories": ["development", "api", "custom"]}],"categories": [@@ -430,6 +451,9 @@"ssl","iot","ci-cd",- "automation"+ "automation",+ "custom",+ "web",+ "api"]}diff --git a/backend/templates/node-app.yaml b/backend/templates/node-app.yamlnew file mode 100644index 00000000..a2829c6a--- /dev/null+++ b/backend/templates/node-app.yaml@@ -0,0 +1,83 @@+id: node-app+name: Node.js Application+version: "20"+description: Custom Node.js application. Supports Node 18-21. Perfect for Express, Next.js, or any Node.js project.+icon: https://nodejs.org/static/logos/nodejsLight.svg+website: https://nodejs.org+documentation: https://nodejs.org/docs/+categories:+ - development+ - api+ - custom++variables:+ - name: HTTP_PORT+ description: HTTP port for the application+ type: port+ default: "8300"+ - name: NODE_VERSION+ description: Node.js version (18, 20, 21)+ type: string+ default: "20"+ - name: APP_PORT+ description: Internal app port+ type: string+ default: "3000"++ports:+ - port: 8300+ protocol: tcp+ description: Web interface++volumes:+ - name: app+ path: /app+ description: Application files (put your Node.js code here)++requirements:+ memory: 256MB+ storage: 1GB++compose:+ services:+ app:+ image: node:${NODE_VERSION:-20}-alpine+ container_name: ${APP_NAME}+ restart: unless-stopped+ working_dir: /app+ command: sh -c "npm install 2>/dev/null || true && npm start"+ ports:+ - "${HTTP_PORT}:${APP_PORT:-3000}"+ volumes:+ - app_data:/app+ environment:+ - NODE_ENV=production+ - PORT=${APP_PORT:-3000}++ volumes:+ app_data:++post_install: |+ Your Node.js application is ready!++ To add your code:+ docker cp ./your-files/. ${APP_NAME}:/app/++ To access shell:+ docker exec -it ${APP_NAME} sh++ To install packages:+ docker exec -it ${APP_NAME} npm install express++ Example package.json:+ {+ "name": "my-app",+ "scripts": { "start": "node index.js" },+ "dependencies": { "express": "^4.18.0" }+ }++ Example index.js:+ const express = require('express');+ const app = express();+ app.get('/', (req, res) => res.send('Hello World!'));+ app.listen(3000);diff --git a/backend/templates/php-app.yaml b/backend/templates/php-app.yamlnew file mode 100644index 00000000..7b6e7fbc--- /dev/null+++ b/backend/templates/php-app.yaml@@ -0,0 +1,63 @@+id: php-app+name: PHP Application+version: "8.3"+description: Custom PHP application with Apache. Supports PHP 8.0-8.3. Perfect for Laravel, WordPress themes, or any PHP project.+icon: https://www.php.net/images/logos/new-php-logo.svg+website: https://www.php.net+documentation: https://www.php.net/docs.php+categories:+ - development+ - web+ - custom++variables:+ - name: HTTP_PORT+ description: HTTP port for the application+ type: port+ default: "8100"+ - name: PHP_VERSION+ description: PHP version (8.0, 8.1, 8.2, 8.3)+ type: string+ default: "8.3"++ports:+ - port: 8100+ protocol: tcp+ description: Web interface++volumes:+ - name: html+ path: /var/www/html+ description: Application files (put your PHP code here)++requirements:+ memory: 256MB+ storage: 1GB++compose:+ services:+ app:+ image: php:${PHP_VERSION:-8.3}-apache+ container_name: ${APP_NAME}+ restart: unless-stopped+ ports:+ - "${HTTP_PORT}:80"+ volumes:+ - html:/var/www/html+ environment:+ - APACHE_DOCUMENT_ROOT=/var/www/html++ volumes:+ html:++post_install: |+ Your PHP application is ready!++ To add your code:+ docker cp ./your-files/. ${APP_NAME}:/var/www/html/++ To access shell:+ docker exec -it ${APP_NAME} bash++ To install extensions:+ docker exec -it ${APP_NAME} docker-php-ext-install mysqli pdo pdo_mysqldiff --git a/backend/templates/python-app.yaml b/backend/templates/python-app.yamlnew file mode 100644index 00000000..5bb23078--- /dev/null+++ b/backend/templates/python-app.yaml@@ -0,0 +1,83 @@+id: python-app+name: Python Application+version: "3.12"+description: Custom Python application. Supports Python 3.9-3.12. Perfect for Flask, FastAPI, Django, or any Python project.+icon: https://www.python.org/static/community_logos/python-logo-generic.svg+website: https://www.python.org+documentation: https://docs.python.org/3/+categories:+ - development+ - api+ - custom++variables:+ - name: HTTP_PORT+ description: HTTP port for the application+ type: port+ default: "8200"+ - name: PYTHON_VERSION+ description: Python version (3.9, 3.10, 3.11, 3.12)+ type: string+ default: "3.12"+ - name: APP_PORT+ description: Internal app port+ type: string+ default: "8000"++ports:+ - port: 8200+ protocol: tcp+ description: Web interface++volumes:+ - name: app+ path: /app+ description: Application files (put your Python code here)++requirements:+ memory: 256MB+ storage: 1GB++compose:+ services:+ app:+ image: python:${PYTHON_VERSION:-3.12}-slim+ container_name: ${APP_NAME}+ restart: unless-stopped+ working_dir: /app+ command: >+ sh -c "pip install --no-cache-dir -r requirements.txt 2>/dev/null || true &&+ python app.py"+ ports:+ - "${HTTP_PORT}:${APP_PORT:-8000}"+ volumes:+ - app_data:/app+ environment:+ - PYTHONUNBUFFERED=1+ - PORT=${APP_PORT:-8000}++ volumes:+ app_data:++post_install: |+ Your Python application is ready!++ To add your code:+ docker cp ./your-files/. ${APP_NAME}:/app/++ To access shell:+ docker exec -it ${APP_NAME} bash++ To install packages:+ docker exec -it ${APP_NAME} pip install flask++ Example app.py:+ from flask import Flask+ app = Flask(__name__)++ @app.route('/')+ def hello():+ return 'Hello World!'++ if __name__ == '__main__':+ app.run(host='0.0.0.0', port=8000)diff --git a/serverkit b/serverkitindex f7d6fb08..19dfdbc1 100644--- a/serverkit+++ b/serverkit@@ -88,7 +88,7 @@ cmd_help() {echo " restore-db Restore database from backup"echo ""echo "App Management:"- echo " create-app Create a new app (php, python, node)"+ echo " create-app Show how to create apps (via web UI)"echo " list-apps List all deployed apps"echo " start-app Start an app"echo " stop-app Stop an app"@@ -442,80 +442,24 @@ cmd_setup_proxy() {}cmd_create_app() {- check_root-- TYPE="$1"- NAME="$2"- PORT="$3"-- if [ -z "$TYPE" ] || [ -z "$NAME" ]; then- echo "Usage: serverkit create-app <type> <name> [port]"- echo ""- echo "Types:"- echo " php PHP 8.x application (nginx + php-fpm)"- echo " python Python application (Flask/FastAPI/Django)"- echo " node Node.js application (Express/Next.js)"- echo ""- echo "Examples:"- echo " serverkit create-app php myblog"- echo " serverkit create-app python myapi 8200"- echo " serverkit create-app node myapp 8300"- exit 1- fi-- TEMPLATE_DIR="$INSTALL_DIR/templates/$TYPE"- APP_DIR="/var/www/$NAME"-- if [ ! -d "$TEMPLATE_DIR" ]; then- print_error "Unknown app type: $TYPE"- echo "Available: php, python, node"- exit 1- fi-- if [ -d "$APP_DIR" ]; then- print_warning "Directory already exists: $APP_DIR"- read -p "Overwrite? (y/N) " -n 1 -r- echo- if [[ ! $REPLY =~ ^[Yy]$ ]]; then- exit 0- fi- rm -rf "$APP_DIR"- fi-- # Determine default port based on type- if [ -z "$PORT" ]; then- case "$TYPE" in- php) PORT=8100 ;;- python) PORT=8200 ;;- node) PORT=8300 ;;- esac- # Find next available port- while ss -tlnp | grep -q ":$PORT "; do- PORT=$((PORT + 1))- done- fi-- print_info "Creating $TYPE app: $NAME on port $PORT..."-- # Copy template- mkdir -p /var/www- cp -r "$TEMPLATE_DIR" "$APP_DIR"-- # Create .env from example- if [ -f "$APP_DIR/.env.example" ]; then- cp "$APP_DIR/.env.example" "$APP_DIR/.env"- sed -i "s/APP_NAME=.*/APP_NAME=$NAME/g" "$APP_DIR/.env"- sed -i "s/PORT=.*/PORT=$PORT/g" "$APP_DIR/.env"- fi-- print_success "App created at $APP_DIR"+ print_header+ echo ""+ echo "To create a new app, use the ServerKit web interface:"+ echo ""+ echo " 1. Open ServerKit in your browser"+ echo " 2. Go to Templates in the sidebar"+ echo " 3. Choose from 60+ available templates:"+ echo " - PHP Application (custom PHP projects)"+ echo " - Python Application (Flask, FastAPI, Django)"+ echo " - Node.js Application (Express, Next.js)"+ echo " - WordPress, Ghost, Nextcloud, and many more"+ echo " 4. Click Install and configure your app"echo ""- echo "Next steps:"- echo " 1. cd $APP_DIR"- echo " 2. Edit .env and customize settings"- echo " 3. Put your code in src/"- echo " 4. docker compose up -d"- echo " 5. sudo serverkit add-site your-domain.com $PORT"+ echo "The web interface provides:"+ echo " ✓ One-click installation"+ echo " ✓ Automatic port assignment"+ echo " ✓ Configuration UI"+ echo " ✓ Update management"echo ""}@@ -551,7 +495,7 @@ cmd_list_apps() {echo " No apps found in /var/www/"fiecho ""- echo "Create new app: sudo serverkit create-app <type> <name>"+ echo "Install new apps via the Templates page in the ServerKit web interface."echo ""}diff --git a/templates/node/.env.example b/templates/node/.env.exampledeleted file mode 100644index 99317b86..00000000--- a/templates/node/.env.example+++ /dev/null@@ -1,14 +0,0 @@-# Node.js App Configuration-APP_NAME=my-node-app-PORT=8300-APP_PORT=3000--# Node Version: 18, 20, 21-NODE_VERSION=20--# Environment-NODE_ENV=production--# Database (if using MongoDB)-# DB_USER=root-# DB_PASSWORD=secure-passworddiff --git a/templates/node/docker-compose.yml b/templates/node/docker-compose.ymldeleted file mode 100644index a1cae120..00000000--- a/templates/node/docker-compose.yml+++ /dev/null@@ -1,49 +0,0 @@-# Node.js Application Template-# Copy this folder to /var/www/your-app-name and customize-#-# Usage:-# 1. Copy: sudo serverkit create-app node myapp-# 2. Put your Node.js files in ./src/-# 3. Start: docker compose up -d-# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>--services:- app:- image: node:${NODE_VERSION:-20}-alpine- container_name: ${APP_NAME:-node-app}- restart: unless-stopped- working_dir: /app- command: sh -c "npm install && npm start"- ports:- - "${PORT:-8300}:${APP_PORT:-3000}"- volumes:- - ./src:/app- - node_modules:/app/node_modules- environment:- - NODE_ENV=${NODE_ENV:-production}- - PORT=${APP_PORT:-3000}- networks:- - app-network-- # Optional: MongoDB (uncomment if needed)- # db:- # image: mongo:7- # container_name: ${APP_NAME:-node-app}-db- # restart: unless-stopped- # environment:- # MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-root}- # MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD:-secret}- # volumes:- # - db-data:/data/db- # networks:- # - app-network--networks:- app-network:- driver: bridge--volumes:- node_modules:--# volumes:-# db-data:diff --git a/templates/node/src/index.js b/templates/node/src/index.jsdeleted file mode 100644index 2896ac70..00000000--- a/templates/node/src/index.js+++ /dev/null@@ -1,72 +0,0 @@-/**- * Sample Node.js Express Application- * Replace this with your actual application code- */--const express = require('express');-const app = express();-const port = process.env.PORT || 3000;--app.get('/', (req, res) => {- res.send(`- <!DOCTYPE html>- <html lang="en">- <head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Node.js App</title>- <style>- body {- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;- max-width: 800px;- margin: 50px auto;- padding: 20px;- background: #f5f5f5;- }- .card {- background: white;- padding: 30px;- border-radius: 8px;- box-shadow: 0 2px 4px rgba(0,0,0,0.1);- }- h1 { color: #333; margin-bottom: 10px; }- .version { color: #777; font-size: 14px; }- .info { margin-top: 20px; padding: 15px; background: #fff3e0; border-radius: 4px; }- a { color: #ff9800; }- </style>- </head>- <body>- <div class="card">- <h1>Node.js App</h1>- <p class="version">Node ${process.version} | Express</p>-- <div class="info">- <strong>Your Node.js app is running!</strong>- <p>Edit <code>src/index.js</code> to customize.</p>- <p><a href="/health">Health Check</a> | <a href="/info">System Info</a></p>- </div>- </div>- </body>- </html>- `);-});--app.get('/health', (req, res) => {- res.json({- status: 'healthy',- node_version: process.version- });-});--app.get('/info', (req, res) => {- res.json({- node_version: process.version,- platform: process.platform,- uptime: process.uptime(),- memory: process.memoryUsage()- });-});--app.listen(port, '0.0.0.0', () => {- console.log(`Server running on port ${port}`);-});diff --git a/templates/node/src/package.json b/templates/node/src/package.jsondeleted file mode 100644index 631525f1..00000000--- a/templates/node/src/package.json+++ /dev/null@@ -1,13 +0,0 @@-{- "name": "my-node-app",- "version": "1.0.0",- "description": "Node.js Application",- "main": "index.js",- "scripts": {- "start": "node index.js",- "dev": "node --watch index.js"- },- "dependencies": {- "express": "^4.18.2"- }-}diff --git a/templates/php/.env.example b/templates/php/.env.exampledeleted file mode 100644index e7f45018..00000000--- a/templates/php/.env.example+++ /dev/null@@ -1,13 +0,0 @@-# PHP App Configuration-APP_NAME=my-php-app-PORT=8100--# PHP Version: 8.0, 8.1, 8.2, 8.3-PHP_VERSION=8.2-PHP_MEMORY_LIMIT=256M--# Database (if using MySQL)-# DB_ROOT_PASSWORD=secure-root-password-# DB_NAME=myapp-# DB_USER=myapp-# DB_PASSWORD=secure-passworddiff --git a/templates/php/README.md b/templates/php/README.mddeleted file mode 100644index ff72c9c0..00000000--- a/templates/php/README.md+++ /dev/null@@ -1,98 +0,0 @@-# PHP Application Template--A Docker-based PHP application setup with nginx and optional MySQL.--## Quick Start--```bash-# Copy .env.example to .env and customize-cp .env.example .env--# Edit your settings-nano .env--# Start the app-docker compose up -d--# View logs-docker compose logs -f-```--## Configuration--Edit `.env` to customize:--| Variable | Description | Default |-|----------|-------------|---------|-| `APP_NAME` | Container name prefix | `my-php-app` |-| `PORT` | External port | `8100` |-| `PHP_VERSION` | PHP version (8.0, 8.1, 8.2, 8.3) | `8.2` |-| `PHP_MEMORY_LIMIT` | Memory limit | `256M` |--## Structure--```-.-├── docker-compose.yml # Docker configuration-├── nginx.conf # Nginx configuration-├── php.ini # PHP configuration-├── .env # Environment variables-└── src/ # Your PHP code goes here- └── index.php-```--## Adding Extensions--To add PHP extensions, create a `Dockerfile`:--```dockerfile-FROM php:8.2-fpm--# Install common extensions-RUN docker-php-ext-install pdo pdo_mysql mysqli--# Install composer-COPY --from=composer:latest /usr/bin/composer /usr/bin/composer-```--Then update `docker-compose.yml`:--```yaml-services:- app:- build: .- # ... rest of config-```--## Using with Database--1. Uncomment the `db` service in `docker-compose.yml`-2. Set database credentials in `.env`-3. Connect from PHP using host `db`--```php-$pdo = new PDO(- 'mysql:host=db;dbname=' . getenv('DB_NAME'),- getenv('DB_USER'),- getenv('DB_PASSWORD')-);-```--## Commands--```bash-# Start-docker compose up -d--# Stop-docker compose down--# View logs-docker compose logs -f app--# Shell into PHP container-docker compose exec app bash--# Run composer-docker compose exec app composer install-```diff --git a/templates/php/docker-compose.yml b/templates/php/docker-compose.ymldeleted file mode 100644index ca173f4f..00000000--- a/templates/php/docker-compose.yml+++ /dev/null@@ -1,57 +0,0 @@-# PHP Application Template-# Copy this folder to /var/www/your-app-name and customize-#-# Usage:-# 1. Copy: sudo serverkit create-app php myapp-# 2. Put your PHP files in ./src/-# 3. Start: docker compose up -d-# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>--services:- app:- image: php:${PHP_VERSION:-8.2}-fpm- container_name: ${APP_NAME:-php-app}- restart: unless-stopped- volumes:- - ./src:/var/www/html- - ./php.ini:/usr/local/etc/php/conf.d/custom.ini:ro- environment:- - PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}- networks:- - app-network-- nginx:- image: nginx:alpine- container_name: ${APP_NAME:-php-app}-nginx- restart: unless-stopped- ports:- - "${PORT:-8100}:80"- volumes:- - ./src:/var/www/html:ro- - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro- depends_on:- - app- networks:- - app-network-- # Optional: Database (uncomment if needed)- # db:- # image: mysql:8.0- # container_name: ${APP_NAME:-php-app}-db- # restart: unless-stopped- # environment:- # MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-secret}- # MYSQL_DATABASE: ${DB_NAME:-app}- # MYSQL_USER: ${DB_USER:-app}- # MYSQL_PASSWORD: ${DB_PASSWORD:-secret}- # volumes:- # - db-data:/var/lib/mysql- # networks:- # - app-network--networks:- app-network:- driver: bridge--# volumes:-# db-data:diff --git a/templates/php/nginx.conf b/templates/php/nginx.confdeleted file mode 100644index 9c9005a0..00000000--- a/templates/php/nginx.conf+++ /dev/null@@ -1,32 +0,0 @@-server {- listen 80;- server_name localhost;- root /var/www/html;- index index.php index.html;-- # Security headers- add_header X-Frame-Options "SAMEORIGIN" always;- add_header X-Content-Type-Options "nosniff" always;-- location / {- try_files $uri $uri/ /index.php?$query_string;- }-- location ~ \.php$ {- fastcgi_pass app:9000;- fastcgi_index index.php;- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;- include fastcgi_params;- fastcgi_read_timeout 300;- }-- location ~ /\.ht {- deny all;- }-- # Cache static assets- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {- expires 1y;- add_header Cache-Control "public, immutable";- }-}diff --git a/templates/php/php.ini b/templates/php/php.inideleted file mode 100644index 1d5b7b66..00000000--- a/templates/php/php.ini+++ /dev/null@@ -1,10 +0,0 @@-; Custom PHP Configuration-memory_limit = 256M-upload_max_filesize = 64M-post_max_size = 64M-max_execution_time = 300-max_input_time = 300-display_errors = Off-log_errors = On-error_log = /var/log/php_errors.log-date.timezone = UTCdiff --git a/templates/php/src/index.php b/templates/php/src/index.phpdeleted file mode 100644index 122f9c40..00000000--- a/templates/php/src/index.php+++ /dev/null@@ -1,48 +0,0 @@-<?php-/**- * Sample PHP Application- * Replace this with your actual application code- */--$appName = getenv('APP_NAME') ?: 'PHP App';-$phpVersion = phpversion();-?>-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title><?= htmlspecialchars($appName) ?></title>- <style>- body {- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;- max-width: 800px;- margin: 50px auto;- padding: 20px;- background: #f5f5f5;- }- .card {- background: white;- padding: 30px;- border-radius: 8px;- box-shadow: 0 2px 4px rgba(0,0,0,0.1);- }- h1 { color: #333; margin-bottom: 10px; }- .version { color: #777; font-size: 14px; }- .info { margin-top: 20px; padding: 15px; background: #e8f5e9; border-radius: 4px; }- a { color: #4CAF50; }- </style>-</head>-<body>- <div class="card">- <h1><?= htmlspecialchars($appName) ?></h1>- <p class="version">PHP <?= $phpVersion ?></p>-- <div class="info">- <strong>Your PHP app is running!</strong>- <p>Put your PHP files in the <code>src/</code> directory.</p>- <p><a href="info.php">View PHP Info</a></p>- </div>- </div>-</body>-</html>diff --git a/templates/php/src/info.php b/templates/php/src/info.phpdeleted file mode 100644index 4d9179a3..00000000--- a/templates/php/src/info.php+++ /dev/null@@ -1,3 +0,0 @@-<?php-// PHP Info Page - Remove in production!-phpinfo();diff --git a/templates/python/.env.example b/templates/python/.env.exampledeleted file mode 100644index c0a2c28f..00000000--- a/templates/python/.env.example+++ /dev/null@@ -1,15 +0,0 @@-# Python App Configuration-APP_NAME=my-python-app-PORT=8200-APP_PORT=8000--# Python Version: 3.9, 3.10, 3.11, 3.12-PYTHON_VERSION=3.12--# Entry point (relative to src/)-ENTRYPOINT=app.py--# Database (if using PostgreSQL)-# DB_NAME=myapp-# DB_USER=myapp-# DB_PASSWORD=secure-passworddiff --git a/templates/python/README.md b/templates/python/README.mddeleted file mode 100644index 6262e03f..00000000--- a/templates/python/README.md+++ /dev/null@@ -1,131 +0,0 @@-# Python Application Template--A Docker-based Python application setup with optional PostgreSQL and Redis.--## Quick Start--```bash-# Copy .env.example to .env and customize-cp .env.example .env--# Edit your settings-nano .env--# Start the app-docker compose up -d--# View logs-docker compose logs -f-```--## Configuration--Edit `.env` to customize:--| Variable | Description | Default |-|----------|-------------|---------|-| `APP_NAME` | Container name prefix | `my-python-app` |-| `PORT` | External port | `8200` |-| `APP_PORT` | Internal app port | `8000` |-| `PYTHON_VERSION` | Python version (3.9-3.12) | `3.12` |-| `ENTRYPOINT` | Main Python file | `app.py` |--## Structure--```-.-├── docker-compose.yml # Docker configuration-├── .env # Environment variables-└── src/ # Your Python code- ├── app.py # Main application- └── requirements.txt-```--## Using Different Frameworks--### Flask (default)-```python-from flask import Flask-app = Flask(__name__)-[email protected]('/')-def home():- return 'Hello World'--if __name__ == '__main__':- app.run(host='0.0.0.0', port=8000)-```--### FastAPI-Update `requirements.txt`:-```-fastapi>=0.109.0-uvicorn>=0.27.0-```--Update `.env`:-```-ENTRYPOINT=main.py-```--Create `src/main.py`:-```python-from fastapi import FastAPI-import uvicorn--app = FastAPI()-[email protected]('/')-def home():- return {'message': 'Hello World'}--if __name__ == '__main__':- uvicorn.run(app, host='0.0.0.0', port=8000)-```--### Django-Update `docker-compose.yml` command:-```yaml-command: >- sh -c "pip install -r requirements.txt &&- python manage.py runserver 0.0.0.0:8000"-```--## Using with Database--1. Uncomment the `db` service in `docker-compose.yml`-2. Set database credentials in `.env`-3. Connect from Python using host `db`--```python-import psycopg2--conn = psycopg2.connect(- host='db',- database=os.environ['DB_NAME'],- user=os.environ['DB_USER'],- password=os.environ['DB_PASSWORD']-)-```--## Commands--```bash-# Start-docker compose up -d--# Stop-docker compose down--# View logs-docker compose logs -f app--# Shell into container-docker compose exec app bash--# Install new package-docker compose exec app pip install package-name--# Run Python command-docker compose exec app python -c "print('hello')"-```diff --git a/templates/python/docker-compose.yml b/templates/python/docker-compose.ymldeleted file mode 100644index 56ad2809..00000000--- a/templates/python/docker-compose.yml+++ /dev/null@@ -1,57 +0,0 @@-# Python Application Template-# Copy this folder to /var/www/your-app-name and customize-#-# Usage:-# 1. Copy: sudo serverkit create-app python myapp-# 2. Put your Python files in ./src/-# 3. Start: docker compose up -d-# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>--services:- app:- image: python:${PYTHON_VERSION:-3.12}-slim- container_name: ${APP_NAME:-python-app}- restart: unless-stopped- working_dir: /app- command: >- sh -c "pip install --no-cache-dir -r requirements.txt 2>/dev/null || true &&- python ${ENTRYPOINT:-app.py}"- ports:- - "${PORT:-8200}:${APP_PORT:-8000}"- volumes:- - ./src:/app- environment:- - PYTHONUNBUFFERED=1- - PYTHONDONTWRITEBYTECODE=1- - PORT=${APP_PORT:-8000}- networks:- - app-network-- # Optional: Database (uncomment if needed)- # db:- # image: postgres:15- # container_name: ${APP_NAME:-python-app}-db- # restart: unless-stopped- # environment:- # POSTGRES_DB: ${DB_NAME:-app}- # POSTGRES_USER: ${DB_USER:-app}- # POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}- # volumes:- # - db-data:/var/lib/postgresql/data- # networks:- # - app-network-- # Optional: Redis (uncomment if needed)- # redis:- # image: redis:alpine- # container_name: ${APP_NAME:-python-app}-redis- # restart: unless-stopped- # networks:- # - app-network--networks:- app-network:- driver: bridge--# volumes:-# db-data:diff --git a/templates/python/src/app.py b/templates/python/src/app.pydeleted file mode 100644index b96f1dd0..00000000--- a/templates/python/src/app.py+++ /dev/null@@ -1,73 +0,0 @@-"""-Sample Python Flask Application-Replace this with your actual application code-"""--import os-import sys-from flask import Flask, jsonify--app = Flask(__name__)-[email protected]('/')-def home():- return f'''- <!DOCTYPE html>- <html lang="en">- <head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Python App</title>- <style>- body {{- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;- max-width: 800px;- margin: 50px auto;- padding: 20px;- background: #f5f5f5;- }}- .card {{- background: white;- padding: 30px;- border-radius: 8px;- box-shadow: 0 2px 4px rgba(0,0,0,0.1);- }}- h1 {{ color: #333; margin-bottom: 10px; }}- .version {{ color: #777; font-size: 14px; }}- .info {{ margin-top: 20px; padding: 15px; background: #e3f2fd; border-radius: 4px; }}- a {{ color: #2196F3; }}- </style>- </head>- <body>- <div class="card">- <h1>Python App</h1>- <p class="version">Python {sys.version.split()[0]} | Flask {Flask.__version__ if hasattr(Flask, '__version__') else 'N/A'}</p>-- <div class="info">- <strong>Your Python app is running!</strong>- <p>Edit <code>src/app.py</code> to customize.</p>- <p><a href="/health">Health Check</a> | <a href="/info">System Info</a></p>- </div>- </div>- </body>- </html>- '''-[email protected]('/health')-def health():- return jsonify({- 'status': 'healthy',- 'python_version': sys.version.split()[0]- })-[email protected]('/info')-def info():- return jsonify({- 'python_version': sys.version,- 'platform': sys.platform,- 'environment': dict(os.environ)- })--if __name__ == '__main__':- port = int(os.environ.get('PORT', 8000))- app.run(host='0.0.0.0', port=port, debug=False)diff --git a/templates/python/src/requirements.txt b/templates/python/src/requirements.txtdeleted file mode 100644index d19918b0..00000000--- a/templates/python/src/requirements.txt+++ /dev/null@@ -1,15 +0,0 @@-# Python Dependencies-# Add your dependencies here--# Web frameworks (uncomment one)-flask>=3.0.0-# fastapi>=0.109.0-# uvicorn>=0.27.0-# django>=5.0--# Common utilities-# requests>=2.31.0-# python-dotenv>=1.0.0-# sqlalchemy>=2.0.0-# psycopg2-binary>=2.9.9-# redis>=5.0.0