# Deployment ## Current status Production deployment is not enabled or tested on the VPS. The owner completed the root bootstrap: Docker/Compose are active and target directories exist. The `codex` account cannot access the Docker socket. No root-owned checkout or restricted helpers are installed; protected env/secret metadata and Docker container/volume state remain unverified because they require root. The unprivileged audit sees no listener on `80`, `443`, or `1500`; Cloudflare still returns `521`. Do not deploy until the owner has reviewed root-only host state, supplied protected configuration and the approved corpus/index, and backup/restore have been tested. ## First host preparation 1. The initial root bootstrap is complete. After reviewing and merging the infrastructure PR, the owner must install that approved `main` checkout at `/opt/akyldash/current` (the path was absent during the unprivileged audit): ```bash sudo git clone --branch main --single-branch https://git.vakanaut.ru/admin/akyldash.git /opt/akyldash/current ``` The checkout is root-owned by default. Then run `sudo bash /opt/akyldash/current/infra/bootstrap/audit-host.sh`. This read-only audit reports Docker state, protected-file metadata, UFW rules, listeners, and ISPmanager without printing secret contents. Resolve any existing containers, volumes, or data before proceeding; do not overwrite or delete them. 2. After confirming the existing env and secret do not exist and reviewing the tracked defaults, run `sudo bash /opt/akyldash/current/infra/deploy/prepare-production-config.sh`. It creates `/etc/akyldash/production.env` from the tracked example and generates `/etc/akyldash/review_secret`; both are root-owned mode `0600`. It refuses to overwrite either file and does not start services or create volumes. Review `DATA_ROOT` and place the approved normalized corpus there before deployment. 3. After reviewing the root-owned checkout and audit output, run `sudo bash /opt/akyldash/current/infra/deploy/install-helper.sh`. It installs the backup reader, read-only verifier, `akyldash-compose config|status`, and rollback helper with exact sudoers command rules. The Compose helper has no start/stop/build operation and grants no direct Docker access. Actual deployments remain owner-run through the documented Compose commands. 4. Confirm DNS points through Cloudflare to this origin. The owner reports UFW already allows TCP `80` and `443`; read and document the full rules before any firewall decision. TCP `1500` is allowed by owner report but has no observed listener and no ISPmanager package/service was found; the owner must identify its purpose. Do not change UFW as part of this procedure. The Compose Caddy service obtains and renews HTTPS certificates automatically; Cloudflare Full (strict) still needs end-to-end verification. 5. For a clean first deployment, skip backup only when Compose confirms there are no containers and all persistent mounts are empty. If any data exists, create and verify a backup before starting a new version. For a preloaded corpus with absent named volumes, use `--initial-deployment`; it is limited to a container-free host whose `DATA_ROOT` contains only `minjust-normalized/`. Normal backups reject absent volumes. An uncertain or partial state stops deployment. Then start services, load and validate the OpenSearch index, create the initial admin interactively, verify `/review` over HTTPS, and create the required post-setup baseline backup described in `BACKUP.md`. Record the backend image ID for drift checks: ```bash sudo sh -c 'docker compose --env-file /etc/akyldash/production.env -f /opt/akyldash/current/deploy/production/compose.yaml ps --quiet backend | xargs -r docker inspect --format "{{.Image}}" > /opt/akyldash/deployed-image.txt' sudo chmod 0600 /opt/akyldash/deployed-image.txt ``` Application deployment remains owner-run. A repository-level Actions runner installation is prepared in [CI_RUNNER.md](CI_RUNNER.md), but it is not yet installed or registered; its Online state and smoke workflow are unverified. The runner's job containers have no Docker socket or production secrets. CI has no image publishing or production deployment step. The installed sudo helpers support fixed verification, read-only Compose `config`/`status`, and guarded rollback. They do not start or stop services. ## CI `.gitea/workflows/ci.yaml` runs the Python unit suites and builds both production images on pull requests and pushes to `main`. It does not publish an image or deploy production. `.gitea/workflows/runner-smoke.yaml` exercises the `akyldash-ci` runner on pull requests, pushes to `main`, or manual dispatch. Runner registration is incomplete, so neither workflow execution on that runner nor current `ubuntu-latest` runner availability has been confirmed.