diff --git a/apps/proxy/Caddyfile.aio.ce b/apps/proxy/Caddyfile.aio.ce new file mode 100644 index 0000000000..600b1b9d00 --- /dev/null +++ b/apps/proxy/Caddyfile.aio.ce @@ -0,0 +1,46 @@ +(plane_proxy) { + request_body { + max_size {$FILE_SIZE_LIMIT} + } + + handle /spaces/* { + reverse_proxy localhost:3002 + } + + handle /live/* { + reverse_proxy locahost:3005 + } + handle /api/* { + reverse_proxy localhost:3004 + } + + handle /auth/* { + reverse_proxy localhost:3004 + } + + handle_path /god-mode* { + root * /app/admin + try_files {path} {path}/ /index.html + file_server + } + handle_path /* { + root * /app/web + try_files {path} {path}/ /index.html + file_server + } +} + +{ + {$CERT_EMAIL} + acme_ca {$CERT_ACME_CA:https://acme-v02.api.letsencrypt.org/directory} + {$CERT_ACME_DNS} + servers { + max_header_size 25MB + client_ip_headers X-Forwarded-For X-Real-IP + trusted_proxies static {$TRUSTED_PROXIES:0.0.0.0/0} + } +} + +{$SITE_ADDRESS} { + import plane_proxy +} \ No newline at end of file diff --git a/deployments/aio/community/Dockerfile b/deployments/aio/community/Dockerfile index b217d09f8b..47e1227d97 100644 --- a/deployments/aio/community/Dockerfile +++ b/deployments/aio/community/Dockerfile @@ -31,14 +31,12 @@ COPY --from=node /usr/local/lib /usr/local/lib COPY --from=node /usr/local/include /usr/local/include COPY --from=node /usr/local/bin /usr/local/bin -COPY --from=web-img /app /app/web +COPY --from=web-img /usr/share/nginx/html /app/web COPY --from=space-img /app /app/space -COPY --from=admin-img /app /app/admin +COPY --from=admin-img /usr/share/nginx/html/god-mode /app/admin COPY --from=live-img /app /app/live -RUN rm -rf /app/web/apps/web/.next/cache && \ - rm -rf /app/space/apps/space/.next/cache && \ - rm -rf /app/admin/apps/admin/.next/cache +RUN rm -rf /app/space/apps/space/.next/cache COPY --from=proxy-img /usr/bin/caddy /usr/bin/caddy COPY dist/Caddyfile /app/proxy/Caddyfile diff --git a/deployments/aio/community/build.sh b/deployments/aio/community/build.sh index e69ac9a50b..5c9573a8be 100755 --- a/deployments/aio/community/build.sh +++ b/deployments/aio/community/build.sh @@ -95,7 +95,7 @@ update_env_file(){ build_dist_files(){ cp ./variables.env $DIST_DIR/plane.env - cp ../../../apps/proxy/Caddyfile.ce $DIST_DIR/Caddyfile + cp ../../../apps/proxy/Caddyfile.aio.ce $DIST_DIR/Caddyfile echo "" >> $DIST_DIR/plane.env echo "" >> $DIST_DIR/plane.env @@ -108,16 +108,6 @@ build_dist_files(){ update_env_file $DIST_DIR/plane.env "API_BASE_URL" "http://localhost:3004" update_env_file $DIST_DIR/plane.env "SITE_ADDRESS" ":80" - # remove this line containing `plane-minio:9000` - remove_line $DIST_DIR/Caddyfile "plane-minio:9000" "" - - # in caddyfile, update `reverse_proxy /spaces/* space:3000` to `reverse_proxy /spaces/* space:3002` - string_replace $DIST_DIR/Caddyfile "web:3000" "localhost:3001" - string_replace $DIST_DIR/Caddyfile "space:3000" "localhost:3002" - string_replace $DIST_DIR/Caddyfile "admin:3000" "localhost:3003" - string_replace $DIST_DIR/Caddyfile "api:8000" "localhost:3004" - string_replace $DIST_DIR/Caddyfile "live:3000" "localhost:3005" - # print docker build command echo "------------------------------------------------" diff --git a/deployments/aio/community/supervisor.conf b/deployments/aio/community/supervisor.conf index 5e1e4683e1..33b12985e4 100644 --- a/deployments/aio/community/supervisor.conf +++ b/deployments/aio/community/supervisor.conf @@ -17,20 +17,9 @@ stderr_logfile_backups=5 priority=10 -[program:web] -command=sh -c "node /app/web/apps/web/server.js" -autostart=true -autorestart=true -stdout_logfile=/app/logs/access/web.log -stderr_logfile=/app/logs/error/web.err.log -# stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=50MB -stderr_logfile_backups=5 -environment=PORT=3001,HOSTNAME=0.0.0.0 -priority=15 - [program:space] -command=sh -c "node /app/space/apps/space/server.js" +directory=/app/space/apps/space/build/server +command=sh -c "npx react-router-serve index.js" autostart=true autorestart=true stdout_logfile=/app/logs/access/space.log @@ -41,18 +30,6 @@ stderr_logfile_backups=5 environment=PORT=3002,HOSTNAME=0.0.0.0 priority=15 -[program:admin] -command=sh -c "node /app/admin/apps/admin/server.js" -autostart=true -autorestart=true -stdout_logfile=/app/logs/access/admin.log -stderr_logfile=/app/logs/error/admin.err.log -# stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=50MB -stderr_logfile_backups=5 -environment=PORT=3003,HOSTNAME=0.0.0.0 -priority=15 - [program:api] directory=/app/backend command=sh -c "./bin/docker-entrypoint-api.sh" @@ -96,7 +73,7 @@ priority=20 [program:live] -command=sh -c "node /app/live/apps/live/dist/start.js" +command=sh -c "node /app/live/apps/live" autostart=true autorestart=true stdout_logfile=/app/logs/access/live.log