-
Notifications
You must be signed in to change notification settings - Fork 1
feat/staging prepare #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
cd5e05f
77c3cf4
11a4e90
cdb1119
2ca88d5
f235117
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .git | ||
| .github | ||
| .vscode | ||
| .venv | ||
| .uv-cache | ||
| .mypy_cache | ||
| .ruff_cache | ||
| .pytest_cache | ||
| __pycache__ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
| *.db | ||
| *.sqlite3 | ||
| .env | ||
| db/schema.sql |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # =REDACTED | ||
| # PostgreSQL | ||
| # =REDACTED | ||
| POSTGRES_USER=REDACTED | ||
| POSTGRES_PASSWORD=REDACTED | ||
| POSTGRES_DB=REDACTED | ||
| POSTGRES_PORT=REDACTED | ||
| POSTGRES_HOST=REDACTED | ||
|
|
||
| # =REDACTED | ||
| # NATS | ||
| # =REDACTED | ||
| NATS_PORT=REDACTED | ||
| NATS_MONITOR_PORT=REDACTED | ||
| NATS_HOST=REDACTED | ||
| NATS_USER=REDACTED | ||
| NATS_PASSWORD=REDACTED | ||
|
|
||
| # =REDACTED | ||
| # MinIO | ||
| # =REDACTED | ||
| MINIO_ROOT_USER=REDACTED | ||
| MINIO_ROOT_PASSWORD=REDACTED | ||
| MINIO_API_PORT=REDACTED | ||
| MINIO_CONSOLE_PORT=REDACTED | ||
| MINIO_HOST=REDACTED | ||
|
|
||
| # =REDACTED | ||
| # Redis | ||
| # =REDACTED | ||
| REDIS_PORT=REDACTED | ||
| REDIS_HOST=REDACTED | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ????? |
||
|
|
||
| # =REDACTED | ||
| # pgAdmin | ||
| # =REDACTED | ||
| PGADMIN_PORT=REDACTED | ||
|
|
||
| jwt_secret=REDACTED | ||
| jwt_algorithm=REDACTED | ||
| encryption_key=REDACTED | ||
| totp_issuer=REDACTED | ||
|
|
||
| # =REDACTED | ||
| # Additional required variables | ||
| # =REDACTED | ||
| # ...add any other staging-specific variables here... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?????? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| .env | ||
| .env.staging | ||
| __pycache__ | ||
| db/schema.sql | ||
| db/schema.sql |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
|
|
||
| FROM python:3.12-slim | ||
|
|
||
| # Install PostgreSQL client libraries and build tools | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends libpq-dev gcc \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ENV PYTHONDONTWRITEBYTECODE=1 | ||
| ENV PYTHONUNBUFFERED=1 | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add another dockerfile tht run the migration on postgress in the staging or do it in this dockerfile |
||
| WORKDIR /app | ||
|
|
||
| RUN pip install --no-cache-dir uv | ||
|
|
||
| COPY pyproject.toml uv.lock ./ | ||
| RUN uv sync --locked --no-dev \ | ||
| && uv pip install alembic | ||
|
|
||
| COPY . . | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| services: | ||
| postgres: | ||
| image: pgvector/pgvector:pg16 | ||
| container_name: multi_postgres | ||
| restart: unless-stopped | ||
| env_file: | ||
| - .env.staging | ||
| environment: | ||
| POSTGRES_USER: ${POSTGRES_USER} | ||
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
| POSTGRES_DB: ${POSTGRES_DB} | ||
| ports: | ||
| - "${POSTGRES_PORT}:5432" | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| networks: | ||
| - multi_network | ||
|
|
||
| nats: | ||
| image: nats:2.10-alpine | ||
| container_name: multi_nats | ||
| command: > | ||
| -js | ||
| -a 0.0.0.0 | ||
| -m ${NATS_MONITOR_PORT} | ||
| --user ${NATS_USER} | ||
| --pass ${NATS_PASSWORD} | ||
| ports: | ||
| - "${NATS_PORT}:4222" | ||
| - "${NATS_MONITOR_PORT}:8222" | ||
| networks: | ||
| - multi_network | ||
|
|
||
| minio: | ||
| image: minio/minio:latest | ||
| container_name: multi_minio | ||
| restart: unless-stopped | ||
| env_file: | ||
| - .env.staging | ||
| command: server /data --console-address ":${MINIO_CONSOLE_PORT}" | ||
| ports: | ||
| - "${MINIO_API_PORT}:9000" | ||
| - "${MINIO_CONSOLE_PORT}:9001" | ||
| volumes: | ||
| - minio_data:/data | ||
| networks: | ||
| - multi_network | ||
|
|
||
| pgadmin: | ||
| image: dpage/pgadmin4 | ||
| container_name: multi_pgadmin | ||
| restart: unless-stopped | ||
| environment: | ||
| PGADMIN_DEFAULT_EMAIL: admin@example.com | ||
| PGADMIN_DEFAULT_PASSWORD: admin | ||
| ports: | ||
| - "${PGADMIN_PORT}:80" | ||
| networks: | ||
| - multi_network | ||
|
|
||
| redis: | ||
| image: redis:7-alpine | ||
| container_name: multi_redis | ||
| restart: unless-stopped | ||
| ports: | ||
| - "${REDIS_PORT}:6379" | ||
| networks: | ||
| - multi_network | ||
| volumes: | ||
| - redis_data:/data | ||
|
|
||
| fastapi: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| container_name: multi_fastapi | ||
| restart: unless-stopped | ||
| env_file: | ||
| - .env.staging | ||
| depends_on: | ||
| - postgres | ||
| - redis | ||
| - nats | ||
| - minio | ||
| ports: | ||
| - "8000:8000" | ||
| networks: | ||
| - multi_network | ||
|
|
||
| migrate: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| container_name: multi_migrate | ||
| env_file: | ||
| - .env.staging | ||
| depends_on: | ||
| - postgres | ||
| command: ["uv", "run", "alembic", "upgrade", "head"] | ||
| networks: | ||
| - multi_network | ||
|
|
||
| volumes: | ||
| postgres_data: | ||
| minio_data: | ||
| redis_data: | ||
|
|
||
| networks: | ||
| multi_network: | ||
| driver: bridge |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create env for staging tht have the hosts of staging network (instead of local host we use service name ) and sone touch the .env we let it for the dev environement |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,4 @@ | ||
| version: "3.9" | ||
|
|
||
| services: | ||
|
|
||
| postgres: | ||
| image: pgvector/pgvector:pg16 | ||
| container_name: multi_postgres | ||
|
|
@@ -13,7 +10,7 @@ services: | |
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
| POSTGRES_DB: ${POSTGRES_DB} | ||
| ports: | ||
| - "${POSTGRES_PORT}:5432" | ||
| - "${POSTGRES_PORT}:5432" | ||
|
|
||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
|
|
@@ -27,6 +24,8 @@ services: | |
| -js | ||
| -a 0.0.0.0 | ||
| -m ${NATS_MONITOR_PORT} | ||
| --user ${NATS_USER} | ||
| --pass ${NATS_PASSWORD} | ||
| ports: | ||
| - "${NATS_PORT}:4222" | ||
| - "${NATS_MONITOR_PORT}:8222" | ||
|
|
@@ -59,7 +58,7 @@ services: | |
| - "${PGADMIN_PORT}:80" | ||
| networks: | ||
| - multi_network | ||
|
|
||
| redis: | ||
| image: redis:7-alpine | ||
| container_name: multi_redis | ||
|
|
@@ -69,14 +68,44 @@ services: | |
| networks: | ||
| - multi_network | ||
| volumes: | ||
| - redis_data:/data | ||
| - redis_data:/data | ||
|
|
||
| fastapi: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| container_name: multi_fastapi | ||
| restart: unless-stopped | ||
| env_file: | ||
| - .env | ||
| depends_on: | ||
| - postgres | ||
| - redis | ||
| - nats | ||
| - minio | ||
| ports: | ||
| - "8000:8000" | ||
| networks: | ||
| - multi_network | ||
|
|
||
| migrate: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| container_name: multi_migrate | ||
| env_file: | ||
| - .env | ||
| depends_on: | ||
| - postgres | ||
| command: ["uv", "run", "alembic", "upgrade", "head"] | ||
| networks: | ||
| - multi_network | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this we dont need this |
||
| volumes: | ||
| postgres_data: | ||
| minio_data: | ||
| redis_data: | ||
|
|
||
|
|
||
| networks: | ||
| multi_network: | ||
| driver: bridge | ||
| driver: bridge | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?????