Add deployment build script to restore capture directory permissions

This commit is contained in:
2026-11-02 05:08:15 +09:00
parent 62afa4b272
commit 924f2e0506
3 changed files with 19 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
/build.sh text eol=lf
Executable
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
if [[ $EUID -ne 0 ]]; then
echo 'Run this deployment build as root: sudo ./build.sh' >&2
exit 1
fi
# Check the service account before replacing dist.
sunrise_group=$(id -gn sunrise)
npm run build
install -d -o sunrise -g "$sunrise_group" -m 755 dist/threads-captures
echo 'Build complete; dist/threads-captures is writable by sunrise.'
+2 -2
View File
@@ -41,7 +41,7 @@ root에서 실행합니다. 캡처 저장 위치는 기존 dist/threads-captures
cd /opt/sunrise cd /opt/sunrise
git pull --ff-only git pull --ff-only
npm ci npm ci
npm run build ./build.sh
install -d -o sunrise -g "$(id -gn sunrise)" -m 755 dist/threads-captures install -d -o sunrise -g "$(id -gn sunrise)" -m 755 dist/threads-captures
install -d -o sunrise -g "$(id -gn sunrise)" -m 700 data/threads install -d -o sunrise -g "$(id -gn sunrise)" -m 700 data/threads
chown -R sunrise:"$(id -gn sunrise)" data/threads dist/threads-captures chown -R sunrise:"$(id -gn sunrise)" data/threads dist/threads-captures
@@ -88,7 +88,7 @@ sudo -iu sunrise sh -lc 'cd /opt/sunrise && npm run threads:post-now'
별도 브라우저 경로를 사용하면 테스트 터미널에도 동일한 환경변수를 적용하세요. post-now는 실행할 때마다 새 테스트 게시물을 만듭니다. preview 이미지는 확인용으로 보존합니다. 별도 브라우저 경로를 사용하면 테스트 터미널에도 동일한 환경변수를 적용하세요. post-now는 실행할 때마다 새 테스트 게시물을 만듭니다. preview 이미지는 확인용으로 보존합니다.
이후 배포는 git pull, 필요 시 npm ci, npm run build, 웹 서버 재시작, `systemctl restart sunrise-threads.service` 순서입니다. 설정/문구는 다시 복사하지 않습니다. root로 빌드한 뒤에는 아래 명령으로 캡처 폴더를 다시 만들고 권한을 맞추세요. 이후 배포는 git pull, 필요 시 npm ci, ./build.sh, 웹 서버 재시작, `systemctl restart sunrise-threads.service` 순서입니다. 설정/문구는 다시 복사하지 않습니다. root에서 ./build.sh를 실행하면 빌드 후 캡처 폴더 생성과 권한 설정까지 처리합니다. npm run build를 직접 실행했다면 아래 명령이 필요합니다.
```bash ```bash
install -d -o sunrise -g "$(id -gn sunrise)" -m 755 /opt/sunrise/dist/threads-captures install -d -o sunrise -g "$(id -gn sunrise)" -m 755 /opt/sunrise/dist/threads-captures