fix: seed catalog on boot + emit https canonical/og:url
ci/woodpecker/push/container Pipeline failed
ci/woodpecker/push/container Pipeline failed
- entrypoint: run 'emdash seed' after 'emdash init' (init no longer loads JSON seeds in newer emdash, so the catalog booted empty). Idempotent onConflict=skip. - Base.astro: derive canonical/og:url base from EMDASH_SITE_URL (per-env https URL the chart injects) instead of Astro.url.origin, which is plain http behind Traefik TLS termination.
This commit is contained in:
@@ -19,7 +19,12 @@ const siteTagline = settings?.tagline ?? "WordPress → Emdash plugin parity cat
|
|||||||
const fullTitle = title === siteTitle ? siteTitle : `${title} — ${siteTitle}`;
|
const fullTitle = title === siteTitle ? siteTitle : `${title} — ${siteTitle}`;
|
||||||
const pageDescription = description ?? siteTagline;
|
const pageDescription = description ?? siteTagline;
|
||||||
|
|
||||||
const canonicalBase = Astro.site ?? new URL(Astro.url.origin);
|
// Prefer the per-env site URL the chart injects (EMDASH_SITE_URL, https://<host>)
|
||||||
|
// over Astro.url.origin: TLS terminates at Traefik, so the pod sees plain http
|
||||||
|
// and would otherwise emit http:// canonical + og:url. Read at request time via
|
||||||
|
// process.env (runtime pod env, not a build-time import.meta.env constant).
|
||||||
|
const siteUrlEnv = process.env.EMDASH_SITE_URL;
|
||||||
|
const canonicalBase = Astro.site ?? (siteUrlEnv ? new URL(siteUrlEnv) : new URL(Astro.url.origin));
|
||||||
const canonical = new URL(Astro.url.pathname, canonicalBase).href;
|
const canonical = new URL(Astro.url.pathname, canonicalBase).href;
|
||||||
|
|
||||||
const pageCtx = createPublicPageContext({
|
const pageCtx = createPublicPageContext({
|
||||||
|
|||||||
+12
-8
@@ -4,14 +4,18 @@ set -eu
|
|||||||
# Ensure persistent state dirs exist (volume may be empty on first boot).
|
# Ensure persistent state dirs exist (volume may be empty on first boot).
|
||||||
mkdir -p /app/state/uploads
|
mkdir -p /app/state/uploads
|
||||||
|
|
||||||
# Run emdash init on EVERY boot, before exec'ing the server. It is idempotent:
|
# Run emdash init + seed on EVERY boot, before exec'ing the server. Both are
|
||||||
# runMigrations applies only pending migrations (no-op when all are applied) and
|
# idempotent: `init` runs only pending migrations (no-op when all applied) and
|
||||||
# init skips re-seeding once collections exist. Under `set -e` a non-zero exit
|
# `seed` applies seed/seed.json with onConflict=skip (no-op once rows exist).
|
||||||
# aborts before `exec "$@"`, so a failed/partial init surfaces as a crash-loop
|
# `init` does NOT load JSON seeds — that moved to the separate `emdash seed`
|
||||||
# with logs instead of a silently half-migrated boot. (Gating on the mere
|
# command — so without this seed step the catalog boots empty. Under `set -e` a
|
||||||
# presence of data.db would skip pending migrations on image upgrades against an
|
# non-zero exit aborts before `exec "$@"`, so a failed/partial init or seed
|
||||||
# existing PVC and never recover a partial first-run init.)
|
# surfaces as a crash-loop with logs instead of a silently half-set-up boot.
|
||||||
echo "[entrypoint] running emdash init (applies pending migrations, skips re-seed when collections exist)"
|
# (Gating on the mere presence of data.db would skip pending migrations on image
|
||||||
|
# upgrades against an existing PVC and never recover a partial first-run init.)
|
||||||
|
echo "[entrypoint] running emdash init (applies pending migrations)"
|
||||||
node_modules/.bin/emdash init
|
node_modules/.bin/emdash init
|
||||||
|
echo "[entrypoint] running emdash seed (applies seed/seed.json, onConflict=skip)"
|
||||||
|
node_modules/.bin/emdash seed
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user