Compare commits
2
Commits
689a485fce
...
8410d9f63a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8410d9f63a | ||
|
|
b22e89001a |
No files matched your search
+18
-24
@@ -12,28 +12,12 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
# One job, not test + deploy: every job starts in a fresh container, so two jobs meant checking out,
|
||||||
runs-on: ubuntu-latest
|
# setting up Node, `npm ci` and building twice (~2 min each, 2026-11-08). The deploy steps only run
|
||||||
steps:
|
# for pushes to master; on pull requests the job ends after the build. The condition is spelled out
|
||||||
- uses: actions/checkout@v4
|
# on every deploy step rather than stored in an env flag: a flag compared as a string ('true') would
|
||||||
- uses: actions/setup-node@v4
|
# skip the deploy silently - and green - if the runner ever rendered the boolean differently.
|
||||||
with:
|
test-and-deploy:
|
||||||
# Same major as Passenger on the server (26.13.0 as of 2026-11-08).
|
|
||||||
node-version-file: .nvmrc
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run lint
|
|
||||||
- run: npx tsc --noEmit
|
|
||||||
- run: npm test
|
|
||||||
# Proves the production build works, with the production values: NEXT_PUBLIC_* are inlined
|
|
||||||
# at build time, and lib/env.ts fails the build if one is missing.
|
|
||||||
- run: npm run build
|
|
||||||
env:
|
|
||||||
NEXT_PUBLIC_API_BASE_URL: ${{ vars.NEXT_PUBLIC_API_BASE_URL }}
|
|
||||||
NEXT_PUBLIC_ADMIN_APP_URL: ${{ vars.NEXT_PUBLIC_ADMIN_APP_URL }}
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
needs: test
|
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
|
||||||
@@ -48,8 +32,14 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
|
# Same major as Passenger on the server (26.13.0 as of 2026-11-08).
|
||||||
node-version-file: .nvmrc
|
node-version-file: .nvmrc
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
- run: npm run lint
|
||||||
|
- run: npx tsc --noEmit
|
||||||
|
- run: npm test
|
||||||
|
# The production build, with the production values: NEXT_PUBLIC_* are inlined at build time,
|
||||||
|
# and lib/env.ts fails the build if one is missing. On master this is also what gets deployed.
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
env:
|
env:
|
||||||
@@ -60,9 +50,11 @@ jobs:
|
|||||||
# own there (server.js serves .next/static), so an empty public/ is enough. Created here so
|
# own there (server.js serves .next/static), so an empty public/ is enough. Created here so
|
||||||
# rsync --delete doesn't remove it on the server.
|
# rsync --delete doesn't remove it on the server.
|
||||||
- name: Prepare bundle
|
- name: Prepare bundle
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
run: mkdir -p .next/standalone/public
|
run: mkdir -p .next/standalone/public
|
||||||
|
|
||||||
- name: SSH setup
|
- name: SSH setup
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
env:
|
env:
|
||||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||||
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
||||||
@@ -79,6 +71,7 @@ jobs:
|
|||||||
printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$SSH_DIR/known_hosts"
|
printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$SSH_DIR/known_hosts"
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
# Straight into the app folder (no release folders - decided 2026-11-08; a rollback is a
|
# Straight into the app folder (no release folders - decided 2026-11-08; a rollback is a
|
||||||
# redeploy of an older commit). That folder is the one Plesk created for the subdomain,
|
# redeploy of an older commit). That folder is the one Plesk created for the subdomain,
|
||||||
@@ -89,6 +82,7 @@ jobs:
|
|||||||
.next/standalone/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
|
.next/standalone/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
|
||||||
|
|
||||||
- name: Restart
|
- name: Restart
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
# Passenger restarts the app on its next request when tmp/restart.txt is touched.
|
# Passenger restarts the app on its next request when tmp/restart.txt is touched.
|
||||||
ssh -p "${DEPLOY_PORT:-22}" -i "$SSH_DIR/key" -o "UserKnownHostsFile=$SSH_DIR/known_hosts" \
|
ssh -p "${DEPLOY_PORT:-22}" -i "$SSH_DIR/key" -o "UserKnownHostsFile=$SSH_DIR/known_hosts" \
|
||||||
@@ -98,7 +92,7 @@ jobs:
|
|||||||
# Optional until Plesk serves the Node app: set DEPLOY_SMOKE_URL then. Checks the page loads
|
# Optional until Plesk serves the Node app: set DEPLOY_SMOKE_URL then. Checks the page loads
|
||||||
# and references the build's static files (the classic standalone failure is missing CSS/JS).
|
# and references the build's static files (the classic standalone failure is missing CSS/JS).
|
||||||
- name: Smoke test
|
- name: Smoke test
|
||||||
if: vars.DEPLOY_SMOKE_URL != ''
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && vars.DEPLOY_SMOKE_URL != ''
|
||||||
env:
|
env:
|
||||||
DEPLOY_SMOKE_URL: ${{ vars.DEPLOY_SMOKE_URL }}
|
DEPLOY_SMOKE_URL: ${{ vars.DEPLOY_SMOKE_URL }}
|
||||||
run: |
|
run: |
|
||||||
@@ -112,5 +106,5 @@ jobs:
|
|||||||
echo "OK: page and $asset served"
|
echo "OK: page and $asset served"
|
||||||
|
|
||||||
- name: Remove key
|
- name: Remove key
|
||||||
if: always()
|
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
run: rm -f "$SSH_DIR/key"
|
run: rm -f "$SSH_DIR/key"
|
||||||
+6
-4
@@ -7,13 +7,15 @@ real deploy settles them - record the outcome here.
|
|||||||
|
|
||||||
```
|
```
|
||||||
push to master ──▶ Gitea ──▶ runner (Docker container on the Plesk server)
|
push to master ──▶ Gitea ──▶ runner (Docker container on the Plesk server)
|
||||||
├─ test job: npm ci, lint, tsc, test, build
|
└─ one job: npm ci, lint, tsc, test, build
|
||||||
└─ deploy job: build ─ rsync over SSH ─▶ plesk-nachklang@server:<app root>
|
└─ (master only) rsync over SSH ─▶ plesk-nachklang@server:<app root>
|
||||||
└─ touch tmp/restart.txt
|
└─ touch tmp/restart.txt
|
||||||
browser ──https──▶ Plesk (nginx + Passenger) ──▶ <app root>/server.js
|
browser ──https──▶ Plesk (nginx + Passenger) ──▶ <app root>/server.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Pull requests only run the test job.
|
Pull requests run the same job up to the build; the deploy steps only run for pushes to master.
|
||||||
|
It used to be two jobs (test, then deploy); since every job starts in a fresh container that meant
|
||||||
|
`npm ci` and the build twice (~2 min each), so they were merged on 2026-11-08.
|
||||||
|
|
||||||
## Why SSH and not mounted paths
|
## Why SSH and not mounted paths
|
||||||
|
|
||||||
@@ -155,7 +157,7 @@ to port 3000 if Passenger doesn't intercept.
|
|||||||
4. **Back up the Angular build**: download `calendar.nachklang.art/` as a ZIP in Plesk's file
|
4. **Back up the Angular build**: download `calendar.nachklang.art/` as a ZIP in Plesk's file
|
||||||
manager. The first deploy replaces those files, and this backup is the quick way back.
|
manager. The first deploy replaces those files, and this backup is the quick way back.
|
||||||
5. **Merge** `feature/nextjs-rewrite` into master and watch the run under *Actions*. When the
|
5. **Merge** `feature/nextjs-rewrite` into master and watch the run under *Actions*. When the
|
||||||
deploy job has finished, the folder holds the Next app but Plesk still serves it as static
|
deploy steps have finished, the folder holds the Next app but Plesk still serves it as static
|
||||||
files - **the subdomain is down from here until step 6** (no `index.html` any more).
|
files - **the subdomain is down from here until step 6** (no `index.html` any more).
|
||||||
6. **Step 5 above, right away** - switch the subdomain to the Node app. This is the moment the new
|
6. **Step 5 above, right away** - switch the subdomain to the Node app. This is the moment the new
|
||||||
app goes live; doing it right after the run keeps the gap to a few minutes. (Plesk might accept
|
app goes live; doing it right after the run keeps the gap to a few minutes. (Plesk might accept
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ Collected during the rewrite (September 2026); the progress log in
|
|||||||
an `ssh host 'cmd'` never runs, exit 255). The deploy user uses plain `/bin/bash` instead.
|
an `ssh host 'cmd'` never runs, exit 255). The deploy user uses plain `/bin/bash` instead.
|
||||||
- **SSH is on port 42069**, not 22 (22 is closed); the deploy user is `plesk-nachklang`, not
|
- **SSH is on port 42069**, not 22 (22 is closed); the deploy user is `plesk-nachklang`, not
|
||||||
`nachklang`.
|
`nachklang`.
|
||||||
|
- **Jenkins deployed as root.** Files it copied into an app folder belong to `root:root`, so the
|
||||||
|
first Gitea deploy (as `plesk-nachklang`) fails with rsync "Operation not permitted" / "Permission
|
||||||
|
denied". Before switching an app, run `find . ! -user plesk-nachklang` in its folder and
|
||||||
|
`chown -R plesk-nachklang:psacln` what it lists (hit on the API, 2026-11-08; the calendar folder
|
||||||
|
only held files directly in a folder the user owned, so deleting them worked).
|
||||||
|
- **Every Gitea Actions job starts in a fresh container.** Splitting test and deploy into two jobs
|
||||||
|
repeats checkout, Node setup and `npm ci` (and here the build); one job with the deploy steps
|
||||||
|
conditioned on push-to-master is faster. Spell the condition out on each step instead of comparing
|
||||||
|
an env flag to `'true'` - a mismatch there skips the deploy silently and the run stays green.
|
||||||
- **Disable the Jenkins job before merging to master**, or it runs `ng build` on the next push.
|
- **Disable the Jenkins job before merging to master**, or it runs `ng build` on the next push.
|
||||||
|
|
||||||
## shadcn / Base UI
|
## shadcn / Base UI
|
||||||
|
|||||||
Reference in new issue
Block a user