first commit
This commit is contained in:
commit
01d7cb1a80
34 files changed
+5723
No files matched your search
@@ -0,0 +1,113 @@
|
||||
# ─────────────────────────────────────────────────────────
|
||||
# Docker Compose - Stack completa para testar eBPF Sockmap
|
||||
#
|
||||
# Serviços:
|
||||
# nginx → Proxy reverso (porta 80 → Node.js)
|
||||
# app → Servidor Node.js (porta 3000)
|
||||
# mysql → Banco de dados MySQL (porta 3306)
|
||||
# postgres → Banco de dados PostgreSQL (porta 5432)
|
||||
#
|
||||
# Todos os containers ficam na mesma rede bridge,
|
||||
# e o eBPF sockmap acelera a comunicação entre eles.
|
||||
# ─────────────────────────────────────────────────────────
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
# ─── NGINX Proxy Reverso ───
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: sockmap-nginx
|
||||
ports:
|
||||
- "8080:80" # Acesse http://localhost:8080
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- sockmap-net
|
||||
restart: unless-stopped
|
||||
|
||||
# ─── Aplicação Node.js ───
|
||||
app:
|
||||
build:
|
||||
context: ./app
|
||||
dockerfile: Dockerfile
|
||||
container_name: sockmap-app
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_USER: app
|
||||
MYSQL_PASSWORD: app_password
|
||||
MYSQL_DATABASE: app_db
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_USER: app
|
||||
POSTGRES_PASSWORD: app_password
|
||||
POSTGRES_DATABASE: app_db
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- sockmap-net
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
restart: unless-stopped
|
||||
|
||||
# ─── MySQL ───
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: sockmap-mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root_password
|
||||
MYSQL_DATABASE: app_db
|
||||
MYSQL_USER: app
|
||||
MYSQL_PASSWORD: app_password
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql
|
||||
- ./db/mysql-init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
networks:
|
||||
- sockmap-net
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot_password"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
restart: unless-stopped
|
||||
|
||||
# ─── PostgreSQL ───
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: sockmap-postgres
|
||||
environment:
|
||||
POSTGRES_DB: app_db
|
||||
POSTGRES_USER: app
|
||||
POSTGRES_PASSWORD: app_password
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
- ./db/postgres-init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
networks:
|
||||
- sockmap-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U app -d app_db"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
postgres-data:
|
||||
|
||||
networks:
|
||||
sockmap-net:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.28.0.0/16
|
||||
Reference in new issue
Block a user