commit WIP

This commit is contained in:
Florian Forster
2025-08-05 18:23:00 -07:00
parent b7f147d0fc
commit ec0c5f2a71
14 changed files with 4025 additions and 340 deletions

10
docs/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM nginx:1.29.0
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
USER nginx
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
COPY --chown=nginx:nginx build /usr/share/nginx/html/docs
EXPOSE 3003
ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"]
CMD ["-g", "daemon off;"]

View File

@@ -1,8 +1,6 @@
# ZITADEL-Docs
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
The documentation is part of the ZITADEL monorepo and uses **pnpm** and **Turbo** for development and build processes.
This documentation page is built using [Docusaurus](https://docusaurus.io/).
## Quick Start
@@ -10,81 +8,32 @@ The documentation is part of the ZITADEL monorepo and uses **pnpm** and **Turbo*
# From the repository root
pnpm install
# Start development server (with Turbo)
pnpm turbo dev --filter=zitadel-docs
# Or start directly from docs directory
cd docs && pnpm start
# Start development server
nx run @zitadel/docs:start
```
The site will be available at http://localhost:3000
The site will be available at http://localhost:3003
## Available Scripts
All scripts can be run from the repository root using Turbo:
All scripts can be run from the repository root
```bash
# Development server with live reload
pnpm turbo dev --filter=zitadel-docs
# Build for production
pnpm turbo build --filter=zitadel-docs
nx run @zitadel/docs:build
# Generate API documentation and configuration docs
pnpm turbo generate --filter=zitadel-docs
nx run @zitadel/docs:generate
# Lint and fix code
pnpm turbo lint --filter=zitadel-docs
nx run @zitadel/docs:lint
# Serve production build locally
cd docs && pnpm serve
nx run @zitadel/docs:serve
```
## Add new Sites to existing Topics
To add a new site to the already existing structure simply save the `md` file into the corresponding folder and append the sites id int the file `sidebars.js`.
If you are introducing new APIs (gRPC), you need to add a new entry to `docusaurus.config.js` under the `plugins` section.
## Build Process
The documentation build process automatically:
1. **Downloads required protoc plugins** - Ensures `protoc-gen-connect-openapi` is available
2. **Generates gRPC documentation** - Creates API docs from proto files
3. **Generates API documentation** - Creates OpenAPI specification docs
4. **Copies configuration files** - Includes configuration examples
5. **Builds the Docusaurus site** - Generates the final static site
## Local Development
### Standard Development
```bash
# Install dependencies
pnpm install
# Start development server
pnpm start
```
### API Documentation Development
When working on the API docs, run a local development server with:
```bash
pnpm start:api
```
## Container Image
If you just want to start docusaurus locally without installing node you can fallback to our container image.
Execute the following commands from the repository root to build and start a local version of ZITADEL
```shell
docker build -f docs/Dockerfile . -t zitadel-docs
```
```shell
docker run -p 8080:8080 zitadel-docs
```
If you are introducing new APIs (gRPC), you need to add a new entry to `docusaurus.config.js` under the `plugins` section.

69
docs/nginx.conf Normal file
View File

@@ -0,0 +1,69 @@
worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log off;
error_log /dev/stderr warn;
# Performance
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 1000;
# Compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_min_length 256;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
font/ttf
font/otf
image/svg+xml;
server {
listen 3003;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Docusarus Routing
location / {
try_files $uri $uri/ /index.html;
}
# Static Assets Caching
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|map)$ {
expires 1y;
access_log off;
add_header Cache-Control "public, immutable";
}
# Optional: Explicit asset route
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}

View File

@@ -3,14 +3,11 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"dev": "docusaurus start",
"start": "docusaurus start",
"start:api": "pnpm run generate && docusaurus start",
"dev": "docusaurus start --port 3003 --host 0.0.0.0",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"ensure-plugins": "if [ ! -f \"protoc-gen-connect-openapi/protoc-gen-connect-openapi\" ]; then sh ./plugin-download.sh; fi",
@@ -18,29 +15,12 @@
"generate": "pnpm run generate:grpc && pnpm run generate:apidocs && pnpm run generate:configdocs && pnpm run ensure-plugins",
"generate:grpc": "pnpm run ensure-plugins && buf generate ../proto",
"generate:apidocs": "docusaurus gen-api-docs all",
"generate:configdocs": "cp -r ../cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
"generate:configdocs": "cp -r ../apps/api/cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../apps/api/cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
"generate:re-gen": "yarn generate:clean-all && pnpm generate",
"generate:clean-all": "docusaurus clean-api-docs all",
"postinstall": "sh ./plugin-download.sh",
"clean": "rm -rf node_modules .artifacts .docusaurus .turbo protoc-gen-connect-openapi docs/apis/resources"
},
"nx": {
"targets": {
"generate": {
"outputs": [
"{projectRoot}/apis/resources/**"
]
},
"build": {
"outputs": [
"{projectRoot}/build/**"
],
"dependsOn": [
"generate"
]
}
}
},
"dependencies": {
"@bufbuild/buf": "^1.14.0",
"@docusaurus/core": "^3.8.1",

32
docs/project.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@zitadel/docs",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"targets": {
"generate": {
"outputs": ["{projectRoot}/apis/resources/**"]
},
"start": {
"dependsOn": ["generate"]
},
"build": {
"outputs": ["{projectRoot}/build/**"],
"dependsOn": ["generate"]
},
"dev": {
"dependsOn": ["build"]
},
"docker:build": {
"dependsOn": [
"build"
]
},
"docker:run": {
"options": {
"args": [
"-p",
"3003:3003"
]
}
}
}
}