feat(app) implemented lab 4

This commit is contained in:
imadev
2026-11-06 19:06:21 +03:00
parent 68968c4a3a
commit b4239f8cf0
63 changed files with 3944 additions and 137 deletions
+65 -11
View File
@@ -1,20 +1,74 @@
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
# These are logical interface suggestions; map actual framework names in REPORT.md.
# Copy to .env for your LOCAL synthetic test environment;
# Replace every "change-me" value before starting the stack.
APP_HOST=0.0.0.0
APP_PORT=8080
APP_ENV=lab
SESSION_TTL_SECONDS=3600
# Choose credentials locally. File paths contain no secret values.
DATABASE_URL_FILE=/run/secrets/database_url
# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
SESSION_STORE=postgres
CACHE_URL_FILE=/run/secrets/cache_url
API_REPLICAS=2
IDEMPOTENCY_TTL_SECONDS=86400
S3_ENDPOINT=http://s3:9000
DB_POOL_MAX_CONNS=10
# Local PostgreSQL. The API receives a full DATABASE_URL built by compose.yaml.
POSTGRES_USER=messenger
POSTGRES_PASSWORD=change-me-postgres
POSTGRES_DB=messenger
# Redis is the only accepted shared session store. AOF keeps absolute TTLs.
SESSION_STORE=redis
# HAProxy is the only public API entrypoint. API replicas use expose, not ports.
LB_PORT=8080
HAPROXY_STATS_PORT=8404
# RustFS root credentials are used ONLY by the one-shot s3-init bootstrap.
# The API and reconciler receive the scoped S3_ACCESS_KEY_ID /
# S3_SECRET_ACCESS_KEY pair below, whose policy is limited to attachments/*.
S3_ROOT_ACCESS_KEY=change-me-rustfs-root
S3_ROOT_SECRET_KEY=change-me-rustfs-root-secret
S3_ACCESS_KEY_ID=messenger-api
S3_SECRET_ACCESS_KEY=change-me-app-secret
S3_APP_USER=messenger-api
S3_APP_POLICY=messenger-attachments-rw
S3_ENDPOINT=http://rustfs:9000
S3_REGION=us-east-1
S3_BUCKET=messenger-attachments
S3_ACCESS_KEY_ID_FILE=/run/secrets/s3_access_key_id
S3_SECRET_ACCESS_KEY_FILE=/run/secrets/s3_secret_access_key
# Attachments data limits
MAX_UPLOAD_BYTES=10485760
MAX_IMAGE_PIXELS=40000000
# Weighted decode budget shared by concurrent validates
IMAGE_DECODE_MEMORY_MB=256
# Stale pending rows and orphan objects older than the grace period are removed.
RECONCILE_GRACE_SECONDS=900
RECONCILE_INTERVAL_SECONDS=300
# Per-replica and other services' resource limits.
# API_REPLICAS must stay within the 16 backend slots declared by
# server-template in infra/haproxy/haproxy.cfg.
API_REPLICAS=2
API_CPU_LIMIT=0.50
API_MEM_LIMIT=512M
POSTGRES_CPU_LIMIT=1.0
POSTGRES_MEM_LIMIT=512M
REDIS_CPU_LIMIT=0.50
REDIS_MEM_LIMIT=256M
RUSTFS_CPU_LIMIT=1.0
RUSTFS_MEM_LIMIT=512M
RECONCILER_CPU_LIMIT=0.25
RECONCILER_MEM_LIMIT=128M
HAPROXY_CPU_LIMIT=0.50
HAPROXY_MEM_LIMIT=128M
# K6 for detailed tests.
K6_VUS=10
K6_DURATION=60s
K6_CPU_LIMIT=1.0
K6_MEM_LIMIT=512M
# Optional overrides instead of the compose-generated URLs. A *_FILE value is
# read from a file, which is how Docker/Compose secrets are usually mounted.
# DATABASE_URL=postgres://messenger:password@localhost:5432/messenger?sslmode=disable
# DATABASE_URL_FILE=/run/secrets/database_url
# CACHE_URL=redis://localhost:6379/0
# CACHE_URL_FILE=/run/secrets/cache_url
# S3_ENDPOINT=http://localhost:9000