Refactor deployment workflow to utilize GitHub Actions for improved efficiency. Updated deploy.yml to include actions for checkout and Node.js setup, streamlined build process for Next.js with prebuilt assets, and revised deployment script to eliminate unnecessary steps. Enhanced documentation for clarity on automated deployment process.
This commit is contained in:
1 parent
bd2cfa5a26
commit
e1b5286946
5 files changed
+90
-39
No files matched your search
+9
-12
@@ -1,10 +1,16 @@
|
||||
# Production deployment
|
||||
|
||||
The production site is https://edu.mstaut.ir. Gitea runs on the same VPS.
|
||||
Pushes to `master` run `.gitea/workflows/deploy.yml` on the existing
|
||||
`local-host` runner. The checkout lives at `/opt/prod/Aut.ManagementFaculty`.
|
||||
|
||||
`scripts/deploy-production.sh` builds a Next.js standalone Docker image,
|
||||
**Normal releases are fully automatic:** a push to `master` (or
|
||||
*workflow_dispatch* in Gitea) runs `.gitea/workflows/deploy.yml` on the
|
||||
`local-host` runner — checkout, `npm ci` + `next build` on the runner host
|
||||
(with npm cache), then `scripts/deploy-production.sh` with a prebuilt tree
|
||||
(`Dockerfile.prebuilt`: no second `npm ci` / compile inside Docker). Backup,
|
||||
migrations, smoke checks, and container swap need no manual steps.
|
||||
|
||||
`scripts/deploy-production.sh` builds the Docker image from `PREBUILT_DIR` in CI
|
||||
(or from the full root `Dockerfile` only for emergency/local use without CI),
|
||||
backs up the database to `/opt/backups/edu`, applies versioned migrations
|
||||
(`node db/migrate.mjs` — idempotent via `schema_migrations`), checks a
|
||||
candidate container, and replaces `aut-management-faculty`. It retains the
|
||||
@@ -30,15 +36,6 @@ port 443, with `edu.mstaut.ir` as the origin host name. Leave the ACME
|
||||
challenge path accessible for certificate renewal and bypass caching for
|
||||
admin pages, API requests, and authenticated traffic.
|
||||
|
||||
To deploy manually on the VPS:
|
||||
|
||||
```sh
|
||||
cd /opt/prod/Aut.ManagementFaculty
|
||||
git fetch origin master
|
||||
git checkout --detach origin/master
|
||||
bash scripts/deploy-production.sh
|
||||
```
|
||||
|
||||
To inspect a deployment:
|
||||
|
||||
```sh
|
||||
|
||||
Reference in new issue
Block a user