blogs/DEPLOYMENT.md
Neeldhara Misra 80c51bdfea
Some checks are pending
Build / build (push) Waiting to run
Set up multisite Dokploy deployment
2026-06-13 19:45:59 +02:00

102 lines
3.1 KiB
Markdown

# Dokploy + Forgejo Deployment
This repo is set up as one Dockerized multisite Astro app. The build creates seven static sites and Nginx serves the correct one based on the incoming subdomain.
## Sites
| Host | Static output | Content collection |
| ---------------------------- | ------------------ | ------------------------- |
| `research.neeldhara.blog` | `dist/research` | `src/content/research` |
| `vibes.neeldhara.blog` | `dist/vibes` | `src/content/vibes` |
| `puzzles.neeldhara.blog` | `dist/puzzles` | `src/content/puzzles` |
| `reflections.neeldhara.blog` | `dist/reflections` | `src/content/reflections` |
| `poetry.neeldhara.blog` | `dist/poetry` | `src/content/poetry` |
| `reviews.neeldhara.blog` | `dist/reviews` | `src/content/reviews` |
| `art.neeldhara.blog` | `dist/art` | `src/content/art` |
Each site has its own root feed at `/rss.xml`, for example:
- `https://research.neeldhara.blog/rss.xml`
- `https://puzzles.neeldhara.blog/rss.xml`
## Local Commands
Build all sites:
```bash
npm run build
```
Build one site:
```bash
BLOG_SITE=puzzles npm run build:site
```
Run one site locally:
```bash
BLOG_SITE=research npm run dev:site
```
Build the production container locally:
```bash
docker compose build
```
## Forgejo Setup
1. Create an empty Forgejo repository, for example `neeldhara/blogs`.
2. Point this local repo at Forgejo:
```bash
git remote set-url origin <forgejo-ssh-or-https-url>
git push -u origin main
```
3. Enable Forgejo Actions if you want CI. The workflow in `.forgejo/workflows/build.yml` runs `npm ci` and `npm run build` on pushes and pull requests.
Forgejo Actions uses GitHub-Actions-like workflow syntax, but it is not identical to GitHub Actions. Keep this workflow intentionally simple unless the runner setup is known.
## Dokploy Setup
Use the Docker Compose deployment path.
1. In Dokploy, create a new Compose app.
2. Connect it to the Forgejo repository. If Dokploy cannot access Forgejo directly, add a deploy key or use the repository HTTPS URL with credentials configured in Dokploy.
3. Use the repository root as the build context.
4. Use `docker-compose.yml` from this repo.
5. Route all seven domains to the `blogs` service on port `80`.
6. Enable HTTPS certificates for each domain in Dokploy.
The container builds all seven sites with `npm run build`. Nginx reads the `Host` header and serves the matching directory using `deploy/nginx.conf`.
## DNS
Point these DNS records at the Dokploy host:
```text
research.neeldhara.blog
vibes.neeldhara.blog
puzzles.neeldhara.blog
reflections.neeldhara.blog
poetry.neeldhara.blog
reviews.neeldhara.blog
art.neeldhara.blog
```
Use `A` records if pointing directly at the server IP, or `CNAME` records if you front Dokploy with another canonical hostname.
## Verification
After deployment:
```bash
curl -I https://research.neeldhara.blog/
curl -I https://research.neeldhara.blog/rss.xml
curl -I https://puzzles.neeldhara.blog/100-prisoners/
curl -I https://puzzles.neeldhara.blog/rss.xml
```
Expected result: `200 OK` for each.