Restructure blogs as Astro monorepo
Some checks are pending
Build / build (push) Waiting to run

This commit is contained in:
Neeldhara Misra 2026-06-13 21:15:16 +02:00
parent fb5a3b8093
commit 58d8b661a8
1055 changed files with 116254 additions and 89 deletions

View file

@ -1,94 +1,91 @@
# 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.
This repo is now a monorepo of seven independent Astro sites under `sites/`.
Each site is a self-contained Dockerized Astro app with its own `src`, `public`,
`Dockerfile`, `package.json`, static build output, and RSS feed.
## 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` |
| Site | App directory | Domain |
| ------------- | ------------------- | ------------------------------ |
| Research | `sites/research` | `research.neeldhara.blog` |
| Vibes | `sites/vibes` | `vibes.neeldhara.blog` |
| Puzzles | `sites/puzzles` | `puzzles.neeldhara.blog` |
| Reflections | `sites/reflections` | `reflections.neeldhara.blog` |
| Poetry | `sites/poetry` | `poetry.neeldhara.blog` |
| Reviews | `sites/reviews` | `reviews.neeldhara.blog` |
| Art | `sites/art` | `art.neeldhara.blog` |
Each site has its own root feed at `/rss.xml`, for example:
The `.email` domains can be used as temporary aliases while DNS/certificates for
`.blog` are being finalized.
Each site exposes its own RSS feed at `/rss.xml`, for example:
- `https://research.neeldhara.blog/rss.xml`
- `https://puzzles.neeldhara.blog/rss.xml`
## Local Commands
Build all sites:
Build every site:
```bash
npm run build
npm run build:sites
```
Build one site:
```bash
BLOG_SITE=puzzles npm run build:site
npm run build --prefix sites/puzzles
```
Run one site locally:
```bash
BLOG_SITE=research npm run dev:site
npm run dev --prefix sites/research
```
Build the production container locally:
```bash
docker compose build
```
The root `Dockerfile` is a temporary legacy compatibility image for the old
all-in-one Dokploy app. New Dokploy apps should use the `Dockerfile` inside each
`sites/<site>` directory.
## Forgejo Setup
1. Create an empty Forgejo repository, for example `neeldhara/blogs`.
2. Point this local repo at Forgejo:
All Dokploy apps should point at the same Forgejo repository:
```bash
git remote set-url origin <forgejo-ssh-or-https-url>
git push -u origin main
```text
ssh://git@git.neeldhara.email:222/Blogs/blogs.git
```
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.
Use branch `main`.
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.
Forgejo Actions runs `npm ci` once at the repo root and then builds each site
directory.
## Dokploy Setup
Use the Docker Compose deployment path.
Use one Dokploy project named `Blogs` with seven Applications.
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.
Each Application should:
The container builds all seven sites with `npm run build`. Nginx reads the `Host` header and serves the matching directory using `deploy/nginx.conf`.
1. Use the same Forgejo repo and `main` branch.
2. Use the matching app directory as its build/root path, e.g. `sites/research`.
3. Build from that directory's `Dockerfile`.
4. Route exactly one site domain to container port `80`.
5. Avoid path prefixes or add-prefix middleware.
The Compose app attaches to Dokploy's external `dokploy-network` so Dokploy's proxy can reach the container. If your Dokploy installation uses a different proxy network name, update `docker-compose.yml`.
Suggested applications:
## DNS
| Dokploy application | Root path | Domain |
| ------------------- | ------------------- | ------------------------------ |
| `blog-research` | `sites/research` | `research.neeldhara.blog` |
| `blog-vibes` | `sites/vibes` | `vibes.neeldhara.blog` |
| `blog-puzzles` | `sites/puzzles` | `puzzles.neeldhara.blog` |
| `blog-reflections` | `sites/reflections` | `reflections.neeldhara.blog` |
| `blog-poetry` | `sites/poetry` | `poetry.neeldhara.blog` |
| `blog-reviews` | `sites/reviews` | `reviews.neeldhara.blog` |
| `blog-art` | `sites/art` | `art.neeldhara.blog` |
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.
For `.email` testing, use the corresponding `*.neeldhara.email` domains.
## Verification
@ -96,19 +93,21 @@ After deployment:
```bash
curl -I https://research.neeldhara.blog/
curl -I https://research.neeldhara.blog/_astro/privacy.WNqiFCQe.css
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.
Expected result: `200 OK` for pages, assets, and RSS.
## Bad Gateway Checklist
The container health check should return `204`:
If Dokploy shows `Bad Gateway`:
```bash
curl -I https://research.neeldhara.blog/nginx-health
```
1. Confirm the app deployment finished successfully and the `blogs` container is running.
2. In the domain settings, make sure each domain points to service `blogs` and container port `80`.
3. Confirm the service is attached to `dokploy-network`.
4. Check the container logs. Nginx should stay in the foreground; if it exits, the logs should show the config error.
5. Redeploy after any Compose change so Dokploy recreates the container/network attachment.
## Notes
The old all-in-one app can stay online during migration. Once all seven new
Dokploy Applications are working, remove the domains from the old app and delete
it from Dokploy.