muzick: nginx proxy Bearer auth, restart policies, env subst

This commit is contained in:
kami
2026-07-14 15:51:10 +04:00
parent 5bb2f00213
commit 3bc9f2d303
3 changed files with 29 additions and 5 deletions
+8 -3
View File
@@ -16,15 +16,16 @@ services:
image: typesense/typesense:0.25.1 image: typesense/typesense:0.25.1
restart: always restart: always
ports: ports:
- "8108:8108" - "127.0.0.1:8108:8108"
volumes: volumes:
- ./data/typesense:/data - ./data/typesense:/data
command: --data-dir /data --api-key=${TYPESENSE_API_KEY} command: --data-dir /data --api-key=${TYPESENSE_API_KEY}
backend: backend:
build: ./backend build: ./backend
restart: unless-stopped
ports: ports:
- "3000:3000" - "127.0.0.1:3000:3000"
environment: environment:
DATABASE_URL: postgresql://user:${DB_PASSWORD}@db:5432/muzick DATABASE_URL: postgresql://user:${DB_PASSWORD}@db:5432/muzick
REDIS_URL: redis://:${REDIS_PASSWORD}@infra-redis:6379 REDIS_URL: redis://:${REDIS_PASSWORD}@infra-redis:6379
@@ -43,13 +44,17 @@ services:
frontend: frontend:
build: ./frontend build: ./frontend
restart: unless-stopped
ports: ports:
- "5174:80" - "127.0.0.1:5174:80"
environment:
MUZICK_API_KEY: ${MUZICK_API_KEY}
depends_on: depends_on:
- backend - backend
worker: worker:
build: ./workers build: ./workers
restart: unless-stopped
network_mode: host network_mode: host
environment: environment:
DATABASE_URL: postgresql://user:${DB_PASSWORD}@127.0.0.1:5432/muzick DATABASE_URL: postgresql://user:${DB_PASSWORD}@127.0.0.1:5432/muzick
+2 -2
View File
@@ -7,6 +7,6 @@ RUN npm run build
FROM nginx:stable-alpine FROM nginx:stable-alpine
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf.template /etc/nginx/templates/default.conf.template
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["/bin/sh", "-c", "envsubst '${MUZICK_API_KEY}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
+19
View File
@@ -0,0 +1,19 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://backend:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header Authorization "Bearer ${MUZICK_API_KEY}";
proxy_cache_bypass $http_upgrade;
}
}