From 8af689514c8ae55e5d566c0755533e936aabcf0a Mon Sep 17 00:00:00 2001 From: Bruno Carvalho Date: Sat, 20 Jun 2026 16:43:06 -0300 Subject: [PATCH] fix(docs-site): move Render blueprint into docs site --- docs-site/README.md | 35 ++++++++++++++++++++--------------- docs-site/render.yaml | 28 ++++++++++++++++++++++++++++ render.yaml | 38 -------------------------------------- 3 files changed, 48 insertions(+), 53 deletions(-) create mode 100644 docs-site/render.yaml delete mode 100644 render.yaml diff --git a/docs-site/README.md b/docs-site/README.md index 5db4f225..53417a8a 100644 --- a/docs-site/README.md +++ b/docs-site/README.md @@ -97,7 +97,8 @@ mkdir -p bin go build -o bin/gowdk-page . ``` -The binary serves the embedded `dist/site` output. +Run "Build Site Output" first. `main.go` embeds `dist/site`, so a clean clone +cannot compile the binary until that generated output exists. ## Run @@ -127,20 +128,24 @@ rm -rf dist/site && go run github.com/cssbruno/gowdk/cmd/gowdk build GOWDK_ADDR=127.0.0.1:8091 go run . ``` -Deployment is a Go web service (see `render.yaml` at the repo root — Render only -reads a Blueprint from the repository root, not from a subdirectory). The service -is rooted at the **repo root**, not `docs-site/`: docs-site's `go.mod` replaces -the framework with `../` and `syncdocs` reads `../docs`, both outside -`docs-site/`, and Render makes files outside a service's root directory -unavailable at build time. So the build `cd`s into `docs-site/`, runs syncdocs -and the in-tree GOWDK build, copies `assets/`, then `go build`s `main.go` into -the `app` binary that embeds and serves `dist/site` (reading `$PORT`); the start -command is `cd docs-site && ./app`. The Blueprint build filter watches both `docs-site/**` and -`docs/**`, so source documentation changes deploy the generated site even though -`src/pages/docs/**` is gitignored. A static preview of any branch is just the -build output above served by any static file server, so contributors can review -a branch without a live runtime. None of this makes the site a product promise — -it is documentation for an experimental project. +Deployment is a Go web service. The Render Blueprint lives at +`docs-site/render.yaml`; when creating a Blueprint, set the Blueprint Path to +`docs-site/render.yaml`. + +For a manually configured Render service, set Root Directory to `docs-site`, use +the Build Command from `docs-site/render.yaml`, and use: + +```sh +./app +``` + +as the Start Command. The default Render Go build command (`go build ...`) is +not enough because it either runs before `dist/site` exists or, from the repo +root, builds the root library package into a non-executable `app` archive. A +static preview of any branch is just the build output above served by any static +file server, so contributors can review a branch without a live runtime. None of +this makes the site a product promise — it is documentation for an experimental +project. ## Structure diff --git a/docs-site/render.yaml b/docs-site/render.yaml new file mode 100644 index 00000000..6c88a14f --- /dev/null +++ b/docs-site/render.yaml @@ -0,0 +1,28 @@ +services: + - type: web + name: gowdk-page + runtime: go + rootDir: docs-site + # main.go embeds dist/site, so the build must generate the GOWDK site + # output before compiling the Go server binary. + buildCommand: | + set -euo pipefail + mkdir -p tools + tailwind_version="v4.3.1" + tailwind_sha256="2526d063ba03b71f9a3ea7d5cee14f0aec147f117f222d5adc97b1d736d45999" + curl -fsSL -o tools/tailwindcss \ + "https://github.com/tailwindlabs/tailwindcss/releases/download/${tailwind_version}/tailwindcss-linux-x64" + echo "${tailwind_sha256} tools/tailwindcss" | sha256sum -c - + chmod +x tools/tailwindcss + go run ./cmd/syncdocs + rm -rf dist/site + go run github.com/cssbruno/gowdk/cmd/gowdk build + mkdir -p dist/site/assets + cp -R assets/. dist/site/assets/ + cp assets/favicon.ico dist/site/favicon.ico + go build -tags netgo -ldflags '-s -w' -o app . + startCommand: ./app + buildFilter: + paths: + - docs-site/** + - docs/** diff --git a/render.yaml b/render.yaml deleted file mode 100644 index 942ac224..00000000 --- a/render.yaml +++ /dev/null @@ -1,38 +0,0 @@ -services: - - type: web - name: gowdk-page - runtime: go - # The docs site lives under docs-site/, but its go.mod has - # `replace github.com/cssbruno/gowdk => ../` and cmd/syncdocs reads ../docs — - # both OUTSIDE docs-site/. Render makes files outside a service's root - # directory unavailable at build time, so we must NOT set rootDir: docs-site - # (that would hide the parent module and ../docs). Instead the service is - # rooted at the repo root — where the whole repo is available — and every - # command cd's into docs-site/. render.yaml itself must live at the repo - # root, because Render only reads a Blueprint from there. - # - # This deploys as a Go binary (not a static publish): main.go embeds - # dist/site and serves it, reading $PORT from Render. The build must generate - # dist/site BEFORE `go build`, because main.go uses //go:embed dist/site. - buildCommand: | - set -euo pipefail - cd docs-site - mkdir -p tools - tailwind_version="v4.3.1" - tailwind_sha256="2526d063ba03b71f9a3ea7d5cee14f0aec147f117f222d5adc97b1d736d45999" - curl -fsSL -o tools/tailwindcss \ - "https://github.com/tailwindlabs/tailwindcss/releases/download/${tailwind_version}/tailwindcss-linux-x64" - echo "${tailwind_sha256} tools/tailwindcss" | sha256sum -c - - chmod +x tools/tailwindcss - go run ./cmd/syncdocs - rm -rf dist/site - go run github.com/cssbruno/gowdk/cmd/gowdk build - mkdir -p dist/site/assets - cp -R assets/. dist/site/assets/ - cp assets/favicon.ico dist/site/favicon.ico - go build -tags netgo -ldflags '-s -w' -o app . - startCommand: cd docs-site && ./app - buildFilter: - paths: - - docs-site/** - - docs/**