Subdomain branch: the gallery and maps addresses are read per request, as on the Plugin Studio branch
dx-base's three commits from research-gallery-plugin-studio (the runtime loader, check:origins and its lint pass) apply here unchanged: the code is byte-identical to that branch. What differs is what the two settings point at on this route. The Research Gallery is the research site the team's dx-maps container serves, and the maps load from the container's published tree, which the research subdomain serves at /dx-maps (the Studio's host serves the same tree at /cdn/dx-maps; both send CORS). The comments, .env.example and DX-MAPS-GALLERY.md now say so, with this route's laptop values (research.localhost:4615, as compose.laptop.yaml already sets). DX-MAPS-GALLERY.md's "Run it" said no .env is needed for /research. That stopped being true when the default maps host was removed, so it now names the one setting the maps need. check:origins: 15 problems on research-gallery-subdomain before, PASS (306 files) after.
This commit is contained in:
parent
bdac891e90
commit
fa3591ca9b
7 changed files with 45 additions and 35 deletions
18
.env.example
18
.env.example
|
|
@ -37,21 +37,23 @@ MOBILE_APP_ANDROID_PACKAGE=life.doxa.pray
|
|||
# Mapbox (used by the prayer map on /pray)
|
||||
NUXT_PUBLIC_MAPBOX_TOKEN=your-mapbox-public-token
|
||||
|
||||
# The plugin-studio branch's two addresses, per deployment. Both are REQUIRED, and both are read by the
|
||||
# The subdomain branch's two addresses, per deployment. Both are REQUIRED, and both are read by the
|
||||
# server at REQUEST time (server/utils/dx-runtime.ts). They are never baked into a build, so one build
|
||||
# serves any deployment. Changing them needs a restart, not a rebuild. There is no default host: when
|
||||
# one is unset, the pages that need it say which setting is missing.
|
||||
#
|
||||
# The Research Gallery: the public Plugin Studio on its own subdomain. The menu's Research item, every
|
||||
# in-page gallery link and the /regions index go here (through this site's /research-gallery).
|
||||
# The Research Gallery: the research site on its own subdomain, served by the team's dx-maps container.
|
||||
# The menu's Research item, every in-page gallery link and the /regions index go here (through this
|
||||
# site's /research-gallery).
|
||||
# VPS: NUXT_PUBLIC_RESEARCH_GALLERY_URL=https://research.<host>/
|
||||
# laptop: NUXT_PUBLIC_RESEARCH_GALLERY_URL=http://research.localhost:4616/
|
||||
# laptop: NUXT_PUBLIC_RESEARCH_GALLERY_URL=http://research.localhost:4615/
|
||||
NUXT_PUBLIC_RESEARCH_GALLERY_URL=
|
||||
#
|
||||
# The dx-maps tree this site's maps load from: that subdomain's published /cdn. It must send
|
||||
# Access-Control-Allow-Origin for the tree (the container does).
|
||||
# VPS: NUXT_PUBLIC_DX_MAPS_BASE=https://research.<host>/cdn/dx-maps
|
||||
# laptop: NUXT_PUBLIC_DX_MAPS_BASE=http://research.localhost:4616/cdn/dx-maps
|
||||
# The dx-maps tree this site's maps load from: the container's published tree, which the research
|
||||
# subdomain serves at /dx-maps. It must send Access-Control-Allow-Origin for the tree (the container
|
||||
# does). The Studio's own host serves the same tree at /cdn/dx-maps.
|
||||
# VPS: NUXT_PUBLIC_DX_MAPS_BASE=https://research.<host>/dx-maps
|
||||
# laptop: NUXT_PUBLIC_DX_MAPS_BASE=http://research.localhost:4615/dx-maps
|
||||
NUXT_PUBLIC_DX_MAPS_BASE=
|
||||
|
||||
# Cloudflare Turnstile
|
||||
|
|
|
|||
|
|
@ -43,28 +43,34 @@ bun install
|
|||
bun run dev
|
||||
```
|
||||
|
||||
Then open <http://localhost:3000/research/> (Nuxt prints the port if 3000 is taken). No database
|
||||
or `.env` is needed for this page. Without `DATABASE_URL`, the dev server only logs
|
||||
"skipping migrations".
|
||||
Then open <http://localhost:3000/research/> (Nuxt prints the port if 3000 is taken). The maps need
|
||||
one setting, the published tree they load from: `NUXT_PUBLIC_DX_MAPS_BASE` (see *Deployment method*
|
||||
below; any published tree works, for example `https://research.<host>/dx-maps`). Without it, each map
|
||||
says which setting is missing. No database is needed for this page: without `DATABASE_URL`, the dev
|
||||
server only logs "skipping migrations".
|
||||
|
||||
- Arabic: <http://localhost:3000/ar/research/>
|
||||
- Open a specific view: `/research/?tab=prayer-map` (also `research-map-plus-grid`,
|
||||
`regions-dashboard`, `upg-100`, and so on).
|
||||
- Share and embed links in the maps point at this site's own `/dx-maps/` pages.
|
||||
- To run it against a **local** dx-maps, and to try all three ways a site can take the gallery (drop-in,
|
||||
CDN, subdomain) with the exact ports and settings: [documentation/LAPTOP-6WAY.md](documentation/LAPTOP-6WAY.md).
|
||||
- To run it against a **local** dx-maps, and to try both ways a site can take the gallery (drop-in and
|
||||
subdomain) with the exact ports and settings: [documentation/LAPTOP-6WAY.md](documentation/LAPTOP-6WAY.md).
|
||||
|
||||
## Deployment method: the Research Gallery as the public Plugin Studio (this branch, research-gallery-plugin-studio)
|
||||
## Deployment method: the Research Gallery on its own subdomain (this branch, research-gallery-subdomain)
|
||||
|
||||
The research subdomain runs the dx-maps container in its public mode: the **Plugin Studio**, open to
|
||||
everyone, with every research map, dashboard and list, and its published `/cdn` of production maps.
|
||||
This site sends readers there and loads its own maps from there. Each deployment sets two addresses,
|
||||
read by the server at **request time** and never baked into a build:
|
||||
The research subdomain is the **research site**, served by the team's dx-maps container (the same
|
||||
container runs the signed-in Plugin Studio and PocketBase, and publishes the maps). It carries every
|
||||
research map, dashboard and list. This site sends readers there and loads its own maps from the
|
||||
container's published tree. Each deployment sets two addresses, read by the server at **request
|
||||
time** and never baked into a build:
|
||||
|
||||
| Setting | What it is | VPS | Laptop |
|
||||
|---|---|---|---|
|
||||
| `NUXT_PUBLIC_RESEARCH_GALLERY_URL` | the public Plugin Studio | `https://research.<host>/` | `http://research.localhost:4616/` |
|
||||
| `NUXT_PUBLIC_DX_MAPS_BASE` | its published tree, where this site's maps load from | `https://research.<host>/cdn/dx-maps` | `http://research.localhost:4616/cdn/dx-maps` |
|
||||
| `NUXT_PUBLIC_RESEARCH_GALLERY_URL` | the research site | `https://research.<host>/` | `http://research.localhost:4615/` |
|
||||
| `NUXT_PUBLIC_DX_MAPS_BASE` | the container's published tree, where this site's maps load from | `https://research.<host>/dx-maps` | `http://research.localhost:4615/dx-maps` |
|
||||
|
||||
The research subdomain serves the published tree at `/dx-maps`, and the Studio's own host serves the
|
||||
same tree at `/cdn/dx-maps`. Either works; both send CORS for it.
|
||||
|
||||
**Why request time.** About 4,000 pages are prerendered, and a prerendered page carries the build's
|
||||
runtime config. An address read there would be baked into the build, which is how the CDN branch
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const MAPBOX_JS = 'https://api.mapbox.com/mapbox-gl-js/v3.24.0/mapbox-gl.js'
|
|||
const MAPBOX_GEOCODER_JS = 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.min.js'
|
||||
|
||||
// Map of bundle keys → bundles in the dx-maps build tree: the deployment's NUXT_PUBLIC_DX_MAPS_BASE (the
|
||||
// public Plugin Studio's /cdn), asked from this site's server at runtime (loadDxRuntime) because a
|
||||
// team container's published tree), asked from this site's server at runtime (loadDxRuntime) because a
|
||||
// prerendered page cannot carry it. Each bundle registers its own custom element (<doxa-map>,
|
||||
// <doxa-research-map>).
|
||||
const BUNDLES = {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// The Research Gallery lives on its own subdomain (the public Plugin Studio), so every link that
|
||||
// went to this site's /research or /regions page goes there instead. The link is this site's own
|
||||
// /research-gallery, which the server redirects to the deployment's gallery
|
||||
// (NUXT_PUBLIC_RESEARCH_GALLERY_URL, server/routes/research-gallery.get.ts). A prerendered page
|
||||
// therefore names no deployment's host. A view opens with ?tab=<view id> (for example
|
||||
// The Research Gallery lives on its own subdomain (the research site, served by the team's dx-maps
|
||||
// container), so every link that went to this site's /research or /regions page goes there instead.
|
||||
// The link is this site's own /research-gallery, which the server redirects to the deployment's
|
||||
// gallery (NUXT_PUBLIC_RESEARCH_GALLERY_URL, server/routes/research-gallery.get.ts). A prerendered
|
||||
// page therefore names no deployment's host. A view opens with ?tab=<view id> (for example
|
||||
// 'regions-dashboard'). The reader's language travels as ?lang=<locale>, since the gallery lays
|
||||
// Arabic out right-to-left and an Arabic reader should not land on the English gallery. The
|
||||
// /research and /regions detail pages are kept; nothing links to them any more.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
// SHOW_LEGACY_RESEARCH, so the previous page returns by flipping one constant.
|
||||
//
|
||||
// The gallery is a web component served from the deployment's dx-maps tree (NUXT_PUBLIC_DX_MAPS_BASE,
|
||||
// the public Plugin Studio's /cdn), asked from this site's server at runtime: this page is prerendered,
|
||||
// the team container's published tree), asked from this site's server at runtime: this page is prerendered,
|
||||
// and a prerendered page cannot carry a deployment's address. It reads its manifest and every child map
|
||||
// from the same tree. The menu's Research item goes to the gallery's own subdomain instead; this page
|
||||
// is kept, unlinked. See DX-MAPS-GALLERY.md at the repo root.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bun
|
||||
// check-runtime-origins: no deployment's address is baked into this site.
|
||||
//
|
||||
// The plugin-studio branch sends readers to the Research Gallery and loads its maps from the gallery's
|
||||
// /cdn. Both addresses differ per deployment, so the server reads them at REQUEST time
|
||||
// This site sends readers to the Research Gallery and loads its maps from the tree the gallery's
|
||||
// subdomain publishes. Both addresses differ per deployment, so the server reads them at REQUEST time
|
||||
// (server/utils/dx-runtime.ts), and pages ask /api/dx-runtime or link through /research-gallery. About
|
||||
// 4,000 pages are prerendered, and a prerendered page carries the build's config. An address that
|
||||
// reaches nuxt.config's runtimeConfig, or a page, is baked into the build, which is how the CDN branch
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
/**
|
||||
* The two per-deployment addresses of the plugin-studio branch, read from the server's environment
|
||||
* The two per-deployment addresses of the subdomain branch, read from the server's environment
|
||||
* at REQUEST time:
|
||||
*
|
||||
* NUXT_PUBLIC_RESEARCH_GALLERY_URL the Research Gallery: the public Plugin Studio on its own
|
||||
* subdomain (https://research.<host>/). The Research menu item,
|
||||
* every in-page gallery link and the /regions index go there.
|
||||
* NUXT_PUBLIC_DX_MAPS_BASE the dx-maps tree this site's maps load from: that subdomain's
|
||||
* published /cdn (https://research.<host>/cdn/dx-maps).
|
||||
* NUXT_PUBLIC_RESEARCH_GALLERY_URL the Research Gallery: the research site on its own subdomain,
|
||||
* served by the team's dx-maps container
|
||||
* (https://research.<host>/). The Research menu item, every
|
||||
* in-page gallery link and the /regions index go there.
|
||||
* NUXT_PUBLIC_DX_MAPS_BASE the dx-maps tree this site's maps load from: the container's
|
||||
* published tree, which that subdomain serves at /dx-maps
|
||||
* (https://research.<host>/dx-maps).
|
||||
*
|
||||
* Why not runtimeConfig.public: about 4,000 pages are PRERENDERED at build time, and a prerendered
|
||||
* page carries the build's runtime config in its payload. An address read there is baked into the
|
||||
|
|
|
|||
Loading…
Reference in a new issue