Add code to create minio bucket
This commit is contained in:
@@ -43,6 +43,20 @@ ssh deploy@YOUR_HOST "chmod 600 /opt/vigilcare-records/.env"
|
||||
|
||||
Fill in `.env` from [`.env.example`](../.env.example) first — generate `JWT_SECRET` with `openssl rand -base64 48`, and get real credentials for the shared Postgres/Redis/MinIO/Seq services from whoever manages that stack. CD never uploads or overwrites `.env`; only the `IMAGE_TAG` line is patched automatically on each release.
|
||||
|
||||
Create the Records MinIO bucket once (the API also creates it on startup if missing):
|
||||
|
||||
```bash
|
||||
ssh deploy@YOUR_HOST bash -euo pipefail <<'EOF'
|
||||
cd /opt/vigilcare-records
|
||||
env_val() { sed -n "s/^${1}=//p" .env | tail -n1 | tr -d '\r'; }
|
||||
ACCESS="$(env_val MINIO_ACCESS_KEY)"
|
||||
SECRET="$(env_val MINIO_SECRET_KEY)"
|
||||
BUCKET="$(env_val MINIO_BUCKET_NAME)"; BUCKET="${BUCKET:-vigilcare-records-scans}"
|
||||
docker run --rm --network shared-services --entrypoint /bin/sh minio/mc \
|
||||
-c "mc alias set local http://minio:9000 '${ACCESS}' '${SECRET}' && mc mb --ignore-existing local/${BUCKET}"
|
||||
EOF
|
||||
```
|
||||
|
||||
## 4. Gitea secrets and variables
|
||||
|
||||
Repo → **Settings** → **Actions**.
|
||||
@@ -53,7 +67,7 @@ Repo → **Settings** → **Actions**.
|
||||
|---|---|
|
||||
| `REGISTRY_USERNAME` | `docker login` |
|
||||
| `REGISTRY_TOKEN` | `docker login` (access token / PAT with package write) |
|
||||
| `PG_CONNECTION_DDL` | migrate job only — DDL-privileged connection to the shared Postgres, never given to the API container |
|
||||
| `PG_CONNECTION_DDL` | migrate job only — DDL-privileged connection (`Host=postgres` on `shared-services`), never given to the API container |
|
||||
| `DEPLOY_HOST` | SSH / SCP |
|
||||
| `DEPLOY_USER` | SSH / SCP |
|
||||
| `DEPLOY_SSH_KEY` | Private key PEM / OpenSSH private key body |
|
||||
@@ -72,7 +86,7 @@ git tag v1.0.0
|
||||
git push origin v1.0.0
|
||||
```
|
||||
|
||||
This triggers `.gitea/workflows/cd.yml`: build & push both images → apply EF Core migrations against `PG_CONNECTION_DDL` → SSH deploy (`scp` the prod compose file, patch `IMAGE_TAG`, `pull` + `up -d`) → smoke test (`/health/ready`, dashboard `/`) → automatic rollback to the previous `IMAGE_TAG` on failure (schema changes are not reverted; see the expand/contract note in `cd.yml`).
|
||||
This triggers `.gitea/workflows/cd.yml`: build & push both images → SSH the EF migrations bundle onto the deploy host and run it on `shared-services` with `PG_CONNECTION_DDL` → SSH deploy (`scp` the prod compose file, patch `IMAGE_TAG`, `pull` + `up -d`) → smoke test (`/health/ready`, dashboard `/`) → automatic rollback to the previous `IMAGE_TAG` on failure (schema changes are not reverted; see the expand/contract note in `cd.yml`).
|
||||
|
||||
Manual redeploy of an existing tag: Gitea UI → Actions → CD → Run workflow, with `image_tag` input.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user