mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 01:21:09 +02:00
feat(infra): add mana-credits to docker-compose, fix port to 3061
Port 3060 was already taken by api-gateway. Updated mana-credits to 3061. Changes: - docker-compose.macmini.yml: Add mana-credits service with health check, traefik labels for credits.mana.how, depends on postgres - docker-compose.macmini.yml: Add MANA_CREDITS_URL to mana-auth env - Update all port references from 3060 to 3061 (config, Dockerfile, CLAUDE.md) - Update better-auth.service.ts fallback URLs to 3061 - Update .env.development MANA_CREDITS_URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fa16f1fe38
commit
feeebfb7c4
5 changed files with 48 additions and 9 deletions
|
|
@ -208,6 +208,7 @@ services:
|
|||
# Cross-domain SSO: share session cookies across all *.mana.how subdomains
|
||||
COOKIE_DOMAIN: .mana.how
|
||||
MANA_CORE_SERVICE_KEY: ${MANA_CORE_SERVICE_KEY}
|
||||
MANA_CREDITS_URL: http://mana-credits:3061
|
||||
SMTP_HOST: smtp-relay.brevo.com
|
||||
SMTP_PORT: 587
|
||||
SMTP_USER: ${SMTP_USER:-94cde5002@smtp-brevo.com}
|
||||
|
|
@ -243,6 +244,44 @@ services:
|
|||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# ============================================
|
||||
# Tier 1b: Credits Service (Hono + Bun)
|
||||
# ============================================
|
||||
|
||||
mana-credits:
|
||||
build:
|
||||
context: services/mana-credits
|
||||
dockerfile: Dockerfile
|
||||
image: mana-credits:local
|
||||
container_name: mana-credits
|
||||
restart: always
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
TZ: Europe/Berlin
|
||||
PORT: 3061
|
||||
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-mana123}@postgres:5432/mana_credits
|
||||
MANA_CORE_AUTH_URL: http://mana-auth:3001
|
||||
MANA_CORE_SERVICE_KEY: ${MANA_CORE_SERVICE_KEY}
|
||||
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-}
|
||||
STRIPE_WEBHOOK_SECRET: ${STRIPE_CREDITS_WEBHOOK_SECRET:-}
|
||||
BASE_URL: https://credits.mana.how
|
||||
CORS_ORIGINS: https://mana.how,https://chat.mana.how,https://picture.mana.how,https://todo.mana.how,https://zitare.mana.how,https://calendar.mana.how,https://clock.mana.how,https://contacts.mana.how,https://manadeck.mana.how,https://presi.mana.how,https://storage.mana.how,https://nutriphi.mana.how,https://planta.mana.how,https://mukke.mana.how,https://context.mana.how,https://photos.mana.how,https://questions.mana.how
|
||||
ports:
|
||||
- "3061:3061"
|
||||
healthcheck:
|
||||
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:3061/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
||||
interval: 120s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.mana-credits.rule=Host(`credits.mana.how`)"
|
||||
- "traefik.http.routers.mana-credits.tls=true"
|
||||
- "traefik.http.services.mana-credits.loadbalancer.server.port=3061"
|
||||
|
||||
# ============================================
|
||||
# Tier 2: Gateway & Search Services (Ports 3010-3029)
|
||||
# ============================================
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ export class BetterAuthService {
|
|||
|
||||
// Redeem any pending gift codes via mana-credits service
|
||||
try {
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3060';
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3061';
|
||||
const serviceKey = process.env.MANA_CORE_SERVICE_KEY || '';
|
||||
const giftRes = await fetch(`${creditsUrl}/api/v1/internal/gifts/redeem-pending`, {
|
||||
method: 'POST',
|
||||
|
|
@ -1758,7 +1758,7 @@ export class BetterAuthService {
|
|||
*/
|
||||
private async createPersonalCreditBalance(userId: string) {
|
||||
try {
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3060';
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3061';
|
||||
const serviceKey = process.env.MANA_CORE_SERVICE_KEY || '';
|
||||
await fetch(`${creditsUrl}/api/v1/internal/credits/init`, {
|
||||
method: 'POST',
|
||||
|
|
@ -1778,7 +1778,7 @@ export class BetterAuthService {
|
|||
*/
|
||||
private async initializeGuildPool(organizationId: string) {
|
||||
try {
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3060';
|
||||
const creditsUrl = process.env.MANA_CREDITS_URL || 'http://localhost:3061';
|
||||
const serviceKey = process.env.MANA_CORE_SERVICE_KEY || '';
|
||||
await fetch(`${creditsUrl}/api/v1/internal/guild-pool/init`, {
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ bun run db:push # Push schema
|
|||
bun run db:studio # Open Drizzle Studio
|
||||
```
|
||||
|
||||
## Port: 3060
|
||||
## Port: 3061
|
||||
|
||||
## API Endpoints
|
||||
|
||||
|
|
@ -81,11 +81,11 @@ bun run db:studio # Open Drizzle Studio
|
|||
## Environment Variables
|
||||
|
||||
```env
|
||||
PORT=3060
|
||||
PORT=3061
|
||||
DATABASE_URL=postgresql://manacore:devpassword@localhost:5432/mana_credits
|
||||
MANA_CORE_AUTH_URL=http://localhost:3001
|
||||
MANA_CORE_SERVICE_KEY=dev-service-key
|
||||
BASE_URL=http://localhost:3060
|
||||
BASE_URL=http://localhost:3061
|
||||
STRIPE_SECRET_KEY=sk_test_...
|
||||
STRIPE_WEBHOOK_SECRET=whsec_...
|
||||
CORS_ORIGINS=http://localhost:5173,http://localhost:5180
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ RUN bun install --frozen-lockfile 2>/dev/null || bun install
|
|||
COPY src ./src
|
||||
COPY tsconfig.json drizzle.config.ts ./
|
||||
|
||||
EXPOSE 3060
|
||||
EXPOSE 3061
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD bun -e "fetch('http://localhost:3060/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
||||
CMD bun -e "fetch('http://localhost:3061/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
||||
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export function loadConfig(): Config {
|
|||
};
|
||||
|
||||
return {
|
||||
port: parseInt(process.env.PORT || '3060', 10),
|
||||
port: parseInt(process.env.PORT || '3061', 10),
|
||||
databaseUrl: requiredEnv(
|
||||
'DATABASE_URL',
|
||||
'postgresql://manacore:devpassword@localhost:5432/mana_credits'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue