From ac569cc9255c4cf294ad122233a191c0ccd645cc Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Mon, 4 Nov 2024 11:57:15 +0700 Subject: [PATCH] chore: add compose file --- docker-compose.yml | 39 +++++++++++++++++++++++++++++++ nginx.conf | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e6faaa6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +services: + app: + image: alswl/excalidraw:v0.17.3-fork-b1 + restart: unless-stopped + environment: + - VITE_APP_BACKEND_V2_GET_URL=/storage/api/v2/scenes/ + - VITE_APP_BACKEND_V2_POST_URL=/storage/api/v2/scenes/ + - VITE_APP_WS_SERVER_URL=/ + - VITE_APP_FIREBASE_CONFIG={} + - VITE_APP_HTTP_STORAGE_BACKEND_URL=/storage/api/v2 + - VITE_APP_STORAGE_BACKEND=http + - VITE_APP_DISABLE_TRACKING=true + - PUBLIC_URL= + expose: + - "80" + + storage: + image: alswl/excalidraw-storage-backend:v2023.11.11 + restart: unless-stopped + environment: + - STORAGE_URI=postgres://postgres:postgres@host.docker.internal:5432/excalidraw + extra_hosts: + - "host.docker.internal:host-gateway" + expose: + - "8080" + + room: + image: excalidraw/excalidraw-room:sha-49bf529 + restart: unless-stopped + expose: + - "80" + + nginx: + image: nginx:alpine + restart: unless-stopped + ports: + - "9012:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..9eef366 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,57 @@ +worker_processes auto; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + upstream app { + server app:80; + } + + upstream storage { + server storage:8080; + } + + upstream room { + server room:80; + } + + server { + listen 80; + server_name _; + + location / { + proxy_pass http://app; + 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 /storage/ { + rewrite ^/storage/(.*)$ /$1 break; + proxy_pass http://storage/; + 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 /socket.io/ { + proxy_pass http://room; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + 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; + } + } +}