feat: add production deploy helper
This commit is contained in:
@@ -24,8 +24,9 @@ This is intentional. For a private repository, server-side `git clone` adds unne
|
||||
|
||||
### Production
|
||||
- same deployment mechanism
|
||||
- different server
|
||||
- usually a different server
|
||||
- env file on server: `.env.prod`
|
||||
- branch: `main`
|
||||
- should run behind real HTTPS
|
||||
- should keep `DEBUG=0`
|
||||
|
||||
@@ -198,6 +199,44 @@ HEALTH_URL=http://192.168.2.55:8088/healthz/ \
|
||||
./scripts/deploy_test_from_mac.sh
|
||||
```
|
||||
|
||||
## Manual production deployment
|
||||
For production, use a dedicated helper instead of the test script.
|
||||
|
||||
### One-command production deployment from your Mac
|
||||
Use:
|
||||
```bash
|
||||
./scripts/deploy_prod_from_mac.sh
|
||||
```
|
||||
|
||||
What it does:
|
||||
1. requires the current branch to be `main`
|
||||
2. fast-forwards from `origin/main`
|
||||
3. verifies that the server env file exists before syncing
|
||||
4. syncs the repo to the production path via `rsync`
|
||||
5. runs the remote deployment script with `RUN_DJANGO_CHECK=1`
|
||||
6. verifies the production health endpoint
|
||||
7. prints the deployed commit and branch
|
||||
|
||||
Important:
|
||||
- the production helper preserves server-local env files:
|
||||
- `.env.test`
|
||||
- `.env.prod`
|
||||
- do not use the test helper for production
|
||||
|
||||
Default assumptions:
|
||||
- target host: `root@192.168.2.55`
|
||||
- target path: `/opt/workdock`
|
||||
- env file: `.env.prod`
|
||||
- health URL: `https://workdock.bostame.de/healthz/`
|
||||
|
||||
Optional overrides:
|
||||
```bash
|
||||
DEPLOY_HOST=root@192.168.2.55 \
|
||||
DEPLOY_PATH=/opt/workdock \
|
||||
HEALTH_URL=https://workdock.bostame.de/healthz/ \
|
||||
./scripts/deploy_prod_from_mac.sh
|
||||
```
|
||||
|
||||
### Manual server-side deploy only
|
||||
If the latest code is already on the server:
|
||||
```bash
|
||||
@@ -208,7 +247,7 @@ RUN_DJANGO_CHECK=0 DEPLOY_HEALTH_URL="http://127.0.0.1:8088/healthz/" ./scripts/
|
||||
Manual production deployment:
|
||||
```bash
|
||||
cd /opt/workdock
|
||||
RUN_DJANGO_CHECK=1 ./scripts/deploy_stack.sh .env.prod docker-compose.prod.yml
|
||||
RUN_DJANGO_CHECK=1 DEPLOY_HEALTH_URL="https://workdock.bostame.de/healthz/" ./scripts/deploy_stack.sh .env.prod docker-compose.prod.yml
|
||||
```
|
||||
|
||||
## Runtime config sync
|
||||
|
||||
Reference in New Issue
Block a user