This commit is contained in:
user committed 2025-07-11 06:46:33 +03:00
1 parent 373c832e71
commit 1b0dfdafbc
48 files changed
+3114 -396

No files matched your search

+9 -41
View File
@@ -1,5 +1,5 @@
# Simple Dockerfile using requirements.txt instead of Poetry
FROM python:3.11-slim as base
# Simplified Dockerfile using requirements.txt
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
@@ -11,64 +11,32 @@ ENV PYTHONUNBUFFERED=1 \
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
ffmpeg \
libmagic1 \
libpq-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt ./requirements.txt
# Development stage
FROM base as development
# Install dependencies
RUN pip install -r requirements.txt
# Copy source code
COPY . .
# Set development environment
ENV PYTHONPATH=/app
ENV DEBUG=true
# Expose ports
EXPOSE 15100 9090
# Default command for development
CMD ["python", "start_my_network.py"]
# Production stage
FROM base as production
# Install dependencies
RUN pip install -r requirements.txt
# Create non-root user
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Copy requirements and install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=appuser:appuser . .
COPY . .
# Create necessary directories
RUN mkdir -p /app/data /app/logs && \
chown -R appuser:appuser /app/data /app/logs
RUN mkdir -p /app/data /app/logs
# Set production environment
# Set environment
ENV PYTHONPATH=/app
ENV DEBUG=false
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:15100/health || exit 1
# Switch to non-root user
USER appuser
# Expose ports
EXPOSE 15100 9090
+2 -2
View File
@@ -88,7 +88,7 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_INITDB_ARGS=--auth-host=md5
ports:
- "127.0.0.1:5432:5432"
- "127.0.0.1:5434:5432"
networks:
- uploader_network
healthcheck:
@@ -107,7 +107,7 @@ services:
- ./redis.conf:/usr/local/etc/redis/redis.conf:ro
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "127.0.0.1:6379:6379"
- "127.0.0.1:6380:6379"
networks:
- uploader_network
healthcheck:
+134
View File
@@ -0,0 +1,134 @@
version: '3.8'
services:
postgres:
image: postgres:15-alpine
container_name: my-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-my_network}
POSTGRES_USER: ${POSTGRES_USER:-my_network_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mynetwork_secure_pass_2024}
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5434:5432"
networks:
- my_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-my_network_user} -d ${POSTGRES_DB:-my_network}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
redis:
image: redis:7-alpine
container_name: my-redis
restart: unless-stopped
command: >
redis-server
--appendonly yes
--maxmemory 512mb
--maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
ports:
- "6380:6379"
networks:
- my_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
app:
build:
context: ..
dockerfile: deployment/Dockerfile.simple
container_name: my-uploader-app
command: python start_my_network.py
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
# Database with correct asyncpg driver
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-my_network_user}:${POSTGRES_PASSWORD:-mynetwork_secure_pass_2024}@postgres:5432/${POSTGRES_DB:-my_network}
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-my_network}
POSTGRES_USER: ${POSTGRES_USER:-my_network_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mynetwork_secure_pass_2024}
# Redis
REDIS_URL: redis://redis:6379/0
REDIS_HOST: redis
REDIS_PORT: 6379
# Application
DEBUG: ${DEBUG:-true}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
SECRET_KEY: ${SECRET_KEY:-my_network_secret_key_super_secure_2024_production}
JWT_SECRET: ${JWT_SECRET_KEY:-jwt_secret_key_for_my_network_tokens_2024}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-encryption_key_for_my_network_data_security_2024}
# MY Network
MY_NETWORK_NODE_ID: ${MY_NETWORK_NODE_ID:-node_001_local_dev}
MY_NETWORK_PORT: ${MY_NETWORK_PORT:-15100}
MY_NETWORK_HOST: ${MY_NETWORK_HOST:-0.0.0.0}
MY_NETWORK_DOMAIN: ${MY_NETWORK_DOMAIN:-localhost:15100}
# Telegram (dummy values)
TELEGRAM_API_KEY: ${TELEGRAM_API_KEY:-1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk}
CLIENT_TELEGRAM_API_KEY: ${CLIENT_TELEGRAM_API_KEY:-1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk}
ports:
- "15100:15100"
volumes:
- app_data:/app/data
- app_logs:/app/logs
networks:
- my_network
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:15100/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
grafana:
image: grafana/grafana:latest
container_name: my-grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin_grafana_pass_2024}
GF_USERS_ALLOW_SIGN_UP: false
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3001:3000"
networks:
- my_network
volumes:
postgres_data:
driver: local
redis_data:
driver: local
app_data:
driver: local
app_logs:
driver: local
grafana_data:
driver: local
networks:
my_network:
external: true
name: deployment_uploader_network
+11 -11
View File
@@ -54,10 +54,10 @@ services:
# Main Application (MY Uploader Bot)
app:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: deployment/Dockerfile.simple
container_name: uploader-bot-app
command: python -m app
command: python start_my_network.py
restart: unless-stopped
depends_on:
postgres:
@@ -126,8 +126,8 @@ services:
# Indexer Service
indexer:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: deployment/Dockerfile
container_name: uploader-bot-indexer
restart: unless-stopped
command: python -m app indexer
@@ -150,8 +150,8 @@ services:
# TON Daemon Service
ton_daemon:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: deployment/Dockerfile
container_name: uploader-bot-ton-daemon
command: python -m app ton_daemon
restart: unless-stopped
@@ -174,8 +174,8 @@ services:
# License Index Service
license_index:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: deployment/Dockerfile
container_name: uploader-bot-license-index
command: python -m app license_index
restart: unless-stopped
@@ -198,8 +198,8 @@ services:
# Convert Process Service
convert_process:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: deployment/Dockerfile
container_name: uploader-bot-convert-process
command: python -m app convert_process
restart: unless-stopped