Intento de utilizar nodemon development para desarrollar son estropear production.
This commit is contained in:
parent
1db2f11c19
commit
f9bf5f4824
@ -29,11 +29,11 @@ services:
|
||||
condition: service_healthy
|
||||
suitecoffee-tenants:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ./services/app
|
||||
dockerfile: Dockerfile.development
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ./services/app:/app
|
||||
- /app/node_modules
|
||||
env_file:
|
||||
- ./services/app/.env.development
|
||||
environment:
|
||||
@ -55,11 +55,11 @@ services:
|
||||
depends_on:
|
||||
suitecoffee-db:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ./services/auth
|
||||
dockerfile: Dockerfile.development
|
||||
ports:
|
||||
- 4000:4000
|
||||
volumes:
|
||||
- ./services/auth:/app
|
||||
- /app/node_modules
|
||||
env_file:
|
||||
- ./services/auth/.env.development
|
||||
environment:
|
||||
@ -67,7 +67,7 @@ services:
|
||||
command: npm run dev
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://localhost:${AUTH_DOCKER_PORT:-4000}/health || exit 1"]
|
||||
test: ["CMD-SHELL", "curl -fsS http://localhost:${AUTH_DOCKER_PORT}/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
@ -82,6 +82,8 @@ services:
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASS}
|
||||
ports:
|
||||
- 54321:5432
|
||||
volumes:
|
||||
- suitecoffee-data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
@ -103,6 +105,8 @@ services:
|
||||
POSTGRES_PASSWORD: ${TENANTS_DB_PASS}
|
||||
volumes:
|
||||
- tenants-data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- 54322:5432
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${TENANTS_DB_USER} -d ${TENANTS_DB_NAME}"]
|
||||
@ -112,6 +116,7 @@ services:
|
||||
start_period: 10s
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-dbeaver:
|
||||
image: dbeaver/cloudbeaver:latest
|
||||
container_name: suitecoffee-dbeaver
|
||||
@ -122,7 +127,7 @@ services:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8978:8978"
|
||||
- 8978:8978
|
||||
volumes:
|
||||
- dbeaver_logs:/opt/cloudbeaver/logs
|
||||
- dbeaver_workspace:/opt/cloudbeaver/workspace
|
||||
@ -134,7 +139,7 @@ services:
|
||||
# container_name: suitecoffee-adminer
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - "8080:8080"
|
||||
# - 8080:8080
|
||||
# depends_on:
|
||||
# suitecoffee-tenants:
|
||||
# condition: service_healthy
|
||||
|
||||
@ -0,0 +1,157 @@
|
||||
# docker-compose.yml
|
||||
# Docker Comose para entorno deproducción o production.
|
||||
|
||||
services:
|
||||
|
||||
nginx-proxy-manager:
|
||||
image: jc21/nginx-proxy-manager:latest
|
||||
container_name: nginx-proxy-manager
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
suitecoffee-app:
|
||||
condition: service_healthy
|
||||
suitecoffee-auth:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "80:80" # HTTP público
|
||||
- "81:81" # UI de administración NPM
|
||||
- "443:443" # HTTPS público
|
||||
volumes:
|
||||
- npm_data:/data # config + DB (SQLite)
|
||||
- npm_letsencrypt:/etc/letsencrypt
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-app:
|
||||
container_name: suitecoffee-app
|
||||
depends_on:
|
||||
suitecoffee-db:
|
||||
condition: service_healthy
|
||||
suitecoffee-tenants:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ./services/app
|
||||
dockerfile: Dockerfile.development
|
||||
volumes:
|
||||
- ./services/app:/app
|
||||
env_file:
|
||||
- ./services/app/.env.development
|
||||
environment:
|
||||
- NODE_ENV=${NODE_ENV}
|
||||
command: npm run start
|
||||
healthcheck:
|
||||
# IMPORTANTE: asegurate de tener curl instalado en la imagen de app (ver nota abajo)
|
||||
test: ["CMD-SHELL", "curl -fsS http://localhost:${APP_DOCKER_PORT}/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-auth:
|
||||
container_name: suitecoffee-auth
|
||||
depends_on:
|
||||
suitecoffee-db:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ./services/auth
|
||||
dockerfile: Dockerfile.development
|
||||
volumes:
|
||||
- ./services/auth:/app
|
||||
env_file:
|
||||
- ./services/auth/.env.development
|
||||
environment:
|
||||
- NODE_ENV=${NODE_ENV}
|
||||
command: npm run start
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://localhost:${AUTH_DOCKER_PORT}/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 15s
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-db:
|
||||
image: postgres:16
|
||||
container_name: suitecoffee-db
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASS}
|
||||
volumes:
|
||||
- suitecoffee-data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-tenants:
|
||||
image: postgres:16
|
||||
container_name: suitecoffee-tenants
|
||||
environment:
|
||||
POSTGRES_DB: ${TENANTS_DB_NAME}
|
||||
POSTGRES_USER: ${TENANTS_DB_USER}
|
||||
POSTGRES_PASSWORD: ${TENANTS_DB_PASS}
|
||||
volumes:
|
||||
- tenants-data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${TENANTS_DB_USER} -d ${TENANTS_DB_NAME}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
suitecoffee-dbeaver:
|
||||
image: dbeaver/cloudbeaver:latest
|
||||
container_name: suitecoffee-dbeaver
|
||||
depends_on:
|
||||
suitecoffee-tenants:
|
||||
condition: service_healthy
|
||||
suitecoffee-db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8978:8978"
|
||||
volumes:
|
||||
- dbeaver_logs:/opt/cloudbeaver/logs
|
||||
- dbeaver_workspace:/opt/cloudbeaver/workspace
|
||||
networks:
|
||||
- suitecoffee-net
|
||||
|
||||
# suitecoffee-adminer:
|
||||
# image: adminer:latest
|
||||
# container_name: suitecoffee-adminer
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - "8080:8080"
|
||||
# depends_on:
|
||||
# suitecoffee-tenants:
|
||||
# condition: service_healthy
|
||||
# suitecoffee-db:
|
||||
# condition: service_healthy
|
||||
# networks:
|
||||
# - suitecoffee-net
|
||||
|
||||
volumes:
|
||||
tenants-data:
|
||||
suitecoffee-data:
|
||||
npm_data:
|
||||
npm_letsencrypt:
|
||||
dbeaver_logs:
|
||||
dbeaver_workspace:
|
||||
|
||||
networks:
|
||||
suitecoffee-net:
|
||||
driver: bridge
|
||||
@ -5,13 +5,14 @@ FROM node:20.17
|
||||
ARG NODE_ENV=development
|
||||
ARG PORT=3000
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copia archivos de configuración primero para aprovechar el cache
|
||||
COPY package*.json ./
|
||||
|
||||
# Instala dependencias
|
||||
RUN apt-get update
|
||||
RUN npm i
|
||||
RUN apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copia el resto de la app
|
||||
COPY . .
|
||||
|
||||
13
services/app/nodemon.json
Normal file
13
services/app/nodemon.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"ext": "js,json",
|
||||
"ignore": [
|
||||
"node_modules/**/node_modules",
|
||||
"node_modules/",
|
||||
".git"
|
||||
],
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"exec": "node ./src/index.js"
|
||||
}
|
||||
2
services/app/package-lock.json
generated
2
services/app/package-lock.json
generated
@ -241,6 +241,7 @@
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.0.0.tgz",
|
||||
"integrity": "sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@epic-web/invariant": "^1.0.0",
|
||||
"cross-spawn": "^7.0.6"
|
||||
@ -751,6 +752,7 @@
|
||||
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz",
|
||||
"integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.2",
|
||||
"debug": "^4",
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=production node ./src/index.js",
|
||||
"dev": "NODE_ENV=development node ./src/index.js",
|
||||
"dev": "npx nodemon",
|
||||
"test": "NODE_ENV=stage node ./src/index.js"
|
||||
},
|
||||
"author": "Mateo Saldain",
|
||||
@ -15,13 +15,13 @@
|
||||
"nodemon": "^3.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^5.3.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^17.2.1",
|
||||
"express": "^5.1.0",
|
||||
"express-ejs-layouts": "^2.5.1",
|
||||
"pg": "^8.16.3",
|
||||
"chalk": "^5.3.0",
|
||||
"pg-format": "^1.0.4"
|
||||
"pg-format": "^1.0.4"
|
||||
},
|
||||
"keywords": [],
|
||||
"description": ""
|
||||
|
||||
@ -5,13 +5,14 @@ FROM node:20.17
|
||||
ARG NODE_ENV=development
|
||||
ARG PORT=4000
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copia archivos de configuración primero para aprovechar el cache
|
||||
COPY package*.json ./
|
||||
|
||||
# Instala dependencias
|
||||
RUN apt-get update
|
||||
RUN npm i
|
||||
RUN apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copia el resto de la app
|
||||
COPY . .
|
||||
|
||||
13
services/auth/nodemon.json
Normal file
13
services/auth/nodemon.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"ext": "js,json",
|
||||
"ignore": [
|
||||
"node_modules/**/node_modules",
|
||||
"node_modules/",
|
||||
".git"
|
||||
],
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"exec": "node ./src/index.js"
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=production node ./src/index.js",
|
||||
"dev": "NODE_ENV=development node ./src/index.js",
|
||||
"dev": "npx nodemon",
|
||||
"test": "NODE_ENV=stage node ./src/index.js"
|
||||
},
|
||||
"author": "Mateo Saldain",
|
||||
@ -15,14 +15,14 @@
|
||||
"nodemon": "^3.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcrypt": "^5.1.1",
|
||||
"chalk": "^5.3.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^17.2.1",
|
||||
"express": "^5.1.0",
|
||||
"express-ejs-layouts": "^2.5.1",
|
||||
"pg": "^8.16.3",
|
||||
"bcrypt": "^5.1.1",
|
||||
"chalk": "^5.3.0",
|
||||
"pg-format": "^1.0.4"
|
||||
"pg-format": "^1.0.4"
|
||||
},
|
||||
"keywords": [],
|
||||
"description": ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user