compose and nginx

This commit is contained in:
ntr committed 2022-08-30 19:25:36 +10:00
1 parent 44c83d3b33
commit 2804477601
7 files changed
+123 -43

No files matched your search

+1 -2
View File
@@ -1,4 +1,3 @@
# TODO
sign up user
add want without discogs
get mcrates.au up
+1 -1
View File
@@ -15,7 +15,7 @@ declare module 'axios' {
}
const api = axios.create({
baseURL: 'http://localhost:41337',
baseURL: '/api',
withCredentials: true
});
+35
View File
@@ -0,0 +1,35 @@
version: "3.3"
services:
pg:
image: postgres:latest
environment:
POSTGRES_USER: 'mcrates'
POSTGRES_DB: 'mcrates'
POSTGRES_PASSWORD: 'digdeep'
volumes:
- "./db:/var/lib/postgresql/data"
api:
image: node:16
working_dir: /opt/mcrates/api
entrypoint: npm start
environment:
DATABASE_URL: 'postgresql://mcrates:digdeep@pg:5432/mcrates?schema=public'
volumes:
- "./api:/opt/mcrates/api"
client:
image: node:16
working_dir: /opt/mcrates/client
entrypoint: npm start
volumes:
- "./client:/opt/mcrates/client"
nginx:
image: nginx:latest
volumes:
- './nginx/localhost.nginx.conf:/etc/nginx/conf.d/default.conf'
- '/etc/letsencrypt'
ports:
- '80:80'
File renamed without changes.
+30 -25
View File
@@ -12,32 +12,37 @@ services:
volumes:
- "./db:/var/lib/postgresql/data"
pg-test:
image: postgres:latest
environment:
POSTGRES_USER: 'mcrates'
POSTGRES_DB: 'test'
POSTGRES_PASSWORD: 'digdeep'
ports:
- '55432:5432'
# api:
# image: node:16
# working_dir: /opt/mcrates/api
# entrypoint: npm start
# pg-test:
# image: postgres:latest
# environment:
# DATABASE_URL: 'postgresql://mcrates:digdeep@pg:5432/mcrates?schema=public'
# POSTGRES_USER: 'mcrates'
# POSTGRES_DB: 'test'# POSTGRES_PASSWORD: 'digdeep'
# ports:
# - '41337:41337'
# volumes:
# - "./api:/opt/mcrates/api"
# - '55432:5432'
# client:
# image: node:16
# working_dir: /opt/mcrates/client
# entrypoint: npm start
# ports:
# - '8080:8080'
# volumes:
# - "./client:/opt/mcrates/client"
api:
image: node:16
working_dir: /opt/mcrates/api
entrypoint: npm start
environment:
DATABASE_URL: 'postgresql://mcrates:digdeep@pg:5432/mcrates?schema=public'
ports:
- '41337:41337'
volumes:
- "./api:/opt/mcrates/api"
client:
image: node:16
working_dir: /opt/mcrates/client
entrypoint: npm start
ports:
- '8080:8080'
volumes:
- "./client:/opt/mcrates/client"
nginx:
image: nginx:latest
volumes:
- './nginx/localhost.nginx.conf:/etc/nginx/conf.d/default.conf'
ports:
- '80:80'
+37
View File
@@ -0,0 +1,37 @@
upstream mcrates_api {
server api:41337;
}
upstream mcrates_client {
server client:8080;
}
# upstream mcrates_ws {
# server 127.0.0.1:40055;
# }
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
location / {
proxy_pass http://mcrates_client;
proxy_read_timeout 600s;
}
# location /api/ws {
# proxy_pass http://mcrates_ws;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_read_timeout 600s;
# }
location /api/ {
# trailing slash means api will receive url WITHOUT /api
proxy_pass http://mcrates_api/;
proxy_read_timeout 600s;
}
}
@@ -1,11 +1,15 @@
upstream mcrates_http {
server 127.0.0.1:40080;
upstream mcrates_api {
server api:41337;
}
upstream mcrates_ws {
server 127.0.0.1:40055;
upstream mcrates_client {
server client:8080;
}
# upstream mcrates_ws {
# server 127.0.0.1:40055;
# }
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
@@ -22,21 +26,21 @@ server {
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
location / {
root /srv/mcrates/current;
index index.html;
try_files $uri $uri/ index.html;
}
location /api/ws {
proxy_pass http://mcrates_ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://mcrates_client;
proxy_read_timeout 600s;
}
# location /api/ws {
# proxy_pass http://mcrates_ws;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_read_timeout 600s;
# }
location /api/ {
proxy_pass http://mcrates_http;
# trailing slash means api will receive url WITHOUT /api
proxy_pass http://mcrates_api/;
proxy_read_timeout 600s;
}