Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

help: Add production config for the new help center.

Shubham Padia246fbf6d2937
diff --git a/puppet/zulip/files/nginx/zulip-include-frontend/app b/puppet/zulip/files/nginx/zulip-include-frontend/app
index e3c85a30f00..48fb93760b3 100644
--- a/puppet/zulip/files/nginx/zulip-include-frontend/app
+++ b/puppet/zulip/files/nginx/zulip-include-frontend/app
@@ -27,6 +27,29 @@ location /static/ {
}
}
+# Serve help center generated by astro/starlight.
+location /help {
+ alias /home/zulip/deployments/current/starlight_help/dist/;
+ gzip on;
+ gzip_min_length 1000;
+ gzip_proxied expired no-cache no-store private auth;
+ gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+ include /etc/nginx/zulip-include/headers;
+ add_header Access-Control-Allow-Origin *;
+ add_header Timing-Allow-Origin *;
+
+ error_page 404 /404.html;
+ index /index.html;
+ try_files $uri $uri/index.html =404;
+}
+
+# These files are hashed and thus immutable; cache them aggressively.
+# https://github.com/withastro/docs/blob/53603ad048e8aedbca1aed77bac8eb00dcada79d/src/content/docs/en/guides/integrations-guide/node.mdx?plain=1#L304
+location /help/_astro/ {
+ alias /home/zulip/deployments/current/starlight_help/dist/_astro/;
+ add_header Cache-Control "public, max-age=31536000, immutable";
+}
+
# Send longpoll requests to Tornado
location /json/events {
if ($request_method = 'OPTIONS') {
diff --git a/starlight_help/package.json b/starlight_help/package.json
index e0d33a4ebd6..9a8c1ec28c5 100644
--- a/starlight_help/package.json
+++ b/starlight_help/package.json
@@ -26,7 +26,8 @@
"sharp": "^0.34.1",
"typescript": "^5.4.5",
"unist-util-visit": "^5.0.0",
- "unplugin-icons": "^22.1.0"
+ "unplugin-icons": "^22.1.0",
+ "@types/mdast": "^4.0.4"
},
"devDependencies": {
"remark-cli": "^12.0.1",
diff --git a/tools/update-prod-static b/tools/update-prod-static
index 61259b8ffde..45047c3f17e 100755
--- a/tools/update-prod-static
+++ b/tools/update-prod-static
@@ -46,10 +46,17 @@ run(["./tools/setup/build_timezone_values"])
# need them.
if settings.CORPORATE_ENABLED:
run(["./tools/setup/generate_landing_page_images.py"])
+ # We ideally should be generating two builds for Zulip cloud
+ # and serve a different one depending on whether the subdomain
+ # is same as the root domain or not.
+ run(["./tools/build-help-center", "--no-relative-links"])
+else:
+ run(["./tools/build-help-center"])
# Create webpack bundle
run(["./tools/webpack", "--quiet"])
+
# Collect the files that we're going to serve; this creates prod-static/serve.
run(["./manage.py", "collectstatic", "-v0", "--noinput"])