Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions docs-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
28 changes: 28 additions & 0 deletions docs-site/render.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
- type: web
name: gowdk-page
runtime: go
rootDir: docs-site

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the Render service rooted at the repository root

With rootDir: docs-site, Render's monorepo docs say "Files outside your service's root directory are not available" at build time (https://render.com/docs/monorepo-support). This build still depends on parent files: docs-site/go.mod replaces github.com/cssbruno/gowdk with ../, and syncdocs defaults GOWDK_SOURCE_ROOT to .. to read ../docs; in that Render environment, go run github.com/cssbruno/gowdk/cmd/gowdk build cannot resolve the replacement and docs generation cannot see the source docs. Leave the service rooted at the repo root and cd docs-site, or remove the parent-directory dependencies before setting rootDir.

Useful? React with 👍 / 👎.

# 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/**
38 changes: 0 additions & 38 deletions render.yaml

This file was deleted.