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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
- name: Deploy infra files and restart
run: |
scp -i ~/.ssh/deploy_key \
docker-compose.yml nginx.conf \
docker-compose.yml nginx.conf server.ts \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}/

ssh -i ~/.ssh/deploy_key \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"cd ${{ secrets.DEPLOY_PATH }} && docker compose up -d docs-prod"
"cd ${{ secrets.DEPLOY_PATH }} && docker compose up -d docs-prod docs-feedback"
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

```
```sh
bun create astro@latest -- --template starlight/tailwind
```

Expand All @@ -12,7 +12,7 @@ bun create astro@latest -- --template starlight/tailwind

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

```
```text
.
├── public/
├── src/
Expand All @@ -39,14 +39,29 @@ The project includes [Tailwind CSS](https://starlight.astro.build/guides/css-and

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

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

## Feedback API

The repo also includes a small Bun service in `server.ts` for the future "Was this page helpful?" widget.

- Deployed endpoint: `POST /api/feedback`
- Deployed health check: `GET /api/health`
- Direct service endpoint: `POST /feedback`
- Direct service health check: `GET /health`
- Deployed host: `docs.arkiv.network`
- Required body field: `sentiment` (`positive` or `negative`)
- Optional body fields: `comment`, `pageUrl`, `pageTitle`
- Required environment variable: `SLACK_WEBHOOK_URL`
- Optional environment variables: `FEEDBACK_ALLOWED_ORIGINS`, `FEEDBACK_MAX_BODY_BYTES`, `FEEDBACK_MAX_COMMENT_LENGTH`

## 👀 Want to learn more?

Expand Down
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default defineConfig({
"./src/styles/global.css",
],
components: {
Pagination: "./src/components/DocsPagination.astro",
SiteTitle: "./src/components/SiteTitle.astro",
},
plugins: [
Expand Down
7 changes: 7 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
services:
docs-feedback:
image: oven/bun:1-alpine
restart: unless-stopped
working_dir: /app
command: ["bun", "run", "/app/server.ts"]
volumes:
- ./server.ts:/app/server.ts:ro
environment:
PORT: 3000
SLACK_WEBHOOK_URL: ${SLACK_WEBHOOK_URL:?SLACK_WEBHOOK_URL is required}
ALLOWED_ORIGINS: ${FEEDBACK_ALLOWED_ORIGINS:-https://docs.arkiv.network,https://stage.docs.arkiv.network,http://localhost:4321,http://127.0.0.1:4321}
FEEDBACK_MAX_BODY_BYTES: ${FEEDBACK_MAX_BODY_BYTES:-16384}
FEEDBACK_MAX_COMMENT_LENGTH: ${FEEDBACK_MAX_COMMENT_LENGTH:-4000}
networks:
- arkiv_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.docs-feedback.rule=Host(`docs.arkiv.network`) && PathPrefix(`/api`)"
- "traefik.http.routers.docs-feedback.priority=100"
- "traefik.http.routers.docs-feedback.entrypoints=websecure"
- "traefik.http.routers.docs-feedback.tls.certresolver=letsencrypt"
- "traefik.http.routers.docs-feedback.middlewares=docs-feedback-ratelimit"
- "traefik.http.middlewares.docs-feedback-ratelimit.ratelimit.average=10"
- "traefik.http.middlewares.docs-feedback-ratelimit.ratelimit.period=1m"
- "traefik.http.middlewares.docs-feedback-ratelimit.ratelimit.burst=20"
- "traefik.http.services.docs-feedback.loadbalancer.server.port=3000"

docs-stage:
image: nginx:alpine
restart: unless-stopped
Expand All @@ -25,6 +52,7 @@ services:
labels:
- "traefik.enable=true"
- "traefik.http.routers.docs-prod.rule=Host(`docs.arkiv.network`)"
- "traefik.http.routers.docs-prod.priority=1"
- "traefik.http.routers.docs-prod.entrypoints=websecure"
- "traefik.http.routers.docs-prod.tls.certresolver=letsencrypt"
- "traefik.http.services.docs-prod.loadbalancer.server.port=80"
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"feedback": "bun run server.ts",
"feedback:dev": "bun --watch server.ts"
},
"dependencies": {
"@astrojs/starlight": "^0.38.2",
Expand All @@ -18,5 +20,8 @@
"sharp": "^0.34.2",
"starlight-page-actions": "^0.5.0",
"tailwindcss": "^4.1.18"
},
"devDependencies": {
"@types/bun": "^1.3.13"
}
}
Loading