From 1852b9d321afa669210b30200186eb3f2d8b93f8 Mon Sep 17 00:00:00 2001 From: "Ehsan.Asadi" Date: Wed, 31 Dec 2025 11:23:59 +0330 Subject: [PATCH] added cmd --- .dockerignore | 152 +++++++++++++++++++++++++ .gitignore | 1 - docker/Dockerfile | 4 +- helm/peikarband/values-production.yaml | 47 ++------ 4 files changed, 166 insertions(+), 38 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c9d4115 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,152 @@ +# Peikarband Platform - Docker Ignore File +# Optimize Docker build by excluding unnecessary files + +# Git +.git +.gitignore +.gitattributes + +# CI/CD +.github/ +.gitlab-ci.yml +woodpecker.yml +.drone.yml + +# IDE & Editors +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +*.egg-info/ +dist/ +build/ +*.egg +.pytest_cache/ +.mypy_cache/ +.coverage +htmlcov/ +.tox/ +.hypothesis/ +*.cover + +# Virtual Environment +venv/ +env/ +ENV/ +virtualenv/ + +# Database +*.db +*.sqlite +*.sqlite3 +reflex.db +*.dump +*.sql + +# Logs +*.log +logs/ +*.out +*.err + +# Environment & Secrets +.env +.env.* +!.env.example +*.pem +*.key +*.crt +secrets/ +*.secret + +# Documentation (exclude from container, keep only essential) +peikarband/docs/ +*.md +!README.md +LICENSE + +# Tests (exclude from production image) +peikarband/tests/ +peikarband/config/pytest.ini +.pytest_cache/ +coverage/ +*.coverage + +# Development +Makefile +docker-compose.yml +docker-compose.*.yml + +# Kubernetes & Helm (exclude from container) +helm/ +docker/docker-compose.yml +*.yaml +*.yml +!requirements.txt +!peikarband/**/*.yaml +!peikarband/**/*.yml + +# Backup & Temp Files +*.bak +*.tmp +*.temp +tmp/ +temp/ +.cache/ + +# Media & Assets (exclude large files but keep necessary ones) +# Exclude root level media files +/wordpress.gif +/banner-3.gif + +# Keep assets directory (now in peikarband/) +!peikarband/assets/ + +# Node modules (Reflex might need some) +node_modules/ +npm-debug.log +yarn-error.log +package-lock.json +yarn.lock + +# OS Files +Thumbs.db +.DS_Store +Desktop.ini + +# Editor Configs +.editorconfig +.prettierrc +.eslintrc + +# Pre-commit & Linters +.pre-commit-config.yaml +.flake8 +.pylintrc +mypy.ini +.isort.cfg + +# Scripts (keep only necessary ones) +peikarband/tools/scripts/* +!peikarband/tools/scripts/update-env-json.sh +*.sh +!entrypoint.sh + +# Jupyter Notebooks +*.ipynb +.ipynb_checkpoints/ + +# Misc +TODO.md +CHANGELOG.md +CONTRIBUTING.md +.mailmap diff --git a/.gitignore b/.gitignore index 03f8355..58aca6d 100644 --- a/.gitignore +++ b/.gitignore @@ -65,7 +65,6 @@ temp/ *.tmp # Docker -.dockerignore # Kubernetes secrets *secret*.yaml diff --git a/docker/Dockerfile b/docker/Dockerfile index ed1feeb..998040b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -128,7 +128,7 @@ COPY --from=builder --chown=peikarband:peikarband /build/peikarband /app/peikarb # Copy entrypoint script COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod +x /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh && chmod +x /app/peikarband/.web/app/routes.js # Create necessary directories RUN mkdir -p /app/data /app/logs /app/uploaded_files @@ -190,7 +190,7 @@ ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"] # Start application # entrypoint.sh will cd to /app/peikarband and run reflex # PYTHONPATH=/app:/app/peikarband allows Python to find both peikarband and peikarband.peikarband -# CMD ["run", "--env", "prod", "--loglevel", "info", "--frontend-port", "3000", "--backend-port", "8000"] +CMD ["run", "--env", "prod", "--loglevel", "info", "--frontend-port", "3000", "--backend-port", "8000"] # ============================================ # Build Information diff --git a/helm/peikarband/values-production.yaml b/helm/peikarband/values-production.yaml index daffd35..c6c65cb 100644 --- a/helm/peikarband/values-production.yaml +++ b/helm/peikarband/values-production.yaml @@ -5,7 +5,6 @@ replicaCount: 1 image: pullPolicy: Always - tag: "latest" # Auto-create registry secret registrySecret: @@ -18,11 +17,6 @@ registrySecret: imagePullSecrets: - name: hub-registry-secret - -# DEBUG MODE: sleep infinity for debugging -# NOTE: Use exec probes that always succeed when debugging -command: ["/bin/bash", "-c", "sleep infinity"] - appSecrets: enabled: false # Set to true if you need database/redis name: peikarband-prod-secrets @@ -117,41 +111,24 @@ redis: key: "redis-password" # Override readiness probe for production -# DEBUG MODE: Using exec probe that always succeeds (for sleep infinity) -# IMPORTANT: httpGet must be explicitly null to prevent merge with values.yaml -# To switch back to normal operation, replace exec with httpGet and remove null: -# httpGet: -# path: /ping -# port: 8000 -# initialDelaySeconds: 60 -# periodSeconds: 10 -# timeoutSeconds: 5 -# failureThreshold: 6 +# Reflex startup time: 30-60 seconds (per deployment checklist) +# Using /ping endpoint (simpler, faster response) readinessProbe: - httpGet: null # Explicitly null to prevent merge - exec: - command: ["/bin/sh", "-c", "true"] - initialDelaySeconds: 5 + httpGet: + path: /ping + port: 8000 + initialDelaySeconds: 60 # Allow Reflex to fully start (30-60s expected) periodSeconds: 10 timeoutSeconds: 5 - failureThreshold: 3 + failureThreshold: 6 # Allow 6 failures = 60s grace period # Override liveness probe -# DEBUG MODE: Using exec probe that always succeeds (for sleep infinity) -# IMPORTANT: httpGet must be explicitly null to prevent merge with values.yaml -# To switch back to normal operation, replace exec with httpGet and remove null: -# httpGet: -# path: /live -# port: 8000 -# initialDelaySeconds: 90 -# periodSeconds: 15 -# timeoutSeconds: 5 -# failureThreshold: 3 +# Using /live endpoint which is specifically designed for liveness checks livenessProbe: - httpGet: null # Explicitly null to prevent merge - exec: - command: ["/bin/sh", "-c", "true"] - initialDelaySeconds: 5 + httpGet: + path: /live + port: 8000 + initialDelaySeconds: 90 # More time for liveness (after readiness) periodSeconds: 15 timeoutSeconds: 5 failureThreshold: 3