Set up multisite Dokploy deployment
Some checks are pending
Build / build (push) Waiting to run

This commit is contained in:
Neeldhara Misra 2026-06-13 19:45:59 +02:00
parent 56f49d988d
commit 80c51bdfea
75 changed files with 383 additions and 1838 deletions

View file

@ -1,54 +1,102 @@
# Multi-Blog Subdomain Deployment Guide
# Dokploy + Forgejo Deployment
This project deploys 12 separate blogs to individual subdomains using Netlify.
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.
## Subdomain Structure
## Sites
Each blog collection gets its own subdomain:
| 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` |
- `art.neeldhara.blog` → Art blog posts
- `bfs.neeldhara.blog` → BFS algorithm posts
- `dfs.neeldhara.blog` → DFS algorithm posts
- `problems.neeldhara.blog` → Problem-solving posts
- `puzzles.neeldhara.blog` → Puzzle posts
- `reviews.neeldhara.blog` → Review posts
- `reflections.neeldhara.blog` → Reflection posts
- `vibes.neeldhara.blog` → Vibes posts
- `workflows.neeldhara.blog` → Workflow posts
- `magic.neeldhara.blog` → Mathematical magic posts
- `contests.neeldhara.blog` → Contest posts
- `poetry.neeldhara.blog` → Poetry posts
- `blog.neeldhara.blog` → Main blog posts
Each site has its own root feed at `/rss.xml`, for example:
## How It Works
- `https://research.neeldhara.blog/rss.xml`
- `https://puzzles.neeldhara.blog/rss.xml`
1. **Main Site**: All content is built and deployed to `neeldhara.blog`
2. **Subdomain Redirects**: Each subdomain (e.g., `art.neeldhara.blog`) redirects to the main site with the appropriate path (e.g., `neeldhara.blog/art/`)
3. **Netlify Configuration**: The `netlify.toml` file handles all the redirect rules
## Local Commands
## Deployment Steps
Build all sites:
1. **Build the site**: `npm run build`
2. **Deploy to Netlify**: Connect your Git repository to Netlify
3. **Configure domains**: Set up the custom domains in Netlify:
- Main site: `neeldhara.blog`
- Subdomains: `art.neeldhara.blog`, `bfs.neeldhara.blog`, etc.
4. **DNS Configuration**: Point all subdomains to your Netlify site
```bash
npm run build
```
## Example URLs
Build one site:
Local development:
- `http://localhost:4323/art/algorithmic-sketches`
```bash
BLOG_SITE=puzzles npm run build:site
```
Production:
- `https://art.neeldhara.blog/algorithmic-sketches`
- `https://neeldhara.blog/art/algorithmic-sketches` (direct access)
Run one site locally:
Both URLs serve the same content thanks to the redirect configuration.
```bash
BLOG_SITE=research npm run dev:site
```
## Testing
Build the production container locally:
After deployment, verify that:
1. Each subdomain homepage loads correctly (e.g., `art.neeldhara.blog`)
2. Individual blog posts load correctly (e.g., `art.neeldhara.blog/algorithmic-sketches`)
3. RSS feeds work (e.g., `art.neeldhara.blog/rss.xml`)
```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.