aded k6 and script and updated code with better logic and indexing on schema

This commit is contained in:
krizam
2026-10-22 07:50:26 +05:30
parent 4d937b92da
commit 36a7345d26
17 changed files with 1386 additions and 176 deletions
+68
View File
@@ -0,0 +1,68 @@
services:
mongo:
image: mongo:7.0.41
container_name: node-ass1-mongo
restart: unless-stopped
command: ["mongod", "--bind_ip_all"]
environment:
MONGO_INITDB_DATABASE: node_ass1
volumes:
- mongo_data:/data/db
networks:
- testnet
mem_limit: 2g
cpus: 1.0
healthcheck:
test:
[
"CMD",
"mongosh",
"--quiet",
"mongodb://127.0.0.1:27017/node_ass1",
"--eval",
"db.runCommand({ ping: 1 }).ok"
]
interval: 5s
timeout: 3s
retries: 15
app:
build:
context: .
dockerfile: Dockerfile
container_name: node-ass1-app
init: true
environment:
NODE_ENV: production
PORT: 3000
MONGO_URI: mongodb://mongo:27017/node_ass1
ports:
- "127.0.0.1:3000:3000"
depends_on:
mongo:
condition: service_healthy
networks:
- testnet
mem_limit: 1g
cpus: 1.5
k6:
image: grafana/k6:latest
container_name: node-ass1-k6
profiles: ["testing"]
working_dir: /scripts
volumes:
- ./k6:/scripts:ro
- ./results:/results
networks:
- testnet
mem_limit: 2g
cpus: 1.0
entrypoint: ["k6"]
networks:
testnet:
driver: bridge
volumes:
mongo_data: