mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
switch uvicorn and nginx to communicate via unix socket instead of tcp
This commit is contained in:
@@ -6,7 +6,7 @@ RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
# Setup frontend
|
||||
FROM nginx:1.24-alpine3.17 as production-stage
|
||||
FROM nginx:1.24-alpine3.17-slim as production-stage
|
||||
ARG WEBSERVER_FOLDER=/var/www/html
|
||||
COPY --from=front-build-stage /front/dist ${WEBSERVER_FOLDER}
|
||||
COPY ./frontend/assets/default_avatar.png ${WEBSERVER_FOLDER}/assets/
|
||||
@@ -31,6 +31,6 @@ COPY ./docker/init_scripts/* /
|
||||
COPY ./docker/nginx/default.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Expose ports and start
|
||||
EXPOSE 80
|
||||
EXPOSE 8080
|
||||
WORKDIR /romm
|
||||
CMD ["/init"]
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run migrations and start uvicorn
|
||||
#/init_back &
|
||||
/init_back &
|
||||
|
||||
# Start nginx
|
||||
/init_front &
|
||||
|
||||
# Start rq worker
|
||||
#/init_worker &
|
||||
/init_worker &
|
||||
|
||||
# Wait for any process to exit
|
||||
wait -n
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /back
|
||||
alembic upgrade head && uvicorn main:app --proxy-headers --host 0.0.0.0 --port 5000 --workers 2
|
||||
alembic upgrade head && uvicorn main:app --proxy-headers --host 0.0.0.0 --port 5000 --uds /tmp/uvicorn.sock --workers 2
|
||||
@@ -32,6 +32,10 @@ http {
|
||||
# include /etc/nginx/conf.d/*.conf;
|
||||
# include /etc/nginx/sites-enabled/*;
|
||||
|
||||
upstream uvicorn {
|
||||
server unix:/tmp/uvicorn.sock;
|
||||
}
|
||||
|
||||
server {
|
||||
root /var/www/html;
|
||||
listen 8080;
|
||||
@@ -49,16 +53,16 @@ http {
|
||||
|
||||
# OpenAPI for swagger and redoc
|
||||
location /openapi.json {
|
||||
proxy_pass http://localhost:5000;
|
||||
proxy_pass http://uvicorn;
|
||||
}
|
||||
|
||||
# Backend api calls
|
||||
location /api {
|
||||
rewrite /api/(.*) /$1 break;
|
||||
proxy_pass http://localhost:5000;
|
||||
proxy_pass http://uvicorn;
|
||||
}
|
||||
location /ws {
|
||||
proxy_pass http://localhost:5000;
|
||||
proxy_pass http://uvicorn;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
Reference in New Issue
Block a user