Agent 서버 구축: 멀티테넌트 협상 PoC (UCB Q-Table 학습 + /chat + 14 API + 학습검증 하네스), config 단일화(local.toml) + 빌드 경량화
This commit is contained in:
1 parent
212725e5f9
commit
951d6eab84
140 files changed
+6689
-214
No files matched your search
+2
-2
@@ -8,8 +8,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# docker-compose 에서 APP_ENV=docker 로 config.docker.toml 을 읽는다.
|
||||
ENV APP_ENV=docker
|
||||
# 항상 APP_ENV=local 로 실행 → config.local.toml 사용.
|
||||
ENV APP_ENV=local
|
||||
|
||||
EXPOSE 9300
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
[WebServerConfig]
|
||||
server_name = "NegosiumServer"
|
||||
port = 9300
|
||||
process_count = 4
|
||||
is_ssl = false
|
||||
is_test = true
|
||||
|
||||
[LogConfig]
|
||||
print_console = true
|
||||
log_level = "debug"
|
||||
|
||||
# docker-compose 네트워크에서는 DB 가 compose 밖에 있으므로 호스트의 DB 에 host.docker.internal 로 접근한다.
|
||||
[MainDBConfig]
|
||||
db_type = "postgresql"
|
||||
name = "negosium_db"
|
||||
write_host = "host.docker.internal"
|
||||
write_port = 5432
|
||||
write_id = "postgres"
|
||||
write_pw = "password"
|
||||
read_host = "host.docker.internal"
|
||||
read_port = 5432
|
||||
read_id = "postgres"
|
||||
read_pw = "password"
|
||||
show_log = false
|
||||
# 워커 4개 기준: (pool_size + max_overflow) x 2(R/W) x 4 = 320 < max_connections(500)
|
||||
pool_size = 20
|
||||
max_overflow = 20
|
||||
|
||||
[JwtToken]
|
||||
access_key = "docker_access_secret_key"
|
||||
refresh_key = "docker_refresh_secret_key"
|
||||
access_expire_min = 30
|
||||
refresh_expire_day = 7
|
||||
@@ -1,32 +0,0 @@
|
||||
[WebServerConfig]
|
||||
server_name = "NegosiumServer"
|
||||
port = 9300
|
||||
process_count = 1
|
||||
is_ssl = false
|
||||
is_test = true
|
||||
|
||||
[LogConfig]
|
||||
print_console = true
|
||||
log_level = "debug"
|
||||
|
||||
# DB Read/Write 분리. 단일 DB 환경에서는 read/write 동일 호스트로 설정.
|
||||
[MainDBConfig]
|
||||
db_type = "postgresql"
|
||||
name = "negosium_db"
|
||||
write_host = "127.0.0.1"
|
||||
write_port = 5432
|
||||
write_id = "postgres"
|
||||
write_pw = "password"
|
||||
read_host = "127.0.0.1"
|
||||
read_port = 5432
|
||||
read_id = "postgres"
|
||||
read_pw = "password"
|
||||
show_log = false
|
||||
pool_size = 100
|
||||
max_overflow = 200
|
||||
|
||||
[JwtToken]
|
||||
access_key = "CHANGE_ME_ACCESS_SECRET_KEY"
|
||||
refresh_key = "CHANGE_ME_REFRESH_SECRET_KEY"
|
||||
access_expire_min = 30
|
||||
refresh_expire_day = 7
|
||||
@@ -1,33 +0,0 @@
|
||||
[WebServerConfig]
|
||||
server_name = "NegosiumServer-Test"
|
||||
port = 9301
|
||||
process_count = 1
|
||||
is_ssl = false
|
||||
is_test = true
|
||||
|
||||
[LogConfig]
|
||||
print_console = true
|
||||
log_level = "debug"
|
||||
|
||||
# 테스트는 단일 postgres 의 negosium_db 를 사용한다.
|
||||
# pytest 가 tbl_account 를 TRUNCATE 로 비워 격리하므로, 운영 데이터가 있다면 주의.
|
||||
[MainDBConfig]
|
||||
db_type = "postgresql"
|
||||
name = "negosium_db"
|
||||
write_host = "127.0.0.1"
|
||||
write_port = 5432
|
||||
write_id = "postgres"
|
||||
write_pw = "password"
|
||||
read_host = "127.0.0.1"
|
||||
read_port = 5432
|
||||
read_id = "postgres"
|
||||
read_pw = "password"
|
||||
show_log = false
|
||||
pool_size = 100
|
||||
max_overflow = 200
|
||||
|
||||
[JwtToken]
|
||||
access_key = "test_access_secret_key"
|
||||
refresh_key = "test_refresh_secret_key"
|
||||
access_expire_min = 30
|
||||
refresh_expire_day = 7
|
||||
@@ -9,8 +9,9 @@ APP_ENV = os.environ.get("APP_ENV", "local")
|
||||
_config_dir = os.path.dirname(__file__)
|
||||
_config_file = os.path.join(_config_dir, f"config.{APP_ENV}.toml")
|
||||
|
||||
# 운영 전제: 항상 APP_ENV=local 로 띄운다 → config.local.toml 사용 (test/docker 도 local 로 실행).
|
||||
if not os.path.exists(_config_file):
|
||||
raise FileNotFoundError(f"설정 파일이 없습니다: {_config_file} (APP_ENV={APP_ENV}). config.<env>.toml 을 생성하세요.")
|
||||
raise FileNotFoundError(f"설정 파일이 없습니다: {_config_file} (APP_ENV={APP_ENV}). APP_ENV=local 로 실행하세요.")
|
||||
|
||||
configs = Configs(_config_file)
|
||||
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
# pytest 진입 시점에 가장 먼저 APP_ENV=test 를 설정해야 한다.
|
||||
# (config.server_configs 가 import 되는 순간 config.<APP_ENV>.toml 을 읽기 때문)
|
||||
# 테스트도 APP_ENV=local 로 실행한다 (config.local.toml 사용).
|
||||
# config.server_configs 가 import 되는 순간 config.<APP_ENV>.toml 을 읽으므로 가장 먼저 설정.
|
||||
import os
|
||||
|
||||
os.environ.setdefault("APP_ENV", "test")
|
||||
os.environ.setdefault("APP_ENV", "local")
|
||||
|
||||
import pytest_asyncio
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
Reference in new issue
Block a user