1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

добавление редисаъ2

This commit is contained in:
MoonTestUse1
2025-01-03 16:40:41 +06:00
parent 9b1af9f069
commit 8ffa6c2540
4 changed files with 29 additions and 59 deletions

View File

@@ -1,11 +1,16 @@
fastapi>=0.68.0,<0.69.0
uvicorn>=0.15.0,<0.16.0
sqlalchemy>=1.4.23,<1.5.0
pydantic>=1.8.0,<2.0.0
python-jose[cryptography]>=3.3.0,<4.0.0
passlib[bcrypt]>=1.7.4,<2.0.0
python-multipart>=0.0.5,<0.0.6
redis>=4.0.0,<5.0.0
python-dotenv>=0.19.0,<0.20.0
psycopg2-binary>=2.9.1,<3.0.0
requests>=2.26.0,<3.0.0
fastapi==0.110.0
uvicorn==0.27.1
sqlalchemy==2.0.27
pydantic==2.6.3
pydantic-settings==2.2.1
python-multipart==0.0.9
python-jose[cryptography]==3.3.0
passlib[bcrypt]>=1.7.4
bcrypt>=4.0.1
redis>=4.0.0
python-dotenv==1.0.1
psycopg2-binary==2.9.9
alembic==1.13.1
pytest==8.0.0
httpx==0.26.0
requests>=2.26.0

View File

@@ -8,10 +8,8 @@ services:
dockerfile: docker/frontend/Dockerfile
ports:
- "80:80"
- "443:443"
volumes:
- ./certbot/www:/var/www/certbot/:ro
- ./certbot/conf/:/etc/letsencrypt/:ro
- ./frontend:/app
depends_on:
- backend
@@ -42,8 +40,6 @@ services:
redis:
container_name: support-redis
image: redis:alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data

View File

@@ -2,29 +2,23 @@ FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Create logs directory
RUN mkdir -p /app/logs
# Copy requirements first to leverage Docker cache
# Устанавливаем зависимости
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
# Копируем код приложения
COPY backend/ .
# Make entrypoint script executable
COPY docker/backend/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Создаем entrypoint скрипт
RUN echo '#!/bin/sh\n\
echo "Waiting for database..."\n\
sleep 5\n\
echo "Running database migrations..."\n\
alembic upgrade head\n\
echo "Starting application..."\n\
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload' > /entrypoint.sh \
&& chmod +x /entrypoint.sh
# Create volume for logs
VOLUME ["/app/logs"]
# Expose the port the app runs on
EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/entrypoint.sh"]

View File

@@ -1,31 +1,6 @@
server {
listen 80;
server_name itformhelp.ru;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name itformhelp.ru;
ssl_certificate /etc/letsencrypt/live/itformhelp.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/itformhelp.ru/privkey.pem;
# Улучшенные настройки SSL
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
# Настройки CORS
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
location / {
root /usr/share/nginx/html;