blogs/DEPLOYMENT.md
Neeldhara Misra b3cd8a8914
Some checks are pending
Build / build (push) Waiting to run
Attach Dokploy compose service to proxy network
2026-06-13 20:03:47 +02:00

114 lines
3.8 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`.
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`.
## 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.
## Bad Gateway Checklist
If Dokploy shows `Bad Gateway`:
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.