Document local and production call flows
TaxBaik CI/CD / build-and-deploy (push) Successful in 4m51s
TaxBaik CI/CD / build-and-deploy (push) Successful in 4m51s
This commit is contained in:
@@ -49,7 +49,42 @@
|
||||
- 임시/스크래치 작업(스크린샷, 1회성 디버그 스크립트, 로그)은 저장소 밖(OS/세션 임시 폴더)에서 하고 절대 커밋하지 않는다. 저장소 안에서 꼭 필요하면 `.gitignore`에 등록된 `.scratch/`만 사용한다.
|
||||
- 커밋 전 `git status`로 루트에 낯선 파일이 생기지 않았는지 확인한다. 빌드 산출물(runtimeconfig.json, deps.json, wwwroot 산출물 등)이 루트나 프로젝트 폴더 밖에 커밋되면 안 된다.
|
||||
- 재현 맥락은 페이지별 수동 JS 호출이 아니라 `AdminTelemetryContext` 같은 공통 컴포넌트가 담당한다. 새 어드민 화면은 레이아웃 경유 기본값을 자동 상속해야 하며, 예외만 명시적으로 덮어쓴다.
|
||||
- DB 접속 문자열은 임의로 손대지 않는다. `src/TaxBaik.Web/appsettings.json`과 `src/TaxBaik.Web/appsettings.Development.json`의 `ConnectionStrings:Default`는 `Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=taxbaik123`로 고정하고, 변경이 필요하면 문서와 검증 스크립트를 함께 수정한다.
|
||||
- DB 접속 문자열은 환경별로 분리한다. `src/TaxBaik.Web/appsettings.Development.json`은 로컬 개발용 `Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=taxbaik123`를 사용하고, 운영은 `systemd`의 `ConnectionStrings__Default` 환경 변수로 실제 DB 호스트를 주입한다. 값이 바뀌면 문서와 검증 스크립트를 함께 수정한다.
|
||||
|
||||
## Environment Call Guide
|
||||
|
||||
### Local Test
|
||||
|
||||
- 실행:
|
||||
```powershell
|
||||
$env:ASPNETCORE_ENVIRONMENT = "Development"
|
||||
dotnet watch run --project .\src\TaxBaik.Web\TaxBaik.Web.csproj
|
||||
```
|
||||
- 사용 설정:
|
||||
- [`src/TaxBaik.Web/appsettings.json`](/D:/JobRoomz/taxbaik/src/TaxBaik.Web/appsettings.json)
|
||||
- [`src/TaxBaik.Web/appsettings.Development.json`](/D:/JobRoomz/taxbaik/src/TaxBaik.Web/appsettings.Development.json)
|
||||
- 로그인 검증:
|
||||
- 개발 우회 계정 `test_admin / admin123`
|
||||
- 또는 로컬 DB의 `admin` 계정
|
||||
|
||||
### Production
|
||||
|
||||
- 실행 주체:
|
||||
- `taxbaik-admin.service` 또는 `taxbaik.service`
|
||||
- 확인 명령:
|
||||
```bash
|
||||
ssh kjh2064@178.104.200.7
|
||||
systemctl status taxbaik-admin
|
||||
journalctl -u taxbaik-admin -n 100 --no-pager
|
||||
```
|
||||
- 재시작 명령:
|
||||
```bash
|
||||
ssh kjh2064@178.104.200.7
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart taxbaik-admin
|
||||
sudo systemctl status taxbaik-admin --no-pager -l
|
||||
```
|
||||
- 운영 연결 문자열은 서비스 파일의 `ConnectionStrings__Default`를 확인한다. 로컬 `appsettings.json`을 운영 기준으로 해석하지 않는다.
|
||||
|
||||
## Code Quality Harness
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ GRANT ALL PRIVILEGES ON DATABASE taxbaikdb TO taxbaik;
|
||||
[Service]
|
||||
Environment=ASPNETCORE_ENVIRONMENT=Production
|
||||
Environment=ASPNETCORE_URLS=http://127.0.0.1:5004
|
||||
Environment=ConnectionStrings__Default=Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=your_secure_password
|
||||
Environment=ConnectionStrings__Default=Host=<production-db-host>;Database=taxbaikdb;Username=taxbaik;Password=your_secure_password
|
||||
```
|
||||
|
||||
**프록시 서비스** (`/etc/systemd/system/taxbaik-proxy.service`, 5001 진입점):
|
||||
@@ -179,26 +179,25 @@ journalctl -u taxbaik -f
|
||||
|------|------|------|
|
||||
| 404 /taxbaik | Nginx 설정 미적용 | `sudo nginx -t && sudo systemctl reload nginx` |
|
||||
| Blazor WebSocket 안 됨 | `/taxbaik` location에 `proxy_http_version 1.1`, `Upgrade`, `Connection \"Upgrade\"` 헤더가 모두 있는지 확인 |
|
||||
| DB 연결 오류 | 환경 변수 미설정 | systemd service 파일의 ConnectionStrings__Default 확인 |
|
||||
| 503 Service Unavailable | 백엔드 또는 프록시 미시작 | `sudo systemctl restart taxbaik-proxy taxbaik` |
|
||||
| DB 연결 오류 | 환경 변수 미설정 | systemd service 파일의 `ConnectionStrings__Default` 확인 |
|
||||
| 503 Service Unavailable | 백엔드 또는 프록시 미시작 | `sudo systemctl restart taxbaik-admin` 및 프록시 서비스 확인 |
|
||||
| 마이그레이션 실패 | DB 권한 문제 | `GRANT ALL PRIVILEGES ON DATABASE taxbaikdb TO taxbaik;` |
|
||||
|
||||
## 운영 복구 순서
|
||||
|
||||
```bash
|
||||
ssh kjh2064@178.104.200.7
|
||||
sudo cp /home/kjh2064/taxbaik.service /etc/systemd/system/taxbaik.service
|
||||
sudo cp /home/kjh2064/taxbaik-proxy.service /etc/systemd/system/taxbaik-proxy.service
|
||||
sudo cp /home/kjh2064/taxbaik-admin.service /etc/systemd/system/taxbaik-admin.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart taxbaik-proxy
|
||||
sudo systemctl restart taxbaik
|
||||
curl -I http://127.0.0.1:5001/taxbaik/admin/login
|
||||
sudo systemctl restart taxbaik-admin
|
||||
sudo systemctl status taxbaik-admin --no-pager -l
|
||||
curl -I http://127.0.0.1:5002
|
||||
```
|
||||
|
||||
## 원라인 점검
|
||||
|
||||
```bash
|
||||
ssh kjh2064@178.104.200.7 'systemctl status taxbaik taxbaik-proxy --no-pager --lines=3 && ss -tlnp | grep -E ":5001 |:5004 " && curl -fsSI http://127.0.0.1:5001/taxbaik/admin/login && curl -fsS http://127.0.0.1:5001/taxbaik/favicon.svg >/dev/null && curl -fsS http://127.0.0.1:5001/taxbaik/robots.txt >/dev/null'
|
||||
ssh kjh2064@178.104.200.7 'systemctl status taxbaik-admin --no-pager --lines=3 && ss -tlnp | grep -E ":5002 |:5432 " && curl -fsSI http://127.0.0.1:5002 && curl -fsS http://127.0.0.1:5002/healthz >/dev/null'
|
||||
```
|
||||
|
||||
## 초기 데이터
|
||||
|
||||
Reference in New Issue
Block a user