mirror of
https://github.com/robonen/canvas-3d.git
synced 2026-03-20 02:44:40 +00:00
feat(repo): two application replicas in docker-compose
This commit is contained in:
11
.env.example
11
.env.example
@@ -1 +1,10 @@
|
|||||||
NUXT_API_HOST=https://localhost
|
# Infrastucture config
|
||||||
|
FORWARD_APP_PORT=3000
|
||||||
|
|
||||||
|
FORWARD_DB_PORT=5432
|
||||||
|
DB_USERNAME=postgres
|
||||||
|
DB_PASSWORD=password
|
||||||
|
DB_DATABASE=c3d
|
||||||
|
|
||||||
|
# App config
|
||||||
|
NUXT_API_HOST=http://app
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ FROM node:${NODE_VERSION} AS builder
|
|||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
|
# See .dockerignore
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm cache clean --force && npm ci && npm run build
|
RUN npm cache clean --force && npm ci && npm run build
|
||||||
@@ -19,7 +20,6 @@ COPY --from=builder /build/src/.output .
|
|||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|
||||||
VOLUME /app
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["node", "./server/index.mjs"]
|
ENTRYPOINT ["node", "./server/index.mjs"]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
|
# Default docker DNS
|
||||||
resolver 127.0.0.11 ipv6=off valid=10s;
|
resolver 127.0.0.11 ipv6=off valid=10s;
|
||||||
|
|
||||||
# . files
|
# . files
|
||||||
@@ -2,26 +2,31 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
proxy:
|
proxy_lb:
|
||||||
container_name: proxy
|
container_name: proxy_lb
|
||||||
image: nginx:latest
|
image: nginx:latest
|
||||||
ports:
|
ports:
|
||||||
- '${PROXY_PORT:-80}:80'
|
- '${PROXY_PORT:-80}:80'
|
||||||
- '${PROXY_PORT_SSL:-443}:443'
|
- '${PROXY_PORT_SSL:-443}:443'
|
||||||
volumes:
|
volumes:
|
||||||
- './config/nginx/proxy.conf:/etc/nginx/conf.d/default.conf'
|
- './config/nginx/proxy_lb.conf:/etc/nginx/conf.d/default.conf'
|
||||||
networks:
|
networks:
|
||||||
- c3d_net
|
- c3d_net
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
|
|
||||||
app:
|
app:
|
||||||
container_name: app
|
# container_name: app
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
deploy:
|
||||||
- '${FORWARD_APP_PORT:-3000}:3000'
|
mode: replicated
|
||||||
|
replicas: 2
|
||||||
|
expose:
|
||||||
|
- '${FORWARD_APP_PORT:-3000}'
|
||||||
|
# ports:
|
||||||
|
# - '${FORWARD_APP_PORT:-3000}:3000'
|
||||||
networks:
|
networks:
|
||||||
- c3d_net
|
- c3d_net
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
{
|
{
|
||||||
|
"name": "canvas3d",
|
||||||
|
"description": "Web application for affine transformations of three-dimensional figures",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/robonen/canvas-3d/issues?q=is:open is:issue label:bug"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
|
|||||||
9
src/server/api/test.ts
Normal file
9
src/server/api/test.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import {defineEventHandler} from 'h3';
|
||||||
|
|
||||||
|
export default defineEventHandler((event) => {
|
||||||
|
console.log('Request received');
|
||||||
|
|
||||||
|
return {
|
||||||
|
api: 'works',
|
||||||
|
};
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user