Merge origin/master: keep upload volume and secure DATABASE_URL
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
a99af426db
6 files changed
+174
-5
No files matched your search
@@ -0,0 +1,45 @@
|
||||
# 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,
|
||||
backs up the database, applies versioned migrations, checks a candidate
|
||||
container, and replaces `aut-management-faculty`. It retains the previous
|
||||
container and automatically restores it if the new container fails its
|
||||
initial HTTPS check. Database migrations are not automatically reversed.
|
||||
|
||||
Production settings are stored in `/etc/edu-production.env`, owned by root
|
||||
with mode `600`. It contains `DATABASE_URL`, `NEXT_PUBLIC_SITE_URL`,
|
||||
`NODE_ENV`, `PORT`, and `HOSTNAME`. Database credentials must never be
|
||||
committed. The database host is `insaight-postgres` on
|
||||
`shared_web_network`. Database dumps are in `/opt/backups/edu`.
|
||||
|
||||
Nginx proxies HTTPS to `127.0.0.1:3000`; the application port is bound only
|
||||
to loopback. Nginx configuration is
|
||||
`/etc/nginx/sites-available/edu.mstaut.ir.conf`. Certbot manages the
|
||||
certificate under `/etc/letsencrypt/live/edu.mstaut.ir`, with automatic
|
||||
renewal via `certbot.timer`.
|
||||
|
||||
When enabling ArvanCloud, use HTTPS for the connection to the origin on
|
||||
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
|
||||
docker logs --tail 100 aut-management-faculty
|
||||
curl --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/
|
||||
certbot renew --cert-name edu.mstaut.ir --dry-run
|
||||
```
|
||||
Reference in new issue
Block a user