From 2277a1c0ac3e22fbf1222f12fdc34b2ab3c1394b Mon Sep 17 00:00:00 2001 From: naterfute Date: Wed, 2 Apr 2025 19:54:06 -0700 Subject: [PATCH] feat: added proxy to plane and fixed minor issues --- blueprints/plane/docker-compose.yml | 20 +++++++ blueprints/plane/template.toml | 91 ++++++++++++++++++++++++++++- 2 files changed, 109 insertions(+), 2 deletions(-) diff --git a/blueprints/plane/docker-compose.yml b/blueprints/plane/docker-compose.yml index 42628819..fbcbe392 100644 --- a/blueprints/plane/docker-compose.yml +++ b/blueprints/plane/docker-compose.yml @@ -165,6 +165,26 @@ services: env_file: - .env + nginx: + image: "nginx:1.27.4" + restart: unless-stopped + networks: + - dev_env + ports: + - ${NGINX_PORT}:80 + volumes: + - ../files/volumes/nginx/nginx.conf.template:/etc/nginx/conf.d/default.conf + env_file: + - .env + environment: + FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880} + BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads} + depends_on: + - web + - api + - space + - admin + volumes: redisdata: diff --git a/blueprints/plane/template.toml b/blueprints/plane/template.toml index bdf63835..311966c4 100644 --- a/blueprints/plane/template.toml +++ b/blueprints/plane/template.toml @@ -4,6 +4,7 @@ main_domain = "${domain}" [config] env = [ "Domain=${main_domain}", +"NGINX_PORT=80", "POSTGRES_USER=plane", "POSTGRES_PASSWORD=plane", "POSTGRES_DB=plane", @@ -30,6 +31,92 @@ env = [ mounts = [] [[config.domains]] -serviceName = "web" -port = 8065 +serviceName = "proxy" +port = 80 host = "${main_domain}" + + +[[config.mounts]] +filePath="volumes/nginx/nginx.conf.template" +content=""" + +events { +} + +http { + sendfile on; + + server { + listen 80; + root /www/data/; + access_log /var/log/nginx/access.log; + + client_max_body_size ${FILE_SIZE_LIMIT}; + + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "no-referrer-when-downgrade" always; + add_header Permissions-Policy "interest-cohort=()" always; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + add_header X-Forwarded-Proto "${dollar}scheme"; + add_header X-Forwarded-Host "${dollar}host"; + add_header X-Forwarded-For "${dollar}proxy_add_x_forwarded_for"; + add_header X-Real-IP "${dollar}remote_addr"; + + location / { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://web:3000/; + } + + location /api/ { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://api:8000/api/; + } + + location /auth/ { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://api:8000/auth/; + } + + location /god-mode/ { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://admin:3000/god-mode/; + } + + location /live/ { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://live:3000/live/; + } + + location /spaces/ { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://space:3000/spaces/; + } + + location /${BUCKET_NAME} { + proxy_http_version 1.1; + proxy_set_header Upgrade ${dollar}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host ${dollar}http_host; + proxy_pass http://plane-minio:9000/${BUCKET_NAME}; + } + } +} +""" \ No newline at end of file