Change default server port to 3600

This commit is contained in:
2026-10-09 16:51:51 +09:00
parent e358e24436
commit f09b661ac0
5 changed files with 12 additions and 12 deletions
+8 -8
View File
@@ -31,7 +31,7 @@ npm run build:server
npm run start:local npm run start:local
``` ```
로컬 주소는 `http://127.0.0.1:3000`입니다. `start:local`은 `deploy/arrival.local.env`를 명시적으로 읽으며, 현재 PC의 DB는 `C:\Users\horoli\AppData\Local\BehindGlass\analytics.sqlite`에 저장합니다. 데이터 폴더는 현재 사용자와 SYSTEM만 접근하도록 설정했습니다. 이 설정 파일은 Git에서 제외됩니다. 실행 중인 터미널에서 Ctrl+C로 종료합니다. 로컬 주소는 `http://127.0.0.1:3600`입니다. `start:local`은 `deploy/arrival.local.env`를 명시적으로 읽으며, 현재 PC의 DB는 `C:\Users\horoli\AppData\Local\BehindGlass\analytics.sqlite`에 저장합니다. 데이터 폴더는 현재 사용자와 SYSTEM만 접근하도록 설정했습니다. 이 설정 파일은 Git에서 제외됩니다. 실행 중인 터미널에서 Ctrl+C로 종료합니다.
새 PC에서는 아래처럼 해당 계정의 경로로 설정 파일을 만들고, 데이터 폴더의 Windows ACL을 확인하세요. 기존 DB가 있다면 새 경로를 만들기 전에 기존 `DB_PATH`를 유지하세요. 새 PC에서는 아래처럼 해당 계정의 경로로 설정 파일을 만들고, 데이터 폴더의 Windows ACL을 확인하세요. 기존 DB가 있다면 새 경로를 만들기 전에 기존 `DB_PATH`를 유지하세요.
@@ -40,8 +40,8 @@ $localDataPath = Join-Path $env:LOCALAPPDATA 'BehindGlass'
@( @(
'NODE_ENV=development' 'NODE_ENV=development'
'HOST=127.0.0.1' 'HOST=127.0.0.1'
'PORT=3000' 'PORT=3600'
'PUBLIC_ORIGIN=http://127.0.0.1:3000' 'PUBLIC_ORIGIN=http://127.0.0.1:3600'
"DB_PATH='$localDataPath\analytics.sqlite'" "DB_PATH='$localDataPath\analytics.sqlite'"
) | Set-Content -LiteralPath 'deploy/arrival.local.env' -Encoding utf8 ) | Set-Content -LiteralPath 'deploy/arrival.local.env' -Encoding utf8
``` ```
@@ -67,10 +67,10 @@ DB는 프로젝트 바깥의 영구 로컬 디스크에 둡니다. 아래는 현
(umask 077; mkdir -p "$HOME/behind-glass-data") (umask 077; mkdir -p "$HOME/behind-glass-data")
DB_PATH="$HOME/behind-glass-data/analytics.sqlite" \ DB_PATH="$HOME/behind-glass-data/analytics.sqlite" \
PUBLIC_ORIGIN="https://your-domain.example" \ PUBLIC_ORIGIN="https://your-domain.example" \
NODE_ENV=production HOST=127.0.0.1 PORT=3000 npm start NODE_ENV=production HOST=127.0.0.1 PORT=3600 npm start
``` ```
처음 실행하면 빈 SQLite DB와 스키마가 만들어집니다. 기본 포트는 3000이며 nginx 뒤에서 사용할 수 있도록 127.0.0.1에만 바인딩합니다. SSH 종료 후에도 유지하려면 기존 프로세스 관리자 또는 `deploy/behind-glass.service.example`을 서버 경로·사용자에 맞춰 적용하세요. **단일 프로세스**로 실행하고 PM2 cluster/multiple workers는 사용하지 마세요. 처음 실행하면 빈 SQLite DB와 스키마가 만들어집니다. 기본 포트는 3600이며 nginx 뒤에서 사용할 수 있도록 127.0.0.1에만 바인딩합니다. SSH 종료 후에도 유지하려면 기존 프로세스 관리자 또는 `deploy/behind-glass.service.example`을 서버 경로·사용자에 맞춰 적용하세요. **단일 프로세스**로 실행하고 PM2 cluster/multiple workers는 사용하지 마세요.
`deploy/arrival.env.example`은 예시입니다. 파일을 복사하는 것만으로 자동 로드되지는 않습니다. systemd의 EnvironmentFile 또는 Node의 명시적 `--env-file=/절대경로/arrival.env` 옵션을 사용하세요. 실제 설정 파일은 공개 폴더에 두지 마세요. `deploy/arrival.env.example`은 예시입니다. 파일을 복사하는 것만으로 자동 로드되지는 않습니다. systemd의 EnvironmentFile 또는 Node의 명시적 `--env-file=/절대경로/arrival.env` 옵션을 사용하세요. 실제 설정 파일은 공개 폴더에 두지 마세요.
@@ -80,7 +80,7 @@ NODE_ENV=production HOST=127.0.0.1 PORT=3000 npm start
```nginx ```nginx
location / { location / {
proxy_pass http://127.0.0.1:3000; proxy_pass http://127.0.0.1:3600;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
@@ -107,7 +107,7 @@ npm run build:server
```sh ```sh
npm run test:arrival npm run test:arrival
curl http://127.0.0.1:3000/api/arrivals/count curl http://127.0.0.1:3600/api/arrivals/count
DB_PATH="$HOME/behind-glass-data/analytics.sqlite" npm run --silent metrics -- --month 2026-10 DB_PATH="$HOME/behind-glass-data/analytics.sqlite" npm run --silent metrics -- --month 2026-10
``` ```
@@ -125,7 +125,7 @@ DB_PATH="$HOME/behind-glass-data/analytics.sqlite" npm run --silent metrics -- -
- `scripts/test-cutout-worker.mjs`: `docs/qa-countryside-cutout-2026-10-07/runtime/sample-320.rgba` 누락 - `scripts/test-cutout-worker.mjs`: `docs/qa-countryside-cutout-2026-10-07/runtime/sample-320.rgba` 누락
- `scripts/test-original-photo-only.mjs`: `docs/reference-assets/countryside/open-house.png` 누락 - `scripts/test-original-photo-only.mjs`: `docs/reference-assets/countryside/open-house.png` 누락
- `scripts/test-surface-reflection.mjs`: `docs/qa-surface-reflection/baseline-mosaic.frag` 누락 - `scripts/test-surface-reflection.mjs`: `docs/qa-surface-reflection/baseline-mosaic.frag` 누락
- 실제 `127.0.0.1:3000` HTTP로 HTML, JS/CSS, 샘플 사진, GLB 및 ONNX 파일의 200 응답과 집계 API `{ "count": 0 }`를 확인했습니다. 다른 Origin은 403, 비공개 파일 경로는 404입니다. - 실제 `127.0.0.1:3600` HTTP로 HTML, JS/CSS, 샘플 사진, GLB 및 ONNX 파일의 200 응답과 집계 API `{ "count": 0 }`를 확인했습니다. 다른 Origin은 403, 비공개 파일 경로는 404입니다.
- Windows 자산 경로 구분자를 정규화하고, 테스트 DB를 닫은 뒤 임시 파일을 삭제하도록 수정했습니다. AI 테스트의 파일 URL도 Windows에서 동작하도록 수정했습니다. - Windows 자산 경로 구분자를 정규화하고, 테스트 DB를 닫은 뒤 임시 파일을 삭제하도록 수정했습니다. AI 테스트의 파일 URL도 Windows에서 동작하도록 수정했습니다.
- `RELEASE-MANIFEST.json`은 수령한 원본 배포본의 체크섬 기록입니다. 이번 로컬 수정 파일의 체크섬과는 구분합니다. - `RELEASE-MANIFEST.json`은 수령한 원본 배포본의 체크섬 기록입니다. 이번 로컬 수정 파일의 체크섬과는 구분합니다.
+1 -1
View File
@@ -2,6 +2,6 @@
# Replace paths and origin after the target server is reviewed. # Replace paths and origin after the target server is reviewed.
NODE_ENV=production NODE_ENV=production
HOST=127.0.0.1 HOST=127.0.0.1
PORT=3000 PORT=3600
PUBLIC_ORIGIN=https://your-approved-host.example PUBLIC_ORIGIN=https://your-approved-host.example
DB_PATH=/var/lib/behind-glass/analytics.sqlite DB_PATH=/var/lib/behind-glass/analytics.sqlite
+1 -1
View File
@@ -40,7 +40,7 @@ npm run build:server
## 서버 환경과 데이터 위치 ## 서버 환경과 데이터 위치
- `DB_PATH`: 반드시 명시한 절대경로. 소스·dist·public 밖의 영구 로컬 디스크에 둔다. 예: `/var/lib/behind-glass/analytics.sqlite`. - `DB_PATH`: 반드시 명시한 절대경로. 소스·dist·public 밖의 영구 로컬 디스크에 둔다. 예: `/var/lib/behind-glass/analytics.sqlite`.
- `PORT`: 기본 3000. - `PORT`: 기본 3600.
- `HOST`: 기본 `127.0.0.1`. 외부 공개와 네트워크 설정 변경은 배포 승인 뒤 진행한다. - `HOST`: 기본 `127.0.0.1`. 외부 공개와 네트워크 설정 변경은 배포 승인 뒤 진행한다.
- `PUBLIC_ORIGIN`: 운영 환경에서 필수. 경로·쿼리·계정정보 없는 HTTP(S) origin. 예: `https://your-approved-host.example`. - `PUBLIC_ORIGIN`: 운영 환경에서 필수. 경로·쿼리·계정정보 없는 HTTP(S) origin. 예: `https://your-approved-host.example`.
- `NODE_ENV=production`: 운영 Origin 필수 검사를 사용한다. - `NODE_ENV=production`: 운영 Origin 필수 검사를 사용한다.
+1 -1
View File
@@ -103,7 +103,7 @@ test('strict month validation handles year bounds and December rollover', t => {
test('configuration requires explicit absolute private DB path and strict origin/port', t => { test('configuration requires explicit absolute private DB path and strict origin/port', t => {
const { dbPath } = fixture(t); const { dbPath } = fixture(t);
const config = readConfig({ DB_PATH: dbPath }); const config = readConfig({ DB_PATH: dbPath });
assert.deepEqual(config, { dbPath, distRoot: resolve('dist'), host: '127.0.0.1', port: 3000, publicOrigin: 'http://127.0.0.1:3000' }); assert.deepEqual(config, { dbPath, distRoot: resolve('dist'), host: '127.0.0.1', port: 3600, publicOrigin: 'http://127.0.0.1:3600' });
assert.equal(readConfig({ DB_PATH: dbPath, HOST: '0.0.0.0', PORT: '4010' }).host, '0.0.0.0'); assert.equal(readConfig({ DB_PATH: dbPath, HOST: '0.0.0.0', PORT: '4010' }).host, '0.0.0.0');
assert.throws(() => readConfig({})); assert.throws(() => readConfig({}));
assert.throws(() => readConfig({ DB_PATH: 'relative.sqlite' })); assert.throws(() => readConfig({ DB_PATH: 'relative.sqlite' }));
+1 -1
View File
@@ -50,7 +50,7 @@ export function parsePublicOrigin(value) {
export function readConfig(env = process.env) { export function readConfig(env = process.env) {
const distRoot = join(SOURCE_ROOT, 'dist'); const distRoot = join(SOURCE_ROOT, 'dist');
const dbPath = privateDatabasePath(env.DB_PATH, distRoot); const dbPath = privateDatabasePath(env.DB_PATH, distRoot);
const portText = env.PORT ?? '3000'; const portText = env.PORT ?? '3600';
if (!/^[0-9]+$/.test(portText) || +portText < 1 || +portText > 65535) throw new Error('Invalid PORT'); if (!/^[0-9]+$/.test(portText) || +portText < 1 || +portText > 65535) throw new Error('Invalid PORT');
const port = +portText; const port = +portText;
const host = env.HOST ?? '127.0.0.1'; const host = env.HOST ?? '127.0.0.1';