Skip to content

Commit

Permalink
docs: Add docs website (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Jorge Hermo <[email protected]>
  • Loading branch information
daavidrgz and jorgehermo9 authored Oct 24, 2024
1 parent cb0179a commit 94fa3f1
Show file tree
Hide file tree
Showing 77 changed files with 10,284 additions and 8 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/target/
**/node_modules/
**/.astro
crates/web/frontend/pkg
**Dockerfile
docker-compose.yml
Expand Down
26 changes: 22 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
services:
gq-gateway:
build:
context: .
dockerfile: docker/gateway.Dockerfile
ports:
- 3000:8080
environment:
# The trailing slash is very important so nginx rewrites the URL correctly
# (https://nginx.org/en/docs/http/ngx_http_proxy_module.html?&_ga=1.74997266.187384914.1443061481#proxy_pass)
FRONTEND_URL: http://gq-playground:3000/
DOCS_URL: http://gq-docs:8080/
API_URL: http://gq-server:3000/
depends_on:
- gq-playground
- gq-docs
- gq-server
gq-playground:
build:
context: .
dockerfile: docker/playground.Dockerfile
ports:
- 3000:3000
gq-docs:
build:
context: .
dockerfile: docker/docs.Dockerfile
environment:
BASE_PATH: /docs
gq-server:
build:
context: .
dockerfile: docker/server.Dockerfile
ports:
- 3001:3000
environment:
DATABASE_URL: postgres://postgres:password@db:5432/db
depends_on:
Expand Down
11 changes: 11 additions & 0 deletions docker/docs.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM docker.io/node:23-bookworm AS build
WORKDIR /app
COPY docs/package*.json ./
RUN npm install
COPY docs .
RUN npm run build

FROM docker.io/nginx:1.27.2-bookworm AS runtime
COPY docker/docs/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
31 changes: 31 additions & 0 deletions docker/docs/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 8080;
server_name _;

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}

location / {
try_files $uri $uri/index.html =404;
}
}
}
3 changes: 3 additions & 0 deletions docker/gateway.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.io/nginx:1.27.2-bookworm AS runtime
COPY docker/gateway/nginx.conf.template /etc/nginx/templates/nginx.conf.template
EXPOSE 80
20 changes: 20 additions & 0 deletions docker/gateway/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server {
listen 8080;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

location /docs {
proxy_pass ${DOCS_URL};
}

location /api {
proxy_pass ${API_URL};
}

location / {
proxy_pass ${FRONTEND_URL};
}
}
4 changes: 2 additions & 2 deletions docker/playground.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.81 AS chef
FROM docker.io/rust:1.81 AS chef
WORKDIR /app
# `wasm-pack` dependency `libz-ng-sys 1.1.15` needs cmake
# Remember to delete this once `libz-ng-sys 1.1.17` is used, since
Expand All @@ -19,7 +19,7 @@ COPY . .
WORKDIR /app/crates/web
RUN wasm-pack build --out-dir ./pkg --target web

FROM node:22.2-bookworm
FROM docker.io/node:22.2-bookworm
WORKDIR /app
RUN npm install --global [email protected]
COPY --from=builder /app/crates/web/pkg ./pkg
Expand Down
4 changes: 2 additions & 2 deletions docker/server.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.81 AS chef
FROM docker.io/rust:1.81 AS chef
WORKDIR /app
RUN cargo install cargo-chef --version 0.1.67 --locked

Expand All @@ -13,6 +13,6 @@ COPY . .
ENV SQLX_OFFLINE true
RUN cargo build --package gq-server --release

FROM debian:bookworm
FROM docker.io/debian:bookworm
COPY --from=builder /app/target/release/gq-server .
CMD [ "./gq-server" ]
21 changes: 21 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions docs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions docs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
9 changes: 9 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:lts AS build
WORKDIR /app
COPY . .
RUN npm i
RUN npm run build

FROM httpd:2.4 AS runtime
COPY --from=build /app/dist /usr/local/apache2/htdocs/
EXPOSE 80
55 changes: 55 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Starlight Starter Kit: Basics

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

```
npm create astro@latest -- --template starlight
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## 🚀 Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

```
.
├── public/
├── src/
│ ├── assets/
│ ├── content/
│ │ ├── docs/
│ │ └── config.ts
│ └── env.d.ts
├── astro.config.mjs
├── package.json
└── tsconfig.json
```

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.

Images can be added to `src/assets/` and embedded in Markdown with a relative link.

Static assets, like favicons, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
46 changes: 46 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import tailwind from "@astrojs/tailwind";

const base_path = process.env.BASE_PATH || "/";

// https://astro.build/config
export default defineConfig({
base: base_path,
integrations: [
tailwind({
// Disable the default base styles
applyBaseStyles: false,
}),
starlight({
title: "GQ",
social: {
github: "https://github.com/jorgehermo9/gq",
},
editLink: {
baseUrl: "https://github.com/jorgehermo9/gq/tree/feature/docs/docs",
},
customCss: ["./src/styles/custom.css"],
sidebar: [
{
label: "Introduction",
autogenerate: {
directory: "introduction",
},
},
{
label: "Concepts",
autogenerate: {
directory: "concepts",
},
},
{
label: "Reference",
autogenerate: {
directory: "reference",
},
},
],
}),
],
});
6 changes: 6 additions & 0 deletions docs/ec.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";

/** @type {import('@astrojs/starlight/expressive-code').StarlightExpressiveCodeOptions} */
export default {
// plugins: [pluginLineNumbers()],
};
Loading

0 comments on commit 94fa3f1

Please sign in to comment.