Compare commits
5 Commits
f5e2fcbf98
...
fix/dokplo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45adcc2621 | ||
| 8e94f3735e | |||
|
|
d0d1b5a857 | ||
| a9dc0b7e84 | |||
|
|
19143514ab |
31
.dockerignore
Normal file
31
.dockerignore
Normal file
@@ -0,0 +1,31 @@
|
||||
# Version control
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Dependencies
|
||||
**/node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Next.js build output
|
||||
**/.next/
|
||||
**/out/
|
||||
|
||||
# Medusa build output & cache
|
||||
**/.medusa/
|
||||
**/.cache/
|
||||
|
||||
# Local environment files (do NOT bake local secrets into images)
|
||||
**/.env
|
||||
**/.env.local
|
||||
**/.env.development.local
|
||||
**/.env.test.local
|
||||
**/.env.production.local
|
||||
|
||||
# Turbo cache
|
||||
**/.turbo
|
||||
|
||||
# OS metadata
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
34
.env.production.example
Normal file
34
.env.production.example
Normal file
@@ -0,0 +1,34 @@
|
||||
# ========================================================
|
||||
# SUMAN D.O.O. — DOCKER PRODUKCIJSKE VARIJABLE OKRUŽENJA
|
||||
# ========================================================
|
||||
# Kopirajte ovaj fajl u .env.production ili .env na serveru:
|
||||
# cp .env.production.example .env
|
||||
|
||||
# --- POSTGRESQL BAZA ---
|
||||
POSTGRES_USER=suman_prod_user
|
||||
POSTGRES_PASSWORD=PostaviSigurnuLozinkuBaze123!
|
||||
POSTGRES_DB=suman_prod_db
|
||||
|
||||
# --- REDIS CACHE ---
|
||||
REDIS_PASSWORD=PostaviSigurnuLozinkuRedis123!
|
||||
|
||||
# --- MEDUSA V2 BACKEND ---
|
||||
BACKEND_PORT=9000
|
||||
JWT_SECRET=generisi_siguran_jwt_secret_najmanje_32_karaktera
|
||||
COOKIE_SECRET=generisi_siguran_cookie_secret_najmanje_32_karaktera
|
||||
MEDUSA_BACKEND_URL=https://api.suman.ba
|
||||
|
||||
# CORS Konfiguracija (odvojeno zarezima)
|
||||
STORE_CORS=https://suman.ba,https://suman.hr,http://localhost:8000,http://localhost:8002
|
||||
ADMIN_CORS=https://admin.suman.ba,http://localhost:9000
|
||||
AUTH_CORS=https://admin.suman.ba,https://suman.ba,https://suman.hr,http://localhost:9000,http://localhost:8000,http://localhost:8002
|
||||
|
||||
# --- STOREFRONT BOSNA I HERCEGOVINA ---
|
||||
STOREFRONT_BA_PORT=8000
|
||||
STOREFRONT_BA_BASE_URL=https://suman.ba
|
||||
MEDUSA_PUBLISHABLE_KEY_BA=pk_b722e44870bc8cc7828d0713980537e95b2e74ff229a529a4b3fa8155035f1f0
|
||||
|
||||
# --- STOREFRONT HRVATSKA ---
|
||||
STOREFRONT_HR_PORT=8002
|
||||
STOREFRONT_HR_BASE_URL=https://suman.hr
|
||||
MEDUSA_PUBLISHABLE_KEY_HR=pk_suman_hrvatska_publishable_key
|
||||
61
Dockerfile
Normal file
61
Dockerfile
Normal file
@@ -0,0 +1,61 @@
|
||||
# ==========================================
|
||||
# Root Dockerfile for Dokploy & Monorepo Deployments
|
||||
# Defaults to building the Medusa v2 Backend
|
||||
# ==========================================
|
||||
|
||||
# 1. Base stage with dependencies
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
# Copy root workspace manifests
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/backend/package.json ./apps/backend/
|
||||
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
|
||||
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
|
||||
|
||||
# Install dependencies for backend workspace
|
||||
RUN npm ci --workspace=@dtc/backend --include-workspace-root
|
||||
|
||||
# 2. Build stage
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY apps/backend ./apps/backend
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||
|
||||
# Build Medusa backend and admin dashboard
|
||||
RUN npm run build --workspace=@dtc/backend
|
||||
|
||||
# Prune devDependencies to keep image light and avoid OOM during copy
|
||||
RUN npm prune --production --workspace=@dtc/backend
|
||||
|
||||
# 3. Production runner stage
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app/apps/backend
|
||||
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=9000
|
||||
|
||||
# Non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 medusa
|
||||
|
||||
# Copy pruned dependencies from builder (sequential dependency prevents BuildKit parallel I/O spike)
|
||||
COPY --from=builder --chown=medusa:nodejs /app/node_modules /app/node_modules
|
||||
COPY --from=builder --chown=medusa:nodejs /app/package.json /app/package-lock.json /app/
|
||||
COPY --from=builder --chown=medusa:nodejs /app/apps/backend /app/apps/backend
|
||||
|
||||
# Uploads directory
|
||||
RUN mkdir -p /app/apps/backend/uploads && chown -R medusa:nodejs /app/apps/backend/uploads
|
||||
|
||||
USER medusa
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
# Run migrations and start Medusa production server
|
||||
CMD ["sh", "-c", "npx medusa db:migrate && npm run start"]
|
||||
60
apps/backend/Dockerfile
Normal file
60
apps/backend/Dockerfile
Normal file
@@ -0,0 +1,60 @@
|
||||
# ==========================================
|
||||
# Medusa v2 Production Dockerfile
|
||||
# ==========================================
|
||||
|
||||
# 1. Base stage with dependencies
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
# Copy root workspace manifests
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/backend/package.json ./apps/backend/
|
||||
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
|
||||
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
|
||||
|
||||
# Install dependencies for backend workspace
|
||||
RUN npm ci --workspace=@dtc/backend --include-workspace-root
|
||||
|
||||
# 2. Build stage
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY apps/backend ./apps/backend
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||
|
||||
# Build Medusa backend and admin dashboard
|
||||
RUN npm run build --workspace=@dtc/backend
|
||||
|
||||
# Prune devDependencies to keep image light and avoid OOM during copy
|
||||
RUN npm prune --production --workspace=@dtc/backend
|
||||
|
||||
# 3. Production runner stage
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app/apps/backend
|
||||
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=9000
|
||||
|
||||
# Non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 medusa
|
||||
|
||||
# Copy pruned dependencies from builder (sequential dependency prevents BuildKit parallel I/O spike)
|
||||
COPY --from=builder --chown=medusa:nodejs /app/node_modules /app/node_modules
|
||||
COPY --from=builder --chown=medusa:nodejs /app/package.json /app/package-lock.json /app/
|
||||
COPY --from=builder --chown=medusa:nodejs /app/apps/backend /app/apps/backend
|
||||
|
||||
# Uploads directory
|
||||
RUN mkdir -p /app/apps/backend/uploads && chown -R medusa:nodejs /app/apps/backend/uploads
|
||||
|
||||
USER medusa
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
# Run migrations and start Medusa production server
|
||||
CMD ["sh", "-c", "npx medusa db:migrate && npm run start"]
|
||||
@@ -32,5 +32,6 @@
|
||||
".medusa/admin",
|
||||
".cache",
|
||||
"eslint.config.*",
|
||||
"src/scripts"
|
||||
]
|
||||
}
|
||||
|
||||
56
apps/suman-bosna/Dockerfile
Normal file
56
apps/suman-bosna/Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
# ==========================================
|
||||
# Next.js 16 Storefront Production Dockerfile (Suman Bosna)
|
||||
# ==========================================
|
||||
|
||||
# 1. Base stage with dependencies
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/backend/package.json ./apps/backend/
|
||||
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
|
||||
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
|
||||
|
||||
RUN npm ci --workspace=@dtc/suman-bosna --include-workspace-root
|
||||
|
||||
# 2. Build stage
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY apps/suman-bosna ./apps/suman-bosna
|
||||
|
||||
ARG NEXT_PUBLIC_MEDUSA_BACKEND_URL
|
||||
ARG NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
|
||||
ARG NEXT_PUBLIC_BASE_URL
|
||||
ARG NEXT_PUBLIC_DEFAULT_REGION=ba
|
||||
|
||||
ENV NEXT_PUBLIC_MEDUSA_BACKEND_URL=$NEXT_PUBLIC_MEDUSA_BACKEND_URL
|
||||
ENV NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=$NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
|
||||
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
|
||||
ENV NEXT_PUBLIC_DEFAULT_REGION=$NEXT_PUBLIC_DEFAULT_REGION
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN npm run build --workspace=@dtc/suman-bosna
|
||||
|
||||
# 3. Production runner stage
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app/apps/suman-bosna
|
||||
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=8000
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=base --chown=nextjs:nodejs /app/node_modules /app/node_modules
|
||||
COPY --from=base --chown=nextjs:nodejs /app/package.json /app/package-lock.json /app/
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/apps/suman-bosna /app/apps/suman-bosna
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
4
apps/suman-bosna/next-env.d.ts
vendored
4
apps/suman-bosna/next-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/dev/types/root-params.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/types/root-params.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
56
apps/suman-hrvatska/Dockerfile
Normal file
56
apps/suman-hrvatska/Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
# ==========================================
|
||||
# Next.js 16 Storefront Production Dockerfile (Suman Hrvatska)
|
||||
# ==========================================
|
||||
|
||||
# 1. Base stage with dependencies
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/backend/package.json ./apps/backend/
|
||||
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
|
||||
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
|
||||
|
||||
RUN npm ci --workspace=@dtc/suman-hrvatska --include-workspace-root
|
||||
|
||||
# 2. Build stage
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY apps/suman-hrvatska ./apps/suman-hrvatska
|
||||
|
||||
ARG NEXT_PUBLIC_MEDUSA_BACKEND_URL
|
||||
ARG NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
|
||||
ARG NEXT_PUBLIC_BASE_URL
|
||||
ARG NEXT_PUBLIC_DEFAULT_REGION=hr
|
||||
|
||||
ENV NEXT_PUBLIC_MEDUSA_BACKEND_URL=$NEXT_PUBLIC_MEDUSA_BACKEND_URL
|
||||
ENV NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=$NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
|
||||
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
|
||||
ENV NEXT_PUBLIC_DEFAULT_REGION=$NEXT_PUBLIC_DEFAULT_REGION
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN npm run build --workspace=@dtc/suman-hrvatska
|
||||
|
||||
# 3. Production runner stage
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app/apps/suman-hrvatska
|
||||
|
||||
RUN apk add --no-cache libc6-compat curl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=8002
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=base --chown=nextjs:nodejs /app/node_modules /app/node_modules
|
||||
COPY --from=base --chown=nextjs:nodejs /app/package.json /app/package-lock.json /app/
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/apps/suman-hrvatska /app/apps/suman-hrvatska
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 8002
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
4
apps/suman-hrvatska/next-env.d.ts
vendored
4
apps/suman-hrvatska/next-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/dev/types/root-params.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/types/root-params.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
38
docker-compose.local.yml
Normal file
38
docker-compose.local.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: suman-local
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: umbrella_postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-suman_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-TvojaSigurnaLozinka123!}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-medusa-suman-doo}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_user} -d ${POSTGRES_DB:-medusa-suman-doo}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: umbrella-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
178
docker-compose.prod.yml
Normal file
178
docker-compose.prod.yml
Normal file
@@ -0,0 +1,178 @@
|
||||
name: suman-prod
|
||||
|
||||
services:
|
||||
# ==========================================
|
||||
# 1. PostgreSQL Baza Podataka
|
||||
# ==========================================
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: suman_prod_postgres
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-suman_prod_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-suman_prod_db}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_prod_user} -d ${POSTGRES_DB:-suman_prod_db}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 2. Redis Cache & Queue
|
||||
# ==========================================
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: suman_prod_redis
|
||||
restart: always
|
||||
command: >
|
||||
sh -c '
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
|
||||
else
|
||||
redis-server --appendonly yes
|
||||
fi
|
||||
'
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: >
|
||||
sh -c '
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
redis-cli -a "$$REDIS_PASSWORD" ping
|
||||
else
|
||||
redis-cli ping
|
||||
fi
|
||||
'
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 3. Medusa v2 Backend (API & Admin)
|
||||
# ==========================================
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/backend/Dockerfile
|
||||
container_name: suman_prod_backend
|
||||
restart: always
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 9000
|
||||
DATABASE_URL: postgres://${POSTGRES_USER:-suman_prod_user}:${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}@postgres:5432/${POSTGRES_DB:-suman_prod_db}
|
||||
REDIS_URL: redis://${REDIS_PASSWORD:+:${REDIS_PASSWORD}@}redis:6379
|
||||
JWT_SECRET: ${JWT_SECRET:-suman_prod_super_secret_jwt_key_32_chars_min}
|
||||
COOKIE_SECRET: ${COOKIE_SECRET:-suman_prod_super_secret_cookie_key_32_chars}
|
||||
STORE_CORS: ${STORE_CORS:-http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
|
||||
ADMIN_CORS: ${ADMIN_CORS:-http://localhost:9000,https://admin.suman.ba,https://suman.ba}
|
||||
AUTH_CORS: ${AUTH_CORS:-http://localhost:9000,http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
|
||||
MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://localhost:9000}
|
||||
volumes:
|
||||
- backend_uploads:/app/apps/backend/uploads
|
||||
ports:
|
||||
- "${BACKEND_PORT:-9000}:9000"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:9000/health || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 4. Storefront Bosna i Hercegovina (Next.js)
|
||||
# ==========================================
|
||||
storefront-bosna:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/suman-bosna/Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: ba
|
||||
container_name: suman_prod_storefront_bosna
|
||||
restart: always
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 8000
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: ba
|
||||
ports:
|
||||
- "${STOREFRONT_BA_PORT:-8000}:8000"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 15s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 5. Storefront Hrvatska (Next.js)
|
||||
# ==========================================
|
||||
storefront-hrvatska:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/suman-hrvatska/Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: hr
|
||||
container_name: suman_prod_storefront_hrvatska
|
||||
restart: always
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 8002
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: hr
|
||||
ports:
|
||||
- "${STOREFRONT_HR_PORT:-8002}:8002"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8002/ || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 15s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
name: suman_prod_pgdata
|
||||
redis_data:
|
||||
name: suman_prod_redisdata
|
||||
backend_uploads:
|
||||
name: suman_prod_uploads
|
||||
|
||||
networks:
|
||||
suman_network:
|
||||
name: suman_prod_network
|
||||
driver: bridge
|
||||
@@ -1,29 +1,178 @@
|
||||
version: "3.8"
|
||||
name: suman-prod
|
||||
|
||||
services:
|
||||
# ==========================================
|
||||
# 1. PostgreSQL Baza Podataka
|
||||
# ==========================================
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: umbrella_postgres
|
||||
restart: unless-stopped
|
||||
container_name: suman_prod_postgres
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-suman_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-TvojaSigurnaLozinka123!}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-medusa-suman-doo}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
POSTGRES_USER: ${POSTGRES_USER:-suman_prod_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-suman_prod_db}
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_prod_user} -d ${POSTGRES_DB:-suman_prod_db}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 2. Redis Cache & Queue
|
||||
# ==========================================
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: umbrella-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
container_name: suman_prod_redis
|
||||
restart: always
|
||||
command: >
|
||||
sh -c '
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
|
||||
else
|
||||
redis-server --appendonly yes
|
||||
fi
|
||||
'
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: >
|
||||
sh -c '
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
redis-cli -a "$$REDIS_PASSWORD" ping
|
||||
else
|
||||
redis-cli ping
|
||||
fi
|
||||
'
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 3. Medusa v2 Backend (API & Admin)
|
||||
# ==========================================
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/backend/Dockerfile
|
||||
container_name: suman_prod_backend
|
||||
restart: always
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 9000
|
||||
DATABASE_URL: postgres://${POSTGRES_USER:-suman_prod_user}:${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}@postgres:5432/${POSTGRES_DB:-suman_prod_db}
|
||||
REDIS_URL: redis://${REDIS_PASSWORD:+:${REDIS_PASSWORD}@}redis:6379
|
||||
JWT_SECRET: ${JWT_SECRET:-suman_prod_super_secret_jwt_key_32_chars_min}
|
||||
COOKIE_SECRET: ${COOKIE_SECRET:-suman_prod_super_secret_cookie_key_32_chars}
|
||||
STORE_CORS: ${STORE_CORS:-http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
|
||||
ADMIN_CORS: ${ADMIN_CORS:-http://localhost:9000,https://admin.suman.ba,https://suman.ba}
|
||||
AUTH_CORS: ${AUTH_CORS:-http://localhost:9000,http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
|
||||
MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://localhost:9000}
|
||||
volumes:
|
||||
- backend_uploads:/app/apps/backend/uploads
|
||||
ports:
|
||||
- "${BACKEND_PORT:-9000}:9000"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:9000/health || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 4. Storefront Bosna i Hercegovina (Next.js)
|
||||
# ==========================================
|
||||
storefront-bosna:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/suman-bosna/Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: ba
|
||||
container_name: suman_prod_storefront_bosna
|
||||
restart: always
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 8000
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: ba
|
||||
ports:
|
||||
- "${STOREFRONT_BA_PORT:-8000}:8000"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 15s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
# ==========================================
|
||||
# 5. Storefront Hrvatska (Next.js)
|
||||
# ==========================================
|
||||
storefront-hrvatska:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/suman-hrvatska/Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: hr
|
||||
container_name: suman_prod_storefront_hrvatska
|
||||
restart: always
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 8002
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
|
||||
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
|
||||
NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
|
||||
NEXT_PUBLIC_DEFAULT_REGION: hr
|
||||
ports:
|
||||
- "${STOREFRONT_HR_PORT:-8002}:8002"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8002/ || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 15s
|
||||
networks:
|
||||
- suman_network
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
postgres_data:
|
||||
name: suman_prod_pgdata
|
||||
redis_data:
|
||||
name: suman_prod_redisdata
|
||||
backend_uploads:
|
||||
name: suman_prod_uploads
|
||||
|
||||
networks:
|
||||
suman_network:
|
||||
name: suman_prod_network
|
||||
driver: bridge
|
||||
|
||||
@@ -15,7 +15,12 @@
|
||||
"backend:dev": "turbo dev --filter=@dtc/backend",
|
||||
"storefront:dev": "turbo dev --filter=@dtc/suman-bosna",
|
||||
"suman-bosna:dev": "turbo dev --filter=@dtc/suman-bosna",
|
||||
"suman-hrvatska:dev": "turbo dev --filter=@dtc/suman-hrvatska"
|
||||
"suman-hrvatska:dev": "turbo dev --filter=@dtc/suman-hrvatska",
|
||||
"docker:local": "docker compose -f docker-compose.local.yml up -d",
|
||||
"docker:local:down": "docker compose -f docker-compose.local.yml down",
|
||||
"docker:prod:build": "docker compose build",
|
||||
"docker:prod:up": "docker compose up -d",
|
||||
"docker:prod:down": "docker compose down"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
|
||||
Reference in New Issue
Block a user