fix(self-host): unbreak the Deploy to Cloudflare button and its build (#412)
This commit is contained in:
parent
7990c4db7f
commit
3a94f02a55
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -43,8 +43,6 @@ jobs:
|
||||
# worker's eager startup graph. See vite-plugin-lean-worker-bundle.ts.
|
||||
- name: Build worker (eager-bundle guard)
|
||||
run: pnpm vite build
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
|
||||
- name: Install website dependencies
|
||||
run: pnpm --dir web install --frozen-lockfile
|
||||
|
||||
2
.github/workflows/pr-preview.yml
vendored
2
.github/workflows/pr-preview.yml
vendored
@ -93,8 +93,6 @@ jobs:
|
||||
- name: Deploy preview stage
|
||||
if: github.event.action != 'closed'
|
||||
run: pnpm deploy:preview --stage "$STAGE" --yes
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
|
||||
# Fail the job (and skip the URL comment) if the deployed preview
|
||||
# answers without a Cloudflare Access login redirect. A definitive app
|
||||
|
||||
6
.npmrc
Normal file
6
.npmrc
Normal file
@ -0,0 +1,6 @@
|
||||
# The SSR vite build needs more than Node's ~2 GiB default heap. pnpm passes
|
||||
# this to every script via NODE_OPTIONS, which covers `pnpm run build` wherever
|
||||
# it runs — the Deploy to Cloudflare builder, self-hosters, and local checkouts
|
||||
# — without each environment having to remember to set it (CI and the Docker
|
||||
# image already did; this makes it universal).
|
||||
node-options=--max-old-space-size=4096
|
||||
@ -18,6 +18,7 @@ EXPOSE 3001
|
||||
# The build MUST run at container start, not image-build time: AUTH_MODE (and the
|
||||
# other client envs) are inlined into the client bundle by `vite build`, and the
|
||||
# self-hoster only chooses AUTH_MODE at runtime via Compose. Building here lets
|
||||
# that runtime value bake into the bundle. NODE_OPTIONS raises the V8 heap ceiling
|
||||
# so the SSR build of ~7400 modules doesn't OOM under Node's ~2GB default.
|
||||
CMD ["sh", "-c", "echo 'OpenSEO sends an anonymous usage heartbeat (counts only). Disable: OPENSEO_TELEMETRY_DISABLED=1. Details: docs/SELF_HOSTING_DOCKER.md#telemetry' && pnpm run db:migrate:local && NODE_OPTIONS=--max-old-space-size=4096 pnpm run build && pnpm exec vite preview --host 0.0.0.0 --port ${PORT:-3001}"]
|
||||
# that runtime value bake into the bundle. The repo .npmrc raises the V8 heap
|
||||
# ceiling (node-options) so the ~7400-module SSR build doesn't OOM under Node's
|
||||
# ~2GB default.
|
||||
CMD ["sh", "-c", "echo 'OpenSEO sends an anonymous usage heartbeat (counts only). Disable: OPENSEO_TELEMETRY_DISABLED=1. Details: docs/SELF_HOSTING_DOCKER.md#telemetry' && pnpm run db:migrate:local && pnpm run build && pnpm exec vite preview --host 0.0.0.0 --port ${PORT:-3001}"]
|
||||
|
||||
@ -62,12 +62,14 @@ provider flag there (not just in your shell):
|
||||
DATABASE_PROVIDER=postgres
|
||||
```
|
||||
|
||||
The connection string comes from the `HYPERDRIVE` binding: in local dev,
|
||||
miniflare resolves it to the `localConnectionString` committed in
|
||||
`wrangler.jsonc`, which already points at the Docker container from step 1.
|
||||
(In deployed Workers the same binding resolves to real Hyperdrive — the app
|
||||
never connects to Postgres except through this binding.) If your local Postgres
|
||||
lives elsewhere, override without touching the config:
|
||||
The connection string comes from the `HYPERDRIVE` binding. The `hyperdrive`
|
||||
block in `wrangler.jsonc` ships commented out (an active block makes the
|
||||
"Deploy to Cloudflare" button demand a Postgres connection string), so
|
||||
uncomment it first. Miniflare then resolves the binding to its
|
||||
`localConnectionString`, which already points at the Docker container from
|
||||
step 1. (In deployed Workers the same binding resolves to real Hyperdrive —
|
||||
the app never connects to Postgres except through this binding.) If your local
|
||||
Postgres lives elsewhere, override without touching the config:
|
||||
|
||||
```sh
|
||||
CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE=postgres://... pnpm dev
|
||||
|
||||
@ -94,16 +94,17 @@
|
||||
// docs/LOCAL_POSTGRES.md, and nothing connects to it unless
|
||||
// DATABASE_PROVIDER=postgres is set in .env.local.
|
||||
//
|
||||
// Running raw `wrangler deploy` against another account? DELETE this block —
|
||||
// the id lives in OpenSEO's account and the deploy fails without access to
|
||||
// it. (Alchemy deploys and the Docker image never read it.)
|
||||
"hyperdrive": [
|
||||
{
|
||||
"binding": "HYPERDRIVE",
|
||||
"id": "9d64ccfb559f44449ce52a143912f898",
|
||||
"localConnectionString": "postgres://openseo:openseo@localhost:5433/openseo",
|
||||
},
|
||||
],
|
||||
// Kept commented out: an active hyperdrive block makes the "Deploy to
|
||||
// Cloudflare" button demand a Postgres connection string, and the id lives in
|
||||
// OpenSEO's account anyway (Alchemy deploys and the Docker image never read
|
||||
// it). Uncomment when running local Postgres dev per docs/LOCAL_POSTGRES.md.
|
||||
// "hyperdrive": [
|
||||
// {
|
||||
// "binding": "HYPERDRIVE",
|
||||
// "id": "9d64ccfb559f44449ce52a143912f898",
|
||||
// "localConnectionString": "postgres://openseo:openseo@localhost:5433/openseo",
|
||||
// },
|
||||
// ],
|
||||
"r2_buckets": [
|
||||
{
|
||||
"bucket_name": "open-seo",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user