diff --git a/docker/prod/server.Dockerfile b/docker/prod/server.Dockerfile index 7341b1e9b..8be8200ee 100755 --- a/docker/prod/server.Dockerfile +++ b/docker/prod/server.Dockerfile @@ -17,6 +17,8 @@ COPY ./server ./ RUN npm run build +RUN cp -r src/templates dist/templates + EXPOSE 52345 CMD ["node", "dist/index.js"] \ No newline at end of file diff --git a/docker/staging/server.Dockerfile b/docker/staging/server.Dockerfile index 7341b1e9b..8be8200ee 100755 --- a/docker/staging/server.Dockerfile +++ b/docker/staging/server.Dockerfile @@ -17,6 +17,8 @@ COPY ./server ./ RUN npm run build +RUN cp -r src/templates dist/templates + EXPOSE 52345 CMD ["node", "dist/index.js"] \ No newline at end of file diff --git a/docker/unified/docker-compose.yaml b/docker/unified/docker-compose.yaml index 01fab5529..785007e3f 100755 --- a/docker/unified/docker-compose.yaml +++ b/docker/unified/docker-compose.yaml @@ -1,4 +1,5 @@ services: + #Gateway gateway: image: nginx:1.27.1-alpine container_name: checkmate-gateway @@ -9,6 +10,7 @@ services: volumes: - /etc/letsencrypt:/etc/nginx/ssl:ro - ./gateway/nginx.conf:/etc/nginx/conf.d/default.conf:ro + # Production ----- client-prod: image: ghcr.io/bluewave-labs/checkmate:frontend-demo restart: always @@ -47,3 +49,54 @@ services: start_period: 0s start_interval: 1s retries: 30 + + # Staging ----- + client-staging: + image: ghcr.io/bluewave-labs/checkmate:frontend-staging + restart: always + environment: + UPTIME_APP_API_BASE_URL: "https://staging.checkmate.so/api/v1" + UPTIME_APP_CLIENT_HOST: "https://staging.checkmate.so" + expose: + - "80" + depends_on: + - server-staging + volumes: + - ./nginx/conf.d/staging.conf:/etc/nginx/conf.d/default.conf:ro + server-staging: + image: ghcr.io/bluewave-labs/checkmate:backend-staging + restart: always + ports: + - "52345:52345" + env_file: + - server-staging.env + depends_on: + - mongodb-staging + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + mongodb-staging: + image: ghcr.io/bluewave-labs/checkmate:mongo-staging + restart: always + command: [ "mongod", "--quiet", "--bind_ip_all" ] + volumes: + - ./mongo/data-staging:/data/db + env_file: + - mongo-staging.env + healthcheck: + test: [ "CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet" ] + interval: 5s + timeout: 30s + start_period: 0s + start_interval: 1s + retries: 30 + capture: + image: ghcr.io/bluewave-labs/capture:latest + container_name: capture + restart: unless-stopped + ports: + - "59232:59232" + environment: + - API_SECRET=my_secret + - GIN_MODE=release + volumes: + - /etc/os-release:/etc/os-release:ro diff --git a/docker/unified/nginx/conf.d/staging.conf b/docker/unified/nginx/conf.d/staging.conf new file mode 100755 index 000000000..6b640a06b --- /dev/null +++ b/docker/unified/nginx/conf.d/staging.conf @@ -0,0 +1,31 @@ +server { + listen 80; + listen [::]:80; + + server_name _; + server_tokens off; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://server-staging:52345/api/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /api-docs/ { + proxy_pass http://server-staging:52345/api-docs/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} \ No newline at end of file