Prod ve Dev birbirinden izole edildi.

This commit is contained in:
2025-11-27 18:26:04 +03:00
parent 8f05f40bb2
commit 2e410fb402
4 changed files with 50 additions and 18 deletions

View File

@@ -1,5 +1,8 @@
PORT=4000
MONGO_URI=mongodb://mongo:27017/wisecoltci
# Prod için zorunlu Mongo bağlantısı
# Örnek: mongodb://<APP_USER>:<APP_PASS>@<HOST>:27017/wisecoltci?authSource=wisecoltci
MONGO_URI=mongodb://app:change-me@mongo-host:27017/wisecoltci?authSource=wisecoltci
ADMIN_USERNAME=admin
ADMIN_PASSWORD=supersecret
JWT_SECRET=change-me

6
backend/mongo-init.js Normal file
View File

@@ -0,0 +1,6 @@
db = db.getSiblingDB("wisecoltci");
db.createUser({
user: process.env.MONGO_APP_USERNAME || "app",
pwd: process.env.MONGO_APP_PASSWORD || "change-me",
roles: [{ role: "readWrite", db: "wisecoltci" }]
});

39
docker-compose.dev.yml Normal file
View File

@@ -0,0 +1,39 @@
version: "3.9"
services:
mongo:
image: mongo:7
restart: unless-stopped
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
backend:
build: ./backend
command: npm run dev
volumes:
- ./backend:/app
- /app/node_modules
env_file:
- ./backend/.env
ports:
- "4000:4000"
depends_on:
- mongo
frontend:
build: ./frontend
command: npm run dev -- --host --port 5173
volumes:
- ./frontend:/app
- /app/node_modules
env_file:
- ./frontend/.env
ports:
- "5173:5173"
depends_on:
- backend
volumes:
mongo-data:

View File

@@ -1,24 +1,11 @@
services:
mongo:
image: mongo:7
restart: unless-stopped
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
backend:
build: ./backend
command: npm run dev
volumes:
- ./backend:/app
- /app/node_modules
command: npm run build && npm start
env_file:
- ./backend/.env
ports:
- "4000:4000"
depends_on:
- mongo
frontend:
build: ./frontend
@@ -32,6 +19,3 @@ services:
- "5173:5173"
depends_on:
- backend
volumes:
mongo-data: