deploy code 2

This commit is contained in:
NishantRajputRN
2026-05-19 18:12:24 +05:30
parent 44d3f015fe
commit 554c873f5d
4 changed files with 20 additions and 11 deletions
+2
View File
@@ -1,5 +1,7 @@
FROM node:22-alpine FROM node:22-alpine
RUN apk add --no-cache curl
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
+2 -2
View File
@@ -53,7 +53,7 @@ app.get('/api/me', requireAccessToken, (req, res) => {
}); });
}); });
app.listen(port, () => { app.listen(port, '0.0.0.0', () => {
console.log(`API listening on http://localhost:${port}`); console.log(`API listening on http://0.0.0.0:${port}`);
console.log(`OIDC issuer: ${oidcIssuer}`); console.log(`OIDC issuer: ${oidcIssuer}`);
}); });
+9
View File
@@ -86,6 +86,15 @@ sudo ufw allow 3001/tcp
docker compose --env-file .env up -d --build docker compose --env-file .env up -d --build
``` ```
If the API container is unhealthy, check logs:
```bash
docker compose --env-file .env logs api
docker compose --env-file .env ps
```
Rebuild after changes: `docker compose --env-file .env up -d --build api`
Verify: Verify:
```bash ```bash
+7 -9
View File
@@ -7,6 +7,8 @@ services:
context: ../backend context: ../backend
dockerfile: Dockerfile dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
env_file:
- .env
environment: environment:
PORT: 3001 PORT: 3001
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost} CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost}
@@ -17,15 +19,11 @@ services:
ports: ports:
- "${API_PORT:-3001}:3001" - "${API_PORT:-3001}:3001"
healthcheck: healthcheck:
test: test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3001/health"]
[ interval: 10s
"CMD-SHELL",
"node -e \"fetch('http://127.0.0.1:3001/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\"",
]
interval: 30s
timeout: 5s timeout: 5s
retries: 3 retries: 5
start_period: 10s start_period: 40s
web: web:
build: build:
@@ -41,4 +39,4 @@ services:
- "${WEB_PORT:-80}:80" - "${WEB_PORT:-80}:80"
depends_on: depends_on:
api: api:
condition: service_healthy condition: service_started