77 lines
3.2 KiB
Markdown
77 lines
3.2 KiB
Markdown
# Production deployment
|
|
|
|
This compose project runs Caddy, the Search API, and a private OpenSearch node.
|
|
Caddy serves `akyldash.kg` over HTTPS and proxies to the API. Only Caddy publishes
|
|
ports `80` and `443`; the API has no host port, and OpenSearch is reachable only
|
|
from the backend's private network.
|
|
|
|
The current compose intentionally disables the OpenSearch security plugin to
|
|
match the existing API client. Keep OpenSearch on its private network.
|
|
The application provides cookie-based accounts for its search API and review
|
|
workspace; it does not replace host-level network controls or TLS.
|
|
|
|
## First deployment
|
|
|
|
1. Copy this directory to the host with the repository source.
|
|
2. Copy `.env.example` to `.env`, set an absolute `DATA_ROOT`, and create the
|
|
secret file referenced by `REVIEW_SECRET_FILE` outside the repository:
|
|
|
|
```bash
|
|
sudo install -d -o root -g root -m 0700 /etc/akyldash
|
|
sudo sh -c 'umask 077; openssl rand -hex 32 > /etc/akyldash/review_secret'
|
|
```
|
|
|
|
Do not commit `.env` or the secret file.
|
|
3. Put the normalized dataset under `$DATA_ROOT/minjust-normalized/`.
|
|
4. Confirm DNS points through Cloudflare to this origin. Have the owner review
|
|
the existing firewall rules and allow TCP `80` and `443` before Caddy starts.
|
|
Caddy requests and renews the origin certificate automatically; use
|
|
Cloudflare Full (strict) only after HTTPS succeeds.
|
|
5. Complete and verify the backup/restore setup before starting production.
|
|
The repository does not yet contain a tested backup script; do not continue
|
|
until the owner has approved and tested one.
|
|
6. Check the rendered configuration:
|
|
|
|
```bash
|
|
docker compose --env-file .env -f compose.yaml config
|
|
```
|
|
|
|
7. Start the services:
|
|
|
|
```bash
|
|
docker compose --env-file .env -f compose.yaml up -d --build
|
|
docker compose --env-file .env -f compose.yaml ps
|
|
curl -fsS https://akyldash.kg/review >/dev/null
|
|
```
|
|
|
|
8. Load the versioned index and switch its alias only after the import and
|
|
validation succeed, after creating another verified pre-change backup.
|
|
|
|
## Initial administrator and accounts
|
|
|
|
After starting the backend for the first time, create the initial `admin`
|
|
account with an interactive password prompt:
|
|
|
|
```bash
|
|
docker compose --env-file .env -f compose.yaml exec backend python -m search.api --create-admin
|
|
```
|
|
|
|
The account database is stored at `DATA_ROOT/search-users.sqlite3`. Back it up
|
|
alongside the review database. Sign in at `/review`; `admin` can create accounts
|
|
with temporary passwords. Each new account must replace its temporary password
|
|
at first sign-in. Only the `admin` login can create, reset, or delete accounts.
|
|
|
|
If the `admin` password is lost, reset it in an interactive terminal with:
|
|
|
|
```bash
|
|
docker compose --env-file .env -f compose.yaml exec backend python -m search.api --reset-admin-password
|
|
```
|
|
|
|
The next sign-in requires another password change. Serve the backend behind
|
|
HTTPS, rate-limit login requests at the reverse proxy, and keep
|
|
`COOKIE_SECURE=true` in production.
|
|
|
|
This is a deployment baseline, not a public internet exposure recipe. TLS,
|
|
backups, monitoring, and a production OpenSearch security configuration must
|
|
be provided by the host reverse proxy/operations setup.
|