diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index 7c3c33c..5323670 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -65,7 +65,8 @@ # Ensure remote path exists before scp ssh -p "$PORT" "$DEPLOY_USER@$HOST" "mkdir -p $REMOTE_ENV_PATH" scp -P "$PORT" docker-compose.yml "$DEPLOY_USER@$HOST:$REMOTE_ENV_PATH/docker-compose.yml" - + scp -P "$PORT" nginx.conf "$DEPLOY_USER@$HOST:$REMOTE_ENV_PATH/nginx.conf" + echo "Deploying DEMO on $HOST" ssh -p "$PORT" "$DEPLOY_USER@$HOST" " cd $REMOTE_ENV_PATH diff --git a/docker-compose.yml b/docker-compose.yml index 4201b46..789eea3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,12 @@ services: + reverse-proxy: + image: nginx:latest + container_name: demo-nginx-proxy + ports: + - "25700:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + gateway: image: registry.boomlab.party/rheinsw/demo-websites/main-website container_name: main-website @@ -10,5 +18,5 @@ services: image: registry.boomlab.party/rheinsw/demo-websites/ld1 container_name: ld1 ports: - - "25601:8080" + - "25601:3000" restart: on-failure diff --git a/lawfirm-demos/demo-1/next.config.ts b/lawfirm-demos/demo-1/next.config.ts index e9ffa30..587b7df 100644 --- a/lawfirm-demos/demo-1/next.config.ts +++ b/lawfirm-demos/demo-1/next.config.ts @@ -1,7 +1,11 @@ -import type { NextConfig } from "next"; +import type {NextConfig} from "next"; + +const isProd = process.env.NODE_ENV === 'production'; const nextConfig: NextConfig = { - /* config options here */ + output: 'standalone', + basePath: isProd ? '/lawfirm-demos/demo1' : '', + assetPrefix: isProd ? '/lawfirm-demos/demo1' : '', }; export default nextConfig; diff --git a/main-website/app/data/demos.ts b/main-website/app/data/demos.ts index 159cfde..756ae39 100644 --- a/main-website/app/data/demos.ts +++ b/main-website/app/data/demos.ts @@ -1,10 +1,14 @@ +// Base URL +const BASE_URL = process.env.NEXT_PUBLIC_DEMO_BASE_URL ?? 'http://localhost'; +const isProd = process.env.NODE_ENV === 'production'; + export const demoCategories = [ { label: 'Anwaltskanzlei', items: [ { name: 'Anwaltskanzlei Demo 1', - url: 'http://localhost:5101', + url: isProd ? '/lawfirm-demos/demo1/' : `${BASE_URL}:25601`, preview: '/previews/lawfirm-1.png', description: [ 'Modernes Design', @@ -14,7 +18,7 @@ export const demoCategories = [ }, { name: 'Anwaltskanzlei Demo 2', - url: 'http://localhost:5101', + url: isProd ? '/lawfirm-demos/demo2/' : `${BASE_URL}:25602`, preview: '/previews/lawfirm-1.png', description: [ 'Modernes Design', @@ -30,7 +34,7 @@ export const demoCategories = [ items: [ { name: 'SaaS Landing Page', - url: 'http://localhost:5201', + url: isProd ? '/lawfirm-demos/demo2/' : `${BASE_URL}:25801`, preview: '/previews/saas-1.png', description: [ 'Klares und minimales UI', diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..9312eb6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,34 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + + location / { + proxy_pass http://main-website:3000; + 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 /lawfirm-demos/demo1/ { + proxy_pass http://ld1:8080/; + 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; + } + + # Add more locations as needed for other demos + } +}