Files
deployment/README.md

80 lines
2.7 KiB
Markdown

# FromChat Deployment
_Написано ИИ. Могут быть ошибки._
One-click installer and classic (build-on-your-PC) deploy tooling for a production FromChat stack on Debian-based Linux.
## Quick install
```bash
curl -fsSL https://l.fromchat.ru/install|sudo bash
```
The installer (`install.sh`):
1. Installs Docker + Compose plugin if missing
2. Downloads the published `compose.yml` (GitHub, with Gitea fallback)
3. Clones backend enough to run `generate-env` into `~/fromchat-server/.env`
4. Prints next steps (configure Caddyfile / edge, then `docker compose up -d`)
Containers use Docker `restart: always` — no systemd unit.
Short links on `l.fromchat.ru`:
| Path | Target |
|------|--------|
| `/install` | This installer script (GitHub → Gitea fallback) |
| `/telegram` | https://t.me/fromchat_ch |
| `/max` | https://mxg.su/fromchat_ch |
## After install
```bash
cd ~/fromchat-server
docker compose --env-file .env up -d
```
## Layout after install
```
~/fromchat-server/
compose.yml # published production stack (do not edit by hand; regenerated by CI/publish)
.env # from backend generate-env
compliance_keypair.txt # keep the private key offline
data/prod/ # runtime data (Caddy ACME under data/prod/caddy/)
firebase-cert.json # optional; empty placeholder may be created by installer
```
## Classic deploy (offline / build on your PC)
For developers who build images **locally** and transfer them via SSH + `docker pussh`:
```bash
cd deployment
./deploy.sh user@host ~/fromchat-server linux/arm64 --tag latest
# optional:
./deploy.sh user@host ~/fromchat-server linux/amd64 \
--components backend,frontend,caddy,chat_filter,updater --tag v1.0
```
- Interactive component menu if `--components` is omitted
- Syncs `compose.yml` + `.env` to the server, pushes images, then `docker compose up -d`
- Sibling checkouts expected (or set env): `../backend`, `../Web`, `../updater`
overrides: `FROMCHAT_BACKEND_DIR`, `FROMCHAT_WEB_DIR`, `FROMCHAT_UPDATER_DIR`
Publish multi-arch images to registries:
```bash
./publish.sh
```
CI regenerates root `compose.yml` from the latest published release (`scripts/sync-published-compose.py`).
Python helpers live under `scripts/deploy/` (`requirements-deploy.txt`: rich, etc.). Prefer the backend `.venv` or create one for deployment scripts.
## Related
- [Backend](https://github.com/fromchat-messenger/backend) — `generate-env`, `compose.yml` / `compose.prod.yml`
- [Updater](https://github.com/fromchat-messenger/updater) — pulls newer Hub tags into a running stack
- [Web](https://github.com/fromchat-messenger/web) • [Android](https://github.com/fromchat-messenger/android)