unify all ports: app=3010, infra=3184-3187, cleanup debug markers

This commit is contained in:
Дмитрий Мамедов
2026-06-10 18:12:26 +03:00
parent d33cb237d7
commit 9b4311f34f
7 changed files with 15 additions and 32 deletions

View File

@@ -42,7 +42,7 @@ RABBITMQ_URL=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:${RAB
# ────────────────────────────────────────────── # ──────────────────────────────────────────────
# CORS # CORS
# ────────────────────────────────────────────── # ──────────────────────────────────────────────
CORS_ORIGINS=http://localhost:3000,http://localhost:5173 CORS_ORIGINS=http://localhost:3010,http://localhost:5173
# ────────────────────────────────────────────── # ──────────────────────────────────────────────
# Rate Limiting # Rate Limiting

View File

@@ -16,6 +16,6 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./ COPY --from=builder /app/package.json ./
COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/prisma ./prisma
USER sso USER sso
EXPOSE 3000 EXPOSE 3010
ENV NODE_ENV=production ENV NODE_ENV=production
CMD ["node", "dist/main"] CMD ["node", "dist/main"]

View File

@@ -8,7 +8,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB} POSTGRES_DB: ${POSTGRES_DB}
ports: ports:
- "${POSTGRES_PORT:-5432}:5432" - "${POSTGRES_PORT:-3184}:5432"
volumes: volumes:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
healthcheck: healthcheck:
@@ -21,7 +21,7 @@ services:
image: redis:7-alpine image: redis:7-alpine
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${REDIS_PORT:-6379}:6379" - "${REDIS_PORT:-3185}:6379"
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "ping"] test: ["CMD", "redis-cli", "ping"]
interval: 5s interval: 5s
@@ -36,8 +36,8 @@ services:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER} RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD} RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
ports: ports:
- "${RABBITMQ_PORT:-5672}:5672" - "${RABBITMQ_PORT:-3186}:5672"
- "${RABBITMQ_UI_PORT:-15672}:15672" - "${RABBITMQ_UI_PORT:-3187}:15672"
healthcheck: healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"] test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s interval: 10s

View File

@@ -258,14 +258,11 @@ while [ "$I" -le 30 ]; do
break break
fi fi
if [ "$I" -eq 30 ]; then if [ "$I" -eq 30 ]; then
echo "=== PG LOOP TIMEOUT ===" warn "PostgreSQL did not become ready after 60s — continuing anyway..."
fi fi
I=$((I + 1)) I=$((I + 1))
sleep 2 sleep 2
done done
echo "=== AFTER PG LOOP ==="
echo "=== CHECKPOINT: after postgres loop ==="
info "Waiting for Redis..." info "Waiting for Redis..."
for ((i=1; i<=15; i++)); do for ((i=1; i<=15; i++)); do
@@ -278,41 +275,27 @@ for ((i=1; i<=15; i++)); do
fi fi
sleep 2 sleep 2
done done
echo "=== CHECKPOINT: after redis loop ==="
# ─── 6. Dependencies & Prisma ──────────────────────────────────── # ─── 6. Dependencies & Prisma ────────────────────────────────────
echo "=== CHECKPOINT: step 6 ==="
step "6/8 Installing dependencies" step "6/8 Installing dependencies"
echo "=== CHECKPOINT: npm install ==="
npm install --no-audit --no-fund || error "'npm install' failed. Check network / ${INSTALL_DIR}/package.json" npm install --no-audit --no-fund || error "'npm install' failed. Check network / ${INSTALL_DIR}/package.json"
echo "=== CHECKPOINT: npm ci done ==="
info "npm dependencies installed" info "npm dependencies installed"
echo "=== CHECKPOINT: prisma generate ==="
npx prisma generate || error "'prisma generate' failed." npx prisma generate || error "'prisma generate' failed."
echo "=== CHECKPOINT: prisma generate done ==="
info "Prisma client generated" info "Prisma client generated"
export DATABASE_URL export DATABASE_URL
echo "=== CHECKPOINT: prisma db push ==="
npx prisma db push || error "'prisma db push' failed. Is PostgreSQL accessible? Check ${INSTALL_DIR}/.env DATABASE_URL" npx prisma db push || error "'prisma db push' failed. Is PostgreSQL accessible? Check ${INSTALL_DIR}/.env DATABASE_URL"
echo "=== CHECKPOINT: prisma db push done ==="
info "Database schema applied" info "Database schema applied"
# ─── 7. Seed ───────────────────────────────────────────────────── # ─── 7. Seed ─────────────────────────────────────────────────────
echo "=== CHECKPOINT: step 7 ==="
step "7/8 Seeding database" step "7/8 Seeding database"
echo "=== CHECKPOINT: seed ==="
npx ts-node -P tsconfig.json prisma/seed.ts || error "Seed failed." npx ts-node -P tsconfig.json prisma/seed.ts || error "Seed failed."
echo "=== CHECKPOINT: seed done ==="
info "Seed data created" info "Seed data created"
# ─── 8. Build & Start ──────────────────────────────────────────── # ─── 8. Build & Start ────────────────────────────────────────────
echo "=== CHECKPOINT: step 8 ==="
step "8/8 Building and starting SSO Service" step "8/8 Building and starting SSO Service"
echo "=== CHECKPOINT: build ==="
npm run build || error "'npm run build' failed. Check TypeScript errors above." npm run build || error "'npm run build' failed. Check TypeScript errors above."
echo "=== CHECKPOINT: build done ==="
info "Application built" info "Application built"
# Остановить предыдущий процесс, если был # Остановить предыдущий процесс, если был

View File

@@ -33,7 +33,7 @@ async function main(): Promise<void> {
name: "Test OAuth Client", name: "Test OAuth Client",
clientId: testClientId, clientId: testClientId,
clientSecret, clientSecret,
redirectUris: ["http://localhost:5173/callback", "http://localhost:3000/callback"], redirectUris: ["http://localhost:5173/callback", "http://localhost:3010/callback"],
grants: ["authorization_code", "client_credentials", "refresh_token"], grants: ["authorization_code", "client_credentials", "refresh_token"],
isConfidential: true, isConfidential: true,
}, },

View File

@@ -2,7 +2,7 @@ import { registerAs } from '@nestjs/config';
export default registerAs('app', () => ({ export default registerAs('app', () => ({
nodeEnv: process.env.NODE_ENV, nodeEnv: process.env.NODE_ENV,
port: parseInt(process.env.PORT ?? '3000', 10), port: parseInt(process.env.PORT ?? '3010', 10),
host: process.env.HOST ?? '0.0.0.0', host: process.env.HOST ?? '0.0.0.0',
trustProxy: parseInt(process.env.TRUST_PROXY ?? '1', 10), trustProxy: parseInt(process.env.TRUST_PROXY ?? '1', 10),
@@ -15,7 +15,7 @@ export default registerAs('app', () => ({
redis: { redis: {
host: process.env.REDIS_HOST ?? 'localhost', host: process.env.REDIS_HOST ?? 'localhost',
port: parseInt(process.env.REDIS_PORT ?? '6379', 10), port: parseInt(process.env.REDIS_PORT ?? '3185', 10),
}, },
rabbitmq: { rabbitmq: {
@@ -23,7 +23,7 @@ export default registerAs('app', () => ({
}, },
cors: { cors: {
origins: (process.env.CORS_ORIGINS ?? 'http://localhost:3000').split(','), origins: (process.env.CORS_ORIGINS ?? 'http://localhost:3010').split(','),
}, },
throttle: { throttle: {

View File

@@ -4,7 +4,7 @@ export const envSchema = z.object({
NODE_ENV: z NODE_ENV: z
.enum(['development', 'production', 'test']) .enum(['development', 'production', 'test'])
.default('development'), .default('development'),
PORT: z.coerce.number().int().positive().default(3000), PORT: z.coerce.number().int().positive().default(3010),
HOST: z.string().default('0.0.0.0'), HOST: z.string().default('0.0.0.0'),
TRUST_PROXY: z.coerce.number().int().min(0).default(1), TRUST_PROXY: z.coerce.number().int().min(0).default(1),
@@ -19,15 +19,15 @@ export const envSchema = z.object({
POSTGRES_DB: z.string().min(1), POSTGRES_DB: z.string().min(1),
REDIS_HOST: z.string().default('localhost'), REDIS_HOST: z.string().default('localhost'),
REDIS_PORT: z.coerce.number().int().positive().default(6379), REDIS_PORT: z.coerce.number().int().positive().default(3185),
RABBITMQ_USER: z.string().min(1), RABBITMQ_USER: z.string().min(1),
RABBITMQ_PASSWORD: z.string().min(1), RABBITMQ_PASSWORD: z.string().min(1),
RABBITMQ_HOST: z.string().default('localhost'), RABBITMQ_HOST: z.string().default('localhost'),
RABBITMQ_PORT: z.coerce.number().int().positive().default(5672), RABBITMQ_PORT: z.coerce.number().int().positive().default(3186),
RABBITMQ_URL: z.string(), RABBITMQ_URL: z.string(),
CORS_ORIGINS: z.string().default('http://localhost:3000'), CORS_ORIGINS: z.string().default('http://localhost:3010'),
THROTTLE_TTL: z.coerce.number().int().positive().default(60), THROTTLE_TTL: z.coerce.number().int().positive().default(60),
THROTTLE_LIMIT: z.coerce.number().int().positive().default(10), THROTTLE_LIMIT: z.coerce.number().int().positive().default(10),