Fix env defaults: use Docker network hostnames + parametrize compose

This commit is contained in:
lekss361 2026-04-25 19:36:10 +03:00
parent 18ade1e252
commit 384d4d5489
4 changed files with 47 additions and 7 deletions

12
.env.example Normal file
View file

@ -0,0 +1,12 @@
# Variables read by docker-compose.yml at the project root.
# Copy to .env (chmod 600) and fill with real values.
# Generate a strong password with: openssl rand -base64 24 | tr -d '/+' | head -c 24
POSTGRES_DB=gendesign
POSTGRES_USER=gendesign
POSTGRES_PASSWORD=changeme
# For docker-compose.prod.yml only:
# YC_REGISTRY_ID=
# IMAGE_TAG=latest
# NEXT_PUBLIC_API_BASE_URL=https://your-domain.example.ru

View file

@ -1,5 +1,8 @@
DATABASE_URL=postgresql+psycopg://gendesign:gendesign@localhost:5432/gendesign
REDIS_URL=redis://localhost:6379/0
# Hostname-related defaults assume Docker Compose context (this is the recommended way to run).
# For native development without Docker, swap "postgres" → "localhost" and "redis" → "localhost".
DATABASE_URL=postgresql+psycopg://gendesign:gendesign@postgres:5432/gendesign
REDIS_URL=redis://redis:6379/0
CORS_ORIGINS=["http://localhost:3000"]
ENVIRONMENT=dev
SENTRY_DSN=

View file

@ -2,15 +2,15 @@ services:
postgres:
image: postgis/postgis:16-3.4
environment:
POSTGRES_DB: gendesign
POSTGRES_USER: gendesign
POSTGRES_PASSWORD: gendesign
POSTGRES_DB: ${POSTGRES_DB:-gendesign}
POSTGRES_USER: ${POSTGRES_USER:-gendesign}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-gendesign}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "gendesign"]
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-gendesign}"]
interval: 5s
timeout: 5s
retries: 10

View file

@ -17,4 +17,29 @@ The key's randomart image is:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPGKuThuQMPdjxdA9FXHkUZUO+iyVbSMOxy3qFbOY7+K gendesign-deploy
mYsNNJf%6hpN
mYsNNJf%6hpN
`gendesign' 12345 ssh gendesign
for github
Generating public/private ed25519 key pair.
Your identification has been saved in /home/gendesign/.ssh/github_deploy
Your public key has been saved in /home/gendesign/.ssh/github_deploy.pub
The key fingerprint is:
SHA256:W9Ioi7A/d+LxIghIOoF4rGurbEnIHuVjDtfF1Ki+C1o gendesign-server-deploy-key
The key's randomart image is:
+--[ED25519 256]--+
| o |
| o . |
|o. + |
|+.o. . o o |
|*++ o o S o |
|B= B + o + |
|o+OEo + . |
|o=+o+.+o. |
|=+. .*o+. |
+----[SHA256]-----+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPYYAH7vPN/b0npfH1IrhADdE+SwJsmo8gJm84VauM4m gendesign-server-deploy-key
pg pass 2J2SBPMKuS998fiwhtQqDhMI