Allow worker repo shared perms
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
8a002e530e83cd343af64755c4c2dffacc5e2d2c- Parents
-
0d477a4 - Tree
d1d7ccc
8a002e5
8a002e530e83cd343af64755c4c2dffacc5e2d2c0d477a4
d1d7ccc| Status | File | + | - |
|---|---|---|---|
| M |
.github/workflows/deploy.yml
|
1 | 1 |
| M |
deploy/redeploy.sh
|
9 | 2 |
| M |
deploy/systemd/shithubd-worker.service
|
7 | 1 |
.github/workflows/deploy.ymlmodified@@ -87,7 +87,7 @@ jobs: | ||
| 87 | 87 | DEPLOY_USER: ${{ secrets.DEPLOY_USER }} |
| 88 | 88 | run: | |
| 89 | 89 | ssh -o BatchMode=yes "${DEPLOY_USER}@${DEPLOY_HOST}" \ |
| 90 | - 'bash /root/src/shithub/deploy/redeploy.sh' | |
| 90 | + 'cd /root/src/shithub && git fetch --quiet origin trunk && git reset --hard origin/trunk && bash deploy/redeploy.sh' | |
| 91 | 91 | |
| 92 | 92 | # Mirror the just-deployed SHA to the self-hosted shithub.sh |
| 93 | 93 | # instance so anyone reading the source on shithub.sh sees the |
deploy/redeploy.shmodified@@ -14,8 +14,9 @@ | ||
| 14 | 14 | # 1. fast-forward the source tree so deploy/ artifacts (this script, |
| 15 | 15 | # systemd units, env templates) match the binary that just landed |
| 16 | 16 | # 2. atomically swap /usr/local/bin/shithubd |
| 17 | -# 3. apply pending migrations BEFORE restart (forward-compat only) | |
| 18 | -# 4. restart web + worker, assert is-active | |
| 17 | +# 3. install app systemd unit templates and daemon-reload | |
| 18 | +# 4. apply pending migrations BEFORE restart (forward-compat only) | |
| 19 | +# 5. restart web + worker, assert is-active | |
| 19 | 20 | |
| 20 | 21 | set -euo pipefail |
| 21 | 22 | |
@@ -37,6 +38,12 @@ git reset --hard origin/trunk | ||
| 37 | 38 | chmod 0755 "$NEW" |
| 38 | 39 | mv -f "$NEW" "$BIN" |
| 39 | 40 | |
| 41 | +install -m 0644 deploy/systemd/shithubd-web.service /etc/systemd/system/shithubd-web.service | |
| 42 | +install -m 0644 deploy/systemd/shithubd-worker.service /etc/systemd/system/shithubd-worker.service | |
| 43 | +install -m 0644 deploy/systemd/shithubd-cron.service /etc/systemd/system/shithubd-cron.service | |
| 44 | +install -m 0644 deploy/systemd/shithubd-cron.timer /etc/systemd/system/shithubd-cron.timer | |
| 45 | +systemctl daemon-reload | |
| 46 | + | |
| 40 | 47 | # Migrations are usually invoked by the web unit's ExecStartPre, which |
| 41 | 48 | # pulls env from /etc/shithub/web.env. Replicate that here so we apply |
| 42 | 49 | # the schema before the restart instead of mid-startup race. |
deploy/systemd/shithubd-worker.servicemodified@@ -25,7 +25,13 @@ ProtectKernelLogs=yes | ||
| 25 | 25 | ProtectControlGroups=yes |
| 26 | 26 | RestrictNamespaces=yes |
| 27 | 27 | RestrictRealtime=yes |
| 28 | -RestrictSUIDSGID=yes | |
| 28 | +# RestrictSUIDSGID intentionally OFF: org GitHub imports create repos | |
| 29 | +# from the worker, and `git init --bare --shared=group` calls chmod g+s | |
| 30 | +# on the directories it creates so cross-user writes inherit the shared | |
| 31 | +# group. With RestrictSUIDSGID=yes the kernel returns EPERM and git emits | |
| 32 | +# "Could not make .../branches/ writable by group", leaving imports | |
| 33 | +# failed before any fetch occurs. | |
| 34 | +RestrictSUIDSGID=no | |
| 29 | 35 | LockPersonality=yes |
| 30 | 36 | |
| 31 | 37 | [Install] |