Documents the deploy user and test folder rights
The pipeline logs in as gitea-workflow, a member of the www-data group. The test folder needs group write access (775, or 2775 with setgid); new folders get 755 by default, which made the first deploys fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -774,3 +774,15 @@ Verder heb ik de vraag ook beantwoord"
|
|||||||
**Context**: OPERATIONS - Deployment Setup
|
**Context**: OPERATIONS - Deployment Setup
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Deployment Setup - Deploy User and Folder Rights in Instructions
|
||||||
|
|
||||||
|
**Timestamp**: 2026-10-19T07:41:36Z
|
||||||
|
|
||||||
|
**User Input**: "kan in de deployinstructies worden opgenomen dat voor de pipeline de gebruiker gitea-workflow gebruikt moet worden. die zit in de www-data groep en die groep moet wel schrijfrechten hebben. ik had bijvoorbeeld met de webadmin gebruiker in filezilla de map aangemaakt. die zit ook in de www-data groep, maar de rechten worden standaard 755 en die staan nu op 775 en dat werkte dus."
|
||||||
|
|
||||||
|
**AI Response**: "Updated deployment-instructions.md: PI_MAIN_USERNAME = gitea-workflow (member of www-data); step 1.2.1 now creates the folder with chgrp www-data and chmod 2775, explains the 755 default (FileZilla/mkdir) pitfall, setgid tip, and the external-disk symlink; added a troubleshooting row for mkdir/scp Permission denied. Pushing to the PR #4 branch (restarts the PR run)."
|
||||||
|
|
||||||
|
**Context**: OPERATIONS - Deployment Setup
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
+11
-3
@@ -13,7 +13,7 @@ In Gitea, under **Repository → Settings → Actions**:
|
|||||||
|---|---|
|
|---|---|
|
||||||
| `PI_MAIN_ADDRESS` | Address of the Pi as reachable from the runner (same as in your other projects) |
|
| `PI_MAIN_ADDRESS` | Address of the Pi as reachable from the runner (same as in your other projects) |
|
||||||
| `PI_MAIN_PORT` | SSH port |
|
| `PI_MAIN_PORT` | SSH port |
|
||||||
| `PI_MAIN_USERNAME` | SSH user |
|
| `PI_MAIN_USERNAME` | `gitea-workflow`: the deploy user for pipelines, member of the `www-data` group (see 1.2) |
|
||||||
| `PI_MAIN_PASSWORD` | SSH password (see 1.4 for switching to a key) |
|
| `PI_MAIN_PASSWORD` | SSH password (see 1.4 for switching to a key) |
|
||||||
| `FTP_HOST` | Domain or A-record IP of the hosting space (control panel) |
|
| `FTP_HOST` | Domain or A-record IP of the hosting space (control panel) |
|
||||||
| `FTP_USERNAME` | FTP account **including** the FTP prefix |
|
| `FTP_USERNAME` | FTP account **including** the FTP prefix |
|
||||||
@@ -33,11 +33,18 @@ Check that Actions is enabled for the repository. The global runner `raspberry-p
|
|||||||
### 1.2 Test server (Raspberry Pi with nginx)
|
### 1.2 Test server (Raspberry Pi with nginx)
|
||||||
The current WordPress site runs on the same Pi. The test site gets its **own folder** and its **own nginx block**, and touches nothing of WordPress.
|
The current WordPress site runs on the same Pi. The test site gets its **own folder** and its **own nginx block**, and touches nothing of WordPress.
|
||||||
|
|
||||||
1. Create a separate folder, **not** inside the WordPress folder:
|
1. Create a separate folder, **not** inside the WordPress folder, and give the `www-data` group **write** access.
|
||||||
|
|
||||||
|
The pipeline logs in as **`gitea-workflow`**, a member of the `www-data` group. Group write access on the folder is enough; `gitea-workflow` does not need to own it. The folder may be created by another user, for example `webadmin` (also in `www-data`) via FileZilla.
|
||||||
```bash
|
```bash
|
||||||
sudo mkdir -p /var/www/html/andreaslop-test
|
sudo mkdir -p /var/www/html/andreaslop-test
|
||||||
sudo chown <ssh-user> /var/www/html/andreaslop-test
|
sudo chgrp www-data /var/www/html/andreaslop-test
|
||||||
|
sudo chmod 2775 /var/www/html/andreaslop-test
|
||||||
```
|
```
|
||||||
|
- **775 is required.** New folders get **755** by default, also when created with FileZilla or `mkdir`. With 755 the group may only read, and the deploy fails with `Permission denied`. Check it with `ls -ld /var/www/html/andreaslop-test`: it must show `drwxrwxr-x` (or `drwxrwsr-x` with the 2).
|
||||||
|
- **The 2 (setgid)** is optional but recommended. New files and folders in the test folder then also get group `www-data`, so `webadmin` and `gitea-workflow` can keep managing each other's files.
|
||||||
|
- **On the Pi** `/var/www/html` is a symlink to `/mnt/storage1/www/html` (external disk). Rights on the symlink itself are ignored; the folder it points to counts. The commands above work through the symlink.
|
||||||
|
|
||||||
Every deploy empties this folder first. The pipeline refuses a folder with `wp-config.php` or `wp-content` in it.
|
Every deploy empties this folder first. The pipeline refuses a folder with `wp-config.php` or `wp-content` in it.
|
||||||
2. Copy [`web/deploy/nginx/andreaslop-test.conf`](../../../../../web/deploy/nginx/andreaslop-test.conf) to `/etc/nginx/conf.d/andreaslop-test.conf`. nginx loads everything in `conf.d/` automatically, so no symlink is needed. Adjust `server_name` and `root` if needed.
|
2. Copy [`web/deploy/nginx/andreaslop-test.conf`](../../../../../web/deploy/nginx/andreaslop-test.conf) to `/etc/nginx/conf.d/andreaslop-test.conf`. nginx loads everything in `conf.d/` automatically, so no symlink is needed. Adjust `server_name` and `root` if needed.
|
||||||
```bash
|
```bash
|
||||||
@@ -120,5 +127,6 @@ git rm --cached -r -q . && git reset --hard
|
|||||||
| Lighthouse: "Chrome could not be started" | Sandbox | `LIGHTHOUSE_CHROME_FLAGS` must contain `--no-sandbox` (already set). |
|
| Lighthouse: "Chrome could not be started" | Sandbox | `LIGHTHOUSE_CHROME_FLAGS` must contain `--no-sandbox` (already set). |
|
||||||
| `Format` fails only in CI | Line endings | See 1.5. |
|
| `Format` fails only in CI | Line endings | See 1.5. |
|
||||||
| `sshpass`: Permission denied | Wrong secret, or special characters | Secrets go via `env:` (already so); check the values. |
|
| `sshpass`: Permission denied | Wrong secret, or special characters | Secrets go via `env:` (already so); check the values. |
|
||||||
|
| `mkdir: cannot create directory` or `scp: dest open …: Permission denied` | The test folder does not exist, or the `www-data` group may not write to it (755 instead of 775) | See 1.2: `chgrp www-data` and `chmod 2775` on the test folder. |
|
||||||
| `lftp`: certificate verification failed | Hostname does not match the hoster's certificate | Use the hostname from the control panel in `FTP_HOST`, not the IP. |
|
| `lftp`: certificate verification failed | Hostname does not match the hoster's certificate | Use the hostname from the control panel in `FTP_HOST`, not the IP. |
|
||||||
| Health check fails, page is 404 on deep links | SPA fallback missing | Production: `web.config` not uploaded or URL Rewrite off. Test: nginx config not active. |
|
| Health check fails, page is 404 on deep links | SPA fallback missing | Production: `web.config` not uploaded or URL Rewrite off. Test: nginx config not active. |
|
||||||
|
|||||||
Reference in New Issue
Block a user