wait in correct system, serve admin via mini webserver also

This commit is contained in:
einhornimmond 2025-04-29 13:26:43 +02:00
parent c9e17ce720
commit 535e76bfef
5 changed files with 39 additions and 69 deletions

View File

@ -20,7 +20,7 @@ jobs:
run: |
sudo chown runner:docker -R *
bun install
sudo cp ./nginx/gradido.conf /etc/nginx/sites-available/default
sudo cp ./nginx/e2e-test.conf /etc/nginx/sites-available/default
- name: wait for database to be ready
run: docker run --rm --network gradido_internal-net busybox sh -c 'until nc -z mariadb 3306; do echo waiting for db; sleep 1; done;'
@ -45,8 +45,8 @@ jobs:
- name: wait for frontend and backend to be ready
run: |
docker run --rm --network gradido_internal-net busybox sh -c 'until nc -z 127.0.0.1 3000; do echo waiting for frontend; sleep 1; done;'
docker run --rm --network gradido_internal-net busybox sh -c 'until nc -z 127.0.0.1 4000; do echo waiting for backend; sleep 1; done;'
until nc -z 127.0.0.1 3000; do echo waiting for frontend; sleep 1; done;
until nc -z 127.0.0.1 4000; do echo waiting for backend; sleep 1; done;
- name: Start local nginx webserver
run: |
@ -54,7 +54,7 @@ jobs:
sudo systemctl start nginx
- name: wait for nginx to be ready
run: docker run --rm --network gradido_internal-net busybox sh -c 'until nc -z 127.0.0.1 80; do echo waiting for nginx; sleep 1; done;'
run: until nc -z 127.0.0.1 80; do echo waiting for nginx; sleep 1; done;
- name: End-to-end tests | run tests
id: e2e-tests

View File

@ -90,14 +90,10 @@ CMD /bin/sh -c "turbo admin#test --env-mode=loose"
##################################################################################
# PRODUCTION (Does contain only "binary"- and static-files to reduce image size) #
##################################################################################
FROM nginx:alpine as production
FROM lipanski/docker-static-website:latest as production
# TODO: Improve size from 50 MB down to 2 MB with lipanski/docker-static-website:latest
# https://lipanski.com/posts/smallest-docker-image-static-website
# copy builded frontend files
COPY --from=installer /app/admin/build/ /usr/share/nginx/html/
# copy nginx config
COPY nginx/serveAdmin.conf /etc/nginx/conf.d/default.conf
COPY --from=installer /app/admin/build/ ./admin/

33
nginx/e2e-test.conf Normal file
View File

@ -0,0 +1,33 @@
server {
server_name _;
listen 80;
listen [::]:80;
# Frontend (default)
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
}
# Backend
location /graphql {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:4000;
proxy_redirect off;
}
}

View File

@ -1,30 +0,0 @@
server {
listen 80;
server_name localhost;
gzip_static on;
gzip on;
gzip_proxied any;
gzip_types
text/css
text/javascript
text/xml
text/plain
application/javascript
application/x-javascript
application/json;
root /usr/share/nginx/html;
index index.html;
location / {
#limit_req zone=frontend burst=40 nodelay;
#limit_conn addr 40;
root /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ /index.html = 404;
}
# Optional: CORS Header (vorsichtig, je nach Bedarf)
add_header Access-Control-Allow-Origin *;
}

View File

@ -1,29 +0,0 @@
server {
listen 80;
server_name localhost;
gzip_static on;
gzip on;
gzip_proxied any;
gzip_types
text/css
text/javascript
text/xml
text/plain
application/javascript
application/x-javascript
application/json;
location /admin {
#limit_req zone=frontend burst=30 nodelay;
#limit_conn addr 40;
rewrite ^/admin/(.*)$ /$1 break;
root /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ /index.html = 404;
}
# Optional: CORS Header (vorsichtig, je nach Bedarf)
add_header Access-Control-Allow-Origin *;
}