Skip to content

Commit 05d9b9b

Browse files
thesandlorddevin-ai-integration[bot]devalog
authored
docs: add build-time generation, --only-deps flag, and gRPC air-gapped guidance (#2930)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Devin Logan <[email protected]>
1 parent baff440 commit 05d9b9b

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

fern/products/docs/pages/enterprise/self-hosted-set-up.mdx

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Before setting up self-hosted documentation, ensure you have:
1212
- Access to your Fern project's `fern/` directory
1313
- A Docker Hub account (for accessing the private image)
1414

15+
## Setup instructions
16+
1517
<Steps>
1618
<Step title="Request Access to the Docker Image">
1719

@@ -47,10 +49,16 @@ In the directory containing your `fern/` folder, create a new `Dockerfile` with
4749
FROM fernapi/fern-self-hosted:<latest-tag>
4850

4951
COPY fern/ /fern/
52+
53+
RUN fern-generate
5054
```
5155

5256
Replace `<latest-tag>` with the actual tag used in the previous step.
5357

58+
<Info>
59+
`fern-generate` processes your documentation at build time, enabling faster container startup, air-gapped deployment, and a smaller attack surface. You can alternatively [defer generation to runtime](#runtime-generation).
60+
</Info>
61+
5462
</Step>
5563
<Step title="Build Your Custom Docker Image">
5664

@@ -93,5 +101,102 @@ instances:
93101
You can now deploy the image to your own infrastructure, allowing you to host the documentation on your own domain.
94102
95103
</Step>
96-
</Steps>
104+
</Steps>
105+
106+
## Additional configuration
107+
108+
The following sections cover optional configurations for specific deployment scenarios.
109+
110+
### Runtime generation
111+
112+
By default, `fern-generate` runs at Docker build time. Defer generation to runtime if you need to:
113+
- Pass configuration (environment variables, secrets) at runtime
114+
- Speed up Docker builds during development
115+
- Share a single image across multiple documentation configurations
116+
117+
Use the `--only-deps` flag to defer generation to runtime:
118+
119+
```dockerfile
120+
FROM fernapi/fern-self-hosted:<latest-tag>
121+
122+
COPY fern/ /fern/
123+
124+
RUN fern-generate --only-deps
125+
```
126+
127+
This starts required services (PostgreSQL, MinIO, FDR) at build time but skips documentation generation. When the container starts, it automatically runs `fern generate --docs`.
128+
129+
<Warning>
130+
Runtime generation requires network access at container startup. For air-gapped deployments, use the default build-time generation.
131+
</Warning>
132+
133+
### Air-gapped deployments with gRPC
134+
135+
If your API uses gRPC with dependencies from the [Buf Schema Registry](https://buf.build) (BSR), the `buf` CLI fetches modules from `buf.build` during generation. This fails in air-gapped environments without network access.
136+
137+
<Steps>
138+
<Step title="Check for BSR dependencies">
139+
140+
Look for a `deps` section in your `buf.yaml` file:
141+
142+
```yaml
143+
version: v2
144+
deps:
145+
- buf.build/googleapis/googleapis
146+
- buf.build/grpc-ecosystem/grpc-gateway
147+
```
148+
149+
If there's no `deps` section or only local paths, you can skip the rest of this section.
97150

151+
</Step>
152+
<Step title="Choose a solution">
153+
154+
<AccordionGroup>
155+
<Accordion title="Option 1: Build-time generation (recommended)" defaultOpen>
156+
157+
Run `fern-generate` at build time when network access is available:
158+
159+
```dockerfile
160+
FROM fernapi/fern-self-hosted:<latest-tag>
161+
162+
COPY fern/ /fern/
163+
164+
RUN fern-generate
165+
```
166+
167+
This downloads BSR dependencies during the Docker build and bakes them into the image. No network access required at runtime.
168+
</Accordion>
169+
<Accordion title="Option 2: Vendor dependencies for runtime generation">
170+
171+
To generate at runtime in an air-gapped environment, vendor buf dependencies locally:
172+
173+
```dockerfile
174+
FROM fernapi/fern-self-hosted:<latest-tag>
175+
176+
COPY fern/ /fern/
177+
178+
RUN cd /fern && buf export . --output ./vendor
179+
180+
RUN fern-generate --only-deps
181+
```
182+
183+
Update `buf.yaml` to reference vendored dependencies:
184+
185+
```yaml
186+
# Before
187+
deps:
188+
- buf.build/googleapis/googleapis
189+
190+
# After
191+
deps:
192+
- ./vendor/googleapis
193+
```
194+
195+
<Info>
196+
See the [Buf documentation on dependency management](https://buf.build/docs/bsr/module/dependency-management) for more details.
197+
</Info>
198+
</Accordion>
199+
</AccordionGroup>
200+
201+
</Step>
202+
</Steps>

0 commit comments

Comments
 (0)