Run 8091 and 8092 dashboards with Docker

This commit is contained in:
2026-06-11 16:35:09 +09:00
parent 0c052abfa7
commit 7477a803e9
5 changed files with 83 additions and 35 deletions

View File

@@ -439,9 +439,10 @@ def resolve_naver_address_token(address):
const { chromium } = require('playwright-core');
const address = process.argv[1];
(async () => {
const executablePath = process.env.CHROME_PATH || '/usr/bin/google-chrome';
const browser = await chromium.launch({
headless: true,
executablePath: '/usr/bin/google-chrome',
executablePath,
args: ['--no-sandbox', '--disable-dev-shm-usage'],
});
const page = await browser.newPage();
@@ -472,8 +473,13 @@ const address = process.argv[1];
});
"""
env = os.environ.copy()
npx_node_path = '/home/hyein/.npm/_npx/9833c18b2d85bc59/node_modules'
env['NODE_PATH'] = f"{npx_node_path}:{env.get('NODE_PATH', '')}" if env.get('NODE_PATH') else npx_node_path
node_paths = [
os.path.join(BASE_DIR, 'node_modules'),
'/home/hyein/.npm/_npx/9833c18b2d85bc59/node_modules',
]
existing_node_paths = [path for path in node_paths if os.path.isdir(path)]
if existing_node_paths:
env['NODE_PATH'] = ':'.join(existing_node_paths + ([env['NODE_PATH']] if env.get('NODE_PATH') else []))
try:
completed = subprocess.run(
['node', '-e', node_script, cleaned],
@@ -4583,24 +4589,27 @@ if __name__ == '__main__':
os.makedirs(BASE_DIR, exist_ok=True)
with open_db_connection() as conn:
init_db(conn)
try:
alias_rows = load_project_alias_from_erp()
print(f'Loaded project aliases from ERP: {len(alias_rows)}')
replace_project_alias(conn, alias_rows)
except Exception as e:
print(f'Load project aliases from ERP failed, keep existing aliases: {e}')
# 직급은 MySQL member.rankCode -> systemconfig 매핑 기반으로 /api/load 시 반영
try:
fixed = backfill_daily_hours_if_needed(conn)
if fixed:
print(f'Backfilled hour columns for {fixed} rows.')
rebuilt = rebuild_work_calendar_tables(conn)
print(f"Rebuilt work calendar tables: days={rebuilt['days']}, details={rebuilt['details']}")
except sqlite3.OperationalError as e:
if 'locked' in str(e).lower():
print(f'Skip startup rebuild because database is locked: {e}')
else:
raise
if os.environ.get('STARTUP_MAINTENANCE', '1') not in ('0', 'false', 'False', 'no'):
try:
alias_rows = load_project_alias_from_erp()
print(f'Loaded project aliases from ERP: {len(alias_rows)}')
replace_project_alias(conn, alias_rows)
except Exception as e:
print(f'Load project aliases from ERP failed, keep existing aliases: {e}')
# 직급은 MySQL member.rankCode -> systemconfig 매핑 기반으로 /api/load 시 반영
try:
fixed = backfill_daily_hours_if_needed(conn)
if fixed:
print(f'Backfilled hour columns for {fixed} rows.')
rebuilt = rebuild_work_calendar_tables(conn)
print(f"Rebuilt work calendar tables: days={rebuilt['days']}, details={rebuilt['details']}")
except sqlite3.OperationalError as e:
if 'locked' in str(e).lower():
print(f'Skip startup rebuild because database is locked: {e}')
else:
raise
else:
print('Skip startup maintenance by STARTUP_MAINTENANCE=0')
port = int(os.environ.get('PORT', '8091'))
host = '0.0.0.0'