Merge origin/dev - 충돌 해결

- JWT_SECRET 환경변수 충돌 해결
- origin/dev의 더 안전한 JWT 키 값 채택
- 데이터베이스 커넥터 관련 새로운 기능들과 병합
This commit is contained in:
kjs 2025-09-23 15:36:03 +09:00
commit 699efd25a2
21 changed files with 1164 additions and 289 deletions

View File

@ -0,0 +1,28 @@
# Windows 개발 환경 전용 Dockerfile (단순 개발 모드)
FROM node:20-bookworm-slim
WORKDIR /app
# 필요한 패키지 설치 (wget 포함)
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl ca-certificates wget \
&& rm -rf /var/lib/apt/lists/*
# package.json 복사 및 의존성 설치
COPY package*.json ./
RUN npm ci
# 소스 코드 복사
COPY . .
# Prisma 클라이언트 생성
RUN npx prisma generate
# 개발 환경 설정
ENV NODE_ENV=development
# 포트 노출
EXPOSE 8080
# 개발 서버 시작 (nodemon 사용)
CMD ["npm", "run", "dev"]

View File

@ -21,6 +21,7 @@
"joi": "^17.11.0",
"jsonwebtoken": "^9.0.2",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.15.0",
"nodemailer": "^6.9.7",
"pg": "^8.16.3",
"prisma": "^5.7.1",
@ -3612,6 +3613,15 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/aws-ssl-profiles": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz",
"integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==",
"license": "MIT",
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/axios": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz",
@ -4457,6 +4467,15 @@
"node": ">=0.4.0"
}
},
"node_modules/denque": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.10"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@ -5413,6 +5432,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
"integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
"license": "MIT",
"dependencies": {
"is-property": "^1.0.2"
}
},
"node_modules/generic-pool": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz",
@ -5959,6 +5987,12 @@
"node": ">=8"
}
},
"node_modules/is-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",
"license": "MIT"
},
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
@ -6914,6 +6948,12 @@
"node": ">= 12.0.0"
}
},
"node_modules/long": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
"integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
"license": "Apache-2.0"
},
"node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@ -6924,6 +6964,21 @@
"yallist": "^3.0.2"
}
},
"node_modules/lru.min": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.2.tgz",
"integrity": "sha512-Nv9KddBcQSlQopmBHXSsZVY5xsdlZkdH/Iey0BlcBYggMd4two7cZnKOK9vmy3nY0O5RGH99z1PCeTpPqszUYg==",
"license": "MIT",
"engines": {
"bun": ">=1.0.0",
"deno": ">=1.30.0",
"node": ">=8.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wellwelwel"
}
},
"node_modules/make-dir": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
@ -7138,6 +7193,63 @@
"node": ">= 6.0.0"
}
},
"node_modules/mysql2": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.15.0.tgz",
"integrity": "sha512-tT6pomf5Z/I7Jzxu8sScgrYBMK9bUFWd7Kbo6Fs1L0M13OOIJ/ZobGKS3Z7tQ8Re4lj+LnLXIQVZZxa3fhYKzA==",
"license": "MIT",
"dependencies": {
"aws-ssl-profiles": "^1.1.1",
"denque": "^2.1.0",
"generate-function": "^2.3.1",
"iconv-lite": "^0.7.0",
"long": "^5.2.1",
"lru.min": "^1.0.0",
"named-placeholders": "^1.1.3",
"seq-queue": "^0.0.5",
"sqlstring": "^2.3.2"
},
"engines": {
"node": ">= 8.0"
}
},
"node_modules/mysql2/node_modules/iconv-lite": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/named-placeholders": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz",
"integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==",
"license": "MIT",
"dependencies": {
"lru-cache": "^7.14.1"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/named-placeholders/node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -8226,6 +8338,11 @@
"node": ">= 0.8"
}
},
"node_modules/seq-queue": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
"integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="
},
"node_modules/serve-static": {
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
@ -8431,6 +8548,15 @@
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/sqlstring": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz",
"integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",

View File

@ -39,6 +39,7 @@
"joi": "^17.11.0",
"jsonwebtoken": "^9.0.2",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.15.0",
"nodemailer": "^6.9.7",
"pg": "^8.16.3",
"prisma": "^5.7.1",

View File

@ -0,0 +1,52 @@
import { DatabaseConnector, ConnectionConfig } from '../interfaces/DatabaseConnector';
import { PostgreSQLConnector } from './PostgreSQLConnector';
export class DatabaseConnectorFactory {
private static connectors = new Map<string, DatabaseConnector>();
static async createConnector(
type: string,
config: ConnectionConfig,
connectionId: number // Added connectionId for unique key
): Promise<DatabaseConnector> {
const key = `${type}-${connectionId}`; // Use connectionId for unique key
if (this.connectors.has(key)) {
return this.connectors.get(key)!;
}
let connector: DatabaseConnector;
switch (type.toLowerCase()) {
case 'postgresql':
connector = new PostgreSQLConnector(config);
break;
// Add other database types here
default:
throw new Error(`지원하지 않는 데이터베이스 타입: ${type}`);
}
this.connectors.set(key, connector);
return connector;
}
static async getConnector(connectionId: number, type: string): Promise<DatabaseConnector | undefined> {
const key = `${type}-${connectionId}`;
return this.connectors.get(key);
}
static async closeConnector(connectionId: number, type: string): Promise<void> {
const key = `${type}-${connectionId}`;
const connector = this.connectors.get(key);
if (connector) {
await connector.disconnect();
this.connectors.delete(key);
}
}
static async closeAll(): Promise<void> {
for (const connector of this.connectors.values()) {
await connector.disconnect();
}
this.connectors.clear();
}
}

View File

@ -0,0 +1,175 @@
import * as mysql from 'mysql2/promise';
import { DatabaseConnector, ConnectionConfig, QueryResult } from '../interfaces/DatabaseConnector';
import { ConnectionTestResult, TableInfo } from '../types/externalDbTypes';
export class MySQLConnector implements DatabaseConnector {
private connection: mysql.Connection | null = null;
private config: ConnectionConfig;
constructor(config: ConnectionConfig) {
this.config = config;
}
async connect(): Promise<void> {
if (this.connection) {
throw new Error('이미 연결되어 있습니다.');
}
this.connection = await mysql.createConnection({
host: this.config.host,
port: this.config.port,
database: this.config.database,
user: this.config.username,
password: this.config.password,
connectTimeout: this.config.connectionTimeout || 30000,
ssl: this.config.sslEnabled ? { rejectUnauthorized: false } : undefined,
});
}
async disconnect(): Promise<void> {
if (this.connection) {
await this.connection.end();
this.connection = null;
}
}
async testConnection(): Promise<ConnectionTestResult> {
const startTime = Date.now();
try {
await this.connect();
const [versionResult] = await this.connection!.query('SELECT VERSION() as version');
const [sizeResult] = await this.connection!.query(
'SELECT SUM(data_length + index_length) as size FROM information_schema.tables WHERE table_schema = DATABASE()'
);
const responseTime = Date.now() - startTime;
return {
success: true,
message: 'MySQL 연결이 성공했습니다.',
details: {
response_time: responseTime,
server_version: (versionResult as any)[0]?.version || '알 수 없음',
database_size: this.formatBytes(parseInt((sizeResult as any)[0]?.size || '0')),
},
};
} catch (error) {
return {
success: false,
message: 'MySQL 연결에 실패했습니다.',
error: {
code: 'CONNECTION_FAILED',
details: error instanceof Error ? error.message : '알 수 없는 오류',
},
};
} finally {
await this.disconnect();
}
}
async executeQuery(query: string): Promise<QueryResult> {
if (!this.connection) {
await this.connect();
}
try {
const [rows, fields] = await this.connection!.query(query);
return {
rows: rows as any[],
rowCount: Array.isArray(rows) ? rows.length : 0,
fields: (fields as mysql.FieldPacket[]).map(field => ({
name: field.name,
dataType: field.type.toString(),
})),
};
} finally {
await this.disconnect();
}
}
async getTables(): Promise<TableInfo[]> {
if (!this.connection) {
await this.connect();
}
try {
const [tables] = await this.connection!.query(`
SELECT
t.TABLE_NAME as table_name,
t.TABLE_COMMENT as table_description
FROM information_schema.TABLES t
WHERE t.TABLE_SCHEMA = DATABASE()
ORDER BY t.TABLE_NAME
`);
const result: TableInfo[] = [];
for (const table of tables as any[]) {
const [columns] = await this.connection!.query(`
SELECT
COLUMN_NAME as column_name,
DATA_TYPE as data_type,
IS_NULLABLE as is_nullable,
COLUMN_DEFAULT as column_default
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = ?
ORDER BY ORDINAL_POSITION
`, [table.table_name]);
result.push({
table_name: table.table_name,
description: table.table_description || null,
columns: columns as any[],
});
}
return result;
} finally {
await this.disconnect();
}
}
async getColumns(tableName: string): Promise<Array<{
name: string;
dataType: string;
isNullable: boolean;
defaultValue?: string;
}>> {
if (!this.connection) {
await this.connect();
}
try {
const [columns] = await this.connection!.query(`
SELECT
COLUMN_NAME as name,
DATA_TYPE as dataType,
IS_NULLABLE = 'YES' as isNullable,
COLUMN_DEFAULT as defaultValue
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = ?
ORDER BY ORDINAL_POSITION
`, [tableName]);
return (columns as any[]).map(col => ({
name: col.name,
dataType: col.dataType,
isNullable: col.isNullable,
defaultValue: col.defaultValue,
}));
} finally {
await this.disconnect();
}
}
private formatBytes(bytes: number): string {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
}

View File

@ -0,0 +1,145 @@
import { Client } from 'pg';
import { DatabaseConnector, ConnectionConfig, QueryResult } from '../interfaces/DatabaseConnector';
import { ConnectionTestResult, TableInfo } from '../types/externalDbTypes';
export class PostgreSQLConnector implements DatabaseConnector {
private client: Client | null = null;
private config: ConnectionConfig;
constructor(config: ConnectionConfig) {
this.config = config;
}
async connect(): Promise<void> {
if (this.client) {
await this.disconnect();
}
const clientConfig: any = {
host: this.config.host,
port: this.config.port,
database: this.config.database,
user: this.config.user,
password: this.config.password,
};
if (this.config.connectionTimeoutMillis != null) {
clientConfig.connectionTimeoutMillis = this.config.connectionTimeoutMillis;
}
if (this.config.queryTimeoutMillis != null) {
clientConfig.query_timeout = this.config.queryTimeoutMillis;
}
if (this.config.ssl != null) {
clientConfig.ssl = this.config.ssl;
}
this.client = new Client(clientConfig);
await this.client.connect();
}
async disconnect(): Promise<void> {
if (this.client) {
await this.client.end();
this.client = null;
}
}
async testConnection(): Promise<ConnectionTestResult> {
const startTime = Date.now();
try {
await this.connect();
const result = await this.client!.query("SELECT version(), pg_database_size(current_database()) as size");
const responseTime = Date.now() - startTime;
await this.disconnect();
return {
success: true,
message: "PostgreSQL 연결이 성공했습니다.",
details: {
response_time: responseTime,
server_version: result.rows[0]?.version || "알 수 없음",
database_size: this.formatBytes(parseInt(result.rows[0]?.size || "0")),
},
};
} catch (error: any) {
await this.disconnect();
return {
success: false,
message: "PostgreSQL 연결에 실패했습니다.",
error: {
code: "CONNECTION_FAILED",
details: error.message || "알 수 없는 오류",
},
};
}
}
async executeQuery(query: string): Promise<QueryResult> {
try {
await this.connect();
const result = await this.client!.query(query);
await this.disconnect();
return {
rows: result.rows,
rowCount: result.rowCount ?? undefined,
fields: result.fields ?? undefined,
};
} catch (error: any) {
await this.disconnect();
throw new Error(`PostgreSQL 쿼리 실행 실패: ${error.message}`);
}
}
async getTables(): Promise<TableInfo[]> {
try {
await this.connect();
const result = await this.client!.query(`
SELECT
t.table_name,
obj_description(quote_ident(t.table_name)::regclass::oid, 'pg_class') as table_description
FROM information_schema.tables t
WHERE t.table_schema = 'public'
AND t.table_type = 'BASE TABLE'
ORDER BY t.table_name;
`);
await this.disconnect();
return result.rows.map((row) => ({
table_name: row.table_name,
description: row.table_description,
columns: [], // Columns will be fetched by getColumns
}));
} catch (error: any) {
await this.disconnect();
throw new Error(`PostgreSQL 테이블 목록 조회 실패: ${error.message}`);
}
}
async getColumns(tableName: string): Promise<any[]> {
try {
await this.connect();
const result = await this.client!.query(`
SELECT
column_name,
data_type,
is_nullable,
column_default
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = $1
ORDER BY ordinal_position;
`, [tableName]);
await this.disconnect();
return result.rows;
} catch (error: any) {
await this.disconnect();
throw new Error(`PostgreSQL 컬럼 정보 조회 실패: ${error.message}`);
}
}
private formatBytes(bytes: number): string {
if (bytes === 0) return "0 Bytes";
const k = 1024;
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
}
}

View File

@ -0,0 +1,27 @@
import { ConnectionTestResult, TableInfo } from '../types/externalDbTypes';
export interface ConnectionConfig {
host: string;
port: number;
database: string;
user: string;
password: string;
connectionTimeoutMillis?: number;
queryTimeoutMillis?: number;
ssl?: boolean | { rejectUnauthorized: boolean };
}
export interface QueryResult {
rows: any[];
rowCount?: number;
fields?: any[];
}
export interface DatabaseConnector {
connect(): Promise<void>;
disconnect(): Promise<void>;
testConnection(): Promise<ConnectionTestResult>;
executeQuery(query: string): Promise<QueryResult>;
getTables(): Promise<TableInfo[]>;
getColumns(tableName: string): Promise<any[]>; // 특정 테이블의 컬럼 정보 조회
}

View File

@ -0,0 +1,59 @@
import { DatabaseConnectorFactory } from '../database/DatabaseConnectorFactory';
import { ConnectionConfig, QueryResult } from '../interfaces/DatabaseConnector';
import { ConnectionTestResult, TableInfo } from '../types/externalDbTypes';
export class DbConnectionManager {
static async testConnection(
connectionId: number,
dbType: string,
config: ConnectionConfig
): Promise<ConnectionTestResult> {
const connector = await DatabaseConnectorFactory.createConnector(dbType, config, connectionId);
try {
return await connector.testConnection();
} finally {
await DatabaseConnectorFactory.closeConnector(connectionId, dbType); // Close after test
}
}
static async executeQuery(
connectionId: number,
dbType: string,
config: ConnectionConfig,
query: string
): Promise<QueryResult> {
const connector = await DatabaseConnectorFactory.createConnector(dbType, config, connectionId);
try {
return await connector.executeQuery(query);
} finally {
await DatabaseConnectorFactory.closeConnector(connectionId, dbType);
}
}
static async getTables(
connectionId: number,
dbType: string,
config: ConnectionConfig
): Promise<TableInfo[]> {
const connector = await DatabaseConnectorFactory.createConnector(dbType, config, connectionId);
try {
return await connector.getTables();
} finally {
await DatabaseConnectorFactory.closeConnector(connectionId, dbType);
}
}
static async getColumns(
connectionId: number,
dbType: string,
config: ConnectionConfig,
tableName: string
): Promise<any[]> {
const connector = await DatabaseConnectorFactory.createConnector(dbType, config, connectionId);
try {
return await connector.getColumns(tableName);
} finally {
await DatabaseConnectorFactory.closeConnector(connectionId, dbType);
}
}
}

View File

@ -9,6 +9,7 @@ import {
TableInfo,
} from "../types/externalDbTypes";
import { PasswordEncryption } from "../utils/passwordEncryption";
import { DbConnectionManager } from "./dbConnectionManager";
const prisma = new PrismaClient();
@ -321,8 +322,6 @@ export class ExternalDbConnectionService {
static async testConnectionById(
id: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
const startTime = Date.now();
try {
// 저장된 연결 정보 조회
const connection = await prisma.external_db_connections.findUnique({
@ -353,40 +352,20 @@ export class ExternalDbConnectionService {
};
}
// 테스트용 데이터 준비
const testData = {
db_type: connection.db_type,
// 연결 설정 준비
const config = {
host: connection.host,
port: connection.port,
database_name: connection.database_name,
username: connection.username,
database: connection.database_name,
user: connection.username,
password: decryptedPassword,
connection_timeout: connection.connection_timeout || undefined,
ssl_enabled: connection.ssl_enabled || undefined
connectionTimeoutMillis: connection.connection_timeout != null ? connection.connection_timeout * 1000 : undefined,
queryTimeoutMillis: connection.query_timeout != null ? connection.query_timeout * 1000 : undefined,
ssl: connection.ssl_enabled === "Y" ? { rejectUnauthorized: false } : false
};
// 실제 연결 테스트 수행
switch (connection.db_type.toLowerCase()) {
case "postgresql":
return await this.testPostgreSQLConnection(testData, startTime);
case "mysql":
return await this.testMySQLConnection(testData, startTime);
case "oracle":
return await this.testOracleConnection(testData, startTime);
case "mssql":
return await this.testMSSQLConnection(testData, startTime);
case "sqlite":
return await this.testSQLiteConnection(testData, startTime);
default:
return {
success: false,
message: `지원하지 않는 데이터베이스 타입입니다: ${testData.db_type}`,
error: {
code: "UNSUPPORTED_DB_TYPE",
details: `${testData.db_type} 타입은 현재 지원하지 않습니다.`,
},
};
}
// DbConnectionManager를 통한 연결 테스트
return await DbConnectionManager.testConnection(id, connection.db_type, config);
} catch (error) {
return {
success: false,
@ -399,132 +378,6 @@ export class ExternalDbConnectionService {
}
}
/**
* PostgreSQL
*/
private static async testPostgreSQLConnection(
testData: any,
startTime: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
const { Client } = await import("pg");
const client = new Client({
host: testData.host,
port: testData.port,
database: testData.database_name,
user: testData.username,
password: testData.password,
connectionTimeoutMillis: (testData.connection_timeout || 30) * 1000,
ssl: testData.ssl_enabled === "Y" ? { rejectUnauthorized: false } : false,
});
try {
await client.connect();
const result = await client.query(
"SELECT version(), pg_database_size(current_database()) as size"
);
const responseTime = Date.now() - startTime;
await client.end();
return {
success: true,
message: "PostgreSQL 연결이 성공했습니다.",
details: {
response_time: responseTime,
server_version: result.rows[0]?.version || "알 수 없음",
database_size: this.formatBytes(
parseInt(result.rows[0]?.size || "0")
),
},
};
} catch (error) {
try {
await client.end();
} catch (endError) {
// 연결 종료 오류는 무시
}
return {
success: false,
message: "PostgreSQL 연결에 실패했습니다.",
error: {
code: "CONNECTION_FAILED",
details: error instanceof Error ? error.message : "알 수 없는 오류",
},
};
}
}
/**
* MySQL ( )
*/
private static async testMySQLConnection(
testData: any,
startTime: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
// MySQL 라이브러리가 없으므로 모의 구현
return {
success: false,
message: "MySQL 연결 테스트는 현재 지원하지 않습니다.",
error: {
code: "NOT_IMPLEMENTED",
details: "MySQL 라이브러리가 설치되지 않았습니다.",
},
};
}
/**
* Oracle ( )
*/
private static async testOracleConnection(
testData: any,
startTime: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
return {
success: false,
message: "Oracle 연결 테스트는 현재 지원하지 않습니다.",
error: {
code: "NOT_IMPLEMENTED",
details: "Oracle 라이브러리가 설치되지 않았습니다.",
},
};
}
/**
* SQL Server ( )
*/
private static async testMSSQLConnection(
testData: any,
startTime: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
return {
success: false,
message: "SQL Server 연결 테스트는 현재 지원하지 않습니다.",
error: {
code: "NOT_IMPLEMENTED",
details: "SQL Server 라이브러리가 설치되지 않았습니다.",
},
};
}
/**
* SQLite ( )
*/
private static async testSQLiteConnection(
testData: any,
startTime: number
): Promise<import("../types/externalDbTypes").ConnectionTestResult> {
return {
success: false,
message: "SQLite 연결 테스트는 현재 지원하지 않습니다.",
error: {
code: "NOT_IMPLEMENTED",
details:
"SQLite는 파일 기반이므로 네트워크 연결 테스트가 불가능합니다.",
},
};
}
/**
*
*/
@ -622,36 +475,26 @@ export class ExternalDbConnectionService {
};
}
// DB 타입에 따른 쿼리 실행
switch (connection.db_type.toLowerCase()) {
case "postgresql":
return await this.executePostgreSQLQuery(connection, decryptedPassword, query);
case "mysql":
return {
success: false,
message: "MySQL 쿼리 실행은 현재 지원하지 않습니다."
};
case "oracle":
return {
success: false,
message: "Oracle 쿼리 실행은 현재 지원하지 않습니다."
};
case "mssql":
return {
success: false,
message: "SQL Server 쿼리 실행은 현재 지원하지 않습니다."
};
case "sqlite":
return {
success: false,
message: "SQLite 쿼리 실행은 현재 지원하지 않습니다."
};
default:
return {
success: false,
message: `지원하지 않는 데이터베이스 타입입니다: ${connection.db_type}`
};
}
// 연결 설정 준비
const config = {
host: connection.host,
port: connection.port,
database: connection.database_name,
user: connection.username,
password: decryptedPassword,
connectionTimeoutMillis: connection.connection_timeout != null ? connection.connection_timeout * 1000 : undefined,
queryTimeoutMillis: connection.query_timeout != null ? connection.query_timeout * 1000 : undefined,
ssl: connection.ssl_enabled === "Y" ? { rejectUnauthorized: false } : false
};
// DbConnectionManager를 통한 쿼리 실행
const result = await DbConnectionManager.executeQuery(id, connection.db_type, config, query);
return {
success: true,
message: "쿼리가 성공적으로 실행되었습니다.",
data: result.rows
};
} catch (error) {
console.error("쿼리 실행 오류:", error);
return {
@ -740,15 +583,26 @@ export class ExternalDbConnectionService {
};
}
switch (connection.db_type.toLowerCase()) {
case "postgresql":
return await this.getPostgreSQLTables(connection, decryptedPassword);
default:
return {
success: false,
message: `지원하지 않는 데이터베이스 타입입니다: ${connection.db_type}`
};
}
// 연결 설정 준비
const config = {
host: connection.host,
port: connection.port,
database: connection.database_name,
user: connection.username,
password: decryptedPassword,
connectionTimeoutMillis: connection.connection_timeout != null ? connection.connection_timeout * 1000 : undefined,
queryTimeoutMillis: connection.query_timeout != null ? connection.query_timeout * 1000 : undefined,
ssl: connection.ssl_enabled === "Y" ? { rejectUnauthorized: false } : false
};
// DbConnectionManager를 통한 테이블 목록 조회
const tables = await DbConnectionManager.getTables(id, connection.db_type, config);
return {
success: true,
message: "테이블 목록을 조회했습니다.",
data: tables
};
} catch (error) {
console.error("테이블 목록 조회 오류:", error);
return {

View File

@ -0,0 +1,38 @@
version: "3.8"
services:
# Node.js 백엔드
backend:
build:
context: ./backend-node
dockerfile: Dockerfile.win
container_name: pms-backend-win
ports:
- "8080:8080"
environment:
- NODE_ENV=development
- PORT=8080
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
- JWT_EXPIRES_IN=24h
- CORS_ORIGIN=http://localhost:9771
- CORS_CREDENTIALS=true
- LOG_LEVEL=debug
volumes:
- ./backend-node:/app
- /app/node_modules
- /app/dist
networks:
- pms-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health", "||", "exit", "1"]
interval: 30s
timeout: 15s
retries: 5
start_period: 90s
networks:
pms-network:
driver: bridge
external: false

View File

@ -0,0 +1,32 @@
version: "3.8"
services:
# Next.js 프론트엔드만
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: pms-frontend-win
ports:
- "9771:3000"
environment:
- NEXT_PUBLIC_API_URL=http://localhost:8080/api
- WATCHPACK_POLLING=true
volumes:
- ./frontend:/app
- /app/node_modules
- /app/.next
networks:
- pms-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000", "||", "exit", "1"]
interval: 30s
timeout: 15s
retries: 3
start_period: 60s
networks:
pms-network:
driver: bridge
external: false

63
docker-compose.win.yml Normal file
View File

@ -0,0 +1,63 @@
services:
# 백엔드 서비스 (기존)
plm-app:
build:
context: .
dockerfile: Dockerfile.win
platforms:
- linux/amd64
container_name: plm-windows
ports:
- "9090:8080"
environment:
- CATALINA_OPTS=-DDB_URL=jdbc:postgresql://39.117.244.52:11132/plm -DDB_USERNAME=postgres -DDB_PASSWORD=ph0909!! -Xms512m -Xmx1024m
- TZ=Asia/Seoul
- APP_ENV=development
- LOG_LEVEL=INFO
- DB_HOST=39.117.244.52
- DB_PORT=11132
- DB_NAME=plm
- DB_USERNAME=postgres
- DB_PASSWORD=ph0909!!
volumes:
- plm-win-project:/data_storage
- plm-win-app:/app_data
- ./logs:/usr/local/tomcat/logs
- ./WebContent:/usr/local/tomcat/webapps/ROOT
restart: unless-stopped
networks:
- plm-network
# 프론트엔드 서비스 (새로 추가)
plm-frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: plm-frontend
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- TZ=Asia/Seoul
- NEXT_PUBLIC_API_URL=http://localhost:9090
- WATCHPACK_POLLING=true
volumes:
- ./frontend:/app
- /app/node_modules
- /app/.next
depends_on:
- plm-app
restart: unless-stopped
networks:
- plm-network
volumes:
plm-win-project:
driver: local
plm-win-app:
driver: local
networks:
plm-network:
driver: bridge
external: false

View File

@ -13,7 +13,7 @@ services:
- NODE_ENV=development
- PORT=8080
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
- JWT_SECRET=your-super-secret-jwt-key-change-in-production
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
- JWT_EXPIRES_IN=24h
- CORS_ORIGIN=http://localhost:9771
- CORS_CREDENTIALS=true

View File

@ -5,13 +5,13 @@ import Link from "next/link";
*/
export default function AdminPage() {
return (
<div className="space-y-6">
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-blue-50/30 p-8 space-y-8">
{/* 관리자 기능 카드들 */}
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
<div className="mx-auto max-w-7xl grid gap-6 md:grid-cols-2 lg:grid-cols-3">
<Link href="/admin/userMng" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-blue-50">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-blue-200 to-blue-300">
<Users className="h-6 w-6 text-blue-600" />
</div>
<div>
@ -24,8 +24,8 @@ export default function AdminPage() {
<div className="rounded-lg border bg-white p-6 shadow-sm">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-green-50">
<Shield className="h-6 w-6 text-green-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-emerald-200 to-emerald-300">
<Shield className="h-6 w-6 text-emerald-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>
@ -36,8 +36,8 @@ export default function AdminPage() {
<div className="rounded-lg border bg-white p-6 shadow-sm">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-purple-50">
<Settings className="h-6 w-6 text-purple-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-violet-200 to-violet-300">
<Settings className="h-6 w-6 text-violet-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>
@ -48,8 +48,8 @@ export default function AdminPage() {
<div className="rounded-lg border bg-white p-6 shadow-sm">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-orange-50">
<BarChart3 className="h-6 w-6 text-orange-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-amber-200 to-amber-300">
<BarChart3 className="h-6 w-6 text-amber-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>
@ -61,7 +61,7 @@ export default function AdminPage() {
<Link href="/admin/screenMng" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-indigo-50">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-indigo-200 to-indigo-300">
<Palette className="h-6 w-6 text-indigo-600" />
</div>
<div>
@ -74,14 +74,14 @@ export default function AdminPage() {
</div>
{/* 표준 관리 섹션 */}
<div className="space-y-4">
<div className="mx-auto max-w-7xl space-y-4">
<h2 className="text-xl font-semibold text-gray-900"> </h2>
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-4">
<Link href="/admin/standards" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-teal-50">
<Database className="h-6 w-6 text-teal-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-teal-200 to-teal-300">
<Database className="h-6 w-6 text-teal-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>
@ -94,8 +94,8 @@ export default function AdminPage() {
<Link href="/admin/templates" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-emerald-50">
<Layout className="h-6 w-6 text-emerald-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-emerald-200 to-emerald-300">
<Layout className="h-6 w-6 text-emerald-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900">릿 </h3>
@ -108,8 +108,8 @@ export default function AdminPage() {
<Link href="/admin/tableMng" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-cyan-50">
<Database className="h-6 w-6 text-cyan-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-cyan-200 to-cyan-300">
<Database className="h-6 w-6 text-cyan-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>
@ -122,8 +122,8 @@ export default function AdminPage() {
<Link href="/admin/components" className="block">
<div className="rounded-lg border bg-white p-6 shadow-sm transition-colors hover:bg-gray-50">
<div className="flex items-center gap-4">
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-violet-50">
<Package className="h-6 w-6 text-violet-600" />
<div className="flex h-12 w-12 items-center justify-center rounded-lg bg-gradient-to-br from-violet-200 to-violet-300">
<Package className="h-6 w-6 text-violet-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900"> </h3>

View File

@ -211,18 +211,17 @@ export const ExternalDbConnectionModal: React.FC<ExternalDbConnectionModalProps>
setTestingConnection(true);
setTestResult(null);
const testData: ConnectionTestRequest = {
db_type: formData.db_type,
host: formData.host,
port: formData.port,
database_name: formData.database_name,
username: formData.username,
password: formData.password,
connection_timeout: formData.connection_timeout,
ssl_enabled: formData.ssl_enabled,
};
// 편집 모드일 때만 연결 테스트 실행
if (!isEditMode || !connection?.id) {
toast({
title: "연결 테스트 불가",
description: "연결을 먼저 저장한 후 테스트할 수 있습니다.",
variant: "destructive",
});
return;
}
const result = await ExternalDbConnectionAPI.testConnection(testData);
const result = await ExternalDbConnectionAPI.testConnection(connection.id);
setTestResult(result);
if (result.success) {

View File

@ -122,7 +122,7 @@ export const SqlQueryModal: React.FC<SqlQueryModalProps> = ({ isOpen, onClose, c
return (
<Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent className="max-h-[90vh] max-w-5xl" aria-describedby="modal-description">
<DialogContent className="max-h-[90vh] max-w-5xl overflow-y-auto" aria-describedby="modal-description">
<DialogHeader>
<DialogTitle>{connectionName} - SQL </DialogTitle>
<DialogDescription>
@ -131,7 +131,7 @@ export const SqlQueryModal: React.FC<SqlQueryModalProps> = ({ isOpen, onClose, c
</DialogHeader>
{/* 쿼리 입력 영역 */}
<div className="mb-4 space-y-4">
<div className="space-y-4">
<div className="space-y-2">
{/* 테이블 선택 */}
<div className="flex flex-col gap-4">
@ -168,28 +168,32 @@ export const SqlQueryModal: React.FC<SqlQueryModalProps> = ({ isOpen, onClose, c
{/* 테이블 정보 */}
<div className="bg-muted/50 rounded-md border p-4">
<h3 className="mb-2 font-medium"> </h3>
<div className="space-y-4">
{tables.map((table) => (
<div key={table.table_name} className="border-b pb-2 last:border-b-0 last:pb-0">
<div className="flex items-center justify-between">
<h4 className="font-mono font-bold">{table.table_name}</h4>
<Button variant="ghost" size="sm" onClick={() => setQuery(`SELECT * FROM ${table.table_name}`)}>
</Button>
</div>
{table.description && (
<p className="text-muted-foreground mt-1 text-sm">{table.description}</p>
)}
<div className="mt-2 grid grid-cols-3 gap-2">
{table.columns.map((column: TableColumn) => (
<div key={column.column_name} className="text-sm">
<span className="font-mono">{column.column_name}</span>
<span className="text-muted-foreground ml-1">({column.data_type})</span>
<div className="space-y-4 max-h-[300px] overflow-y-auto">
<div className="pr-2">
{tables.map((table) => (
<div key={table.table_name} className="mb-4 bg-white rounded-lg shadow-sm border last:mb-0">
<div className="p-3">
<div className="flex items-center justify-between">
<h4 className="font-mono font-bold">{table.table_name}</h4>
<Button variant="ghost" size="sm" onClick={() => setQuery(`SELECT * FROM ${table.table_name}`)}>
</Button>
</div>
))}
{table.description && (
<p className="text-muted-foreground mt-1 text-sm">{table.description}</p>
)}
<div className="mt-2 grid grid-cols-3 gap-2">
{table.columns.map((column: TableColumn) => (
<div key={column.column_name} className="text-sm">
<span className="font-mono">{column.column_name}</span>
<span className="text-muted-foreground ml-1">({column.data_type})</span>
</div>
))}
</div>
</div>
</div>
</div>
))}
))}
</div>
</div>
</div>
</div>
@ -218,7 +222,7 @@ export const SqlQueryModal: React.FC<SqlQueryModalProps> = ({ isOpen, onClose, c
</div>
{/* 결과 섹션 */}
<div className="mt-4 space-y-4">
<div className="space-y-4">
<div className="flex items-center justify-between">
<div className="text-muted-foreground text-sm">
{loading ? "쿼리 실행 중..." : results.length > 0 ? `${results.length}개의 결과가 있습니다.` : "실행된 쿼리가 없습니다."}
@ -227,45 +231,49 @@ export const SqlQueryModal: React.FC<SqlQueryModalProps> = ({ isOpen, onClose, c
{/* 결과 그리드 */}
<div className="rounded-md border">
<div className="max-h-[400px] overflow-auto">
<Table>
{results.length > 0 ? (
<>
<TableHeader className="sticky top-0 bg-white">
<TableRow>
{Object.keys(results[0]).map((key) => (
<TableHead key={key} className="font-mono font-bold">
{key}
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{results.map((row: QueryResult, i: number) => (
<TableRow key={i} className="hover:bg-muted/50">
{Object.values(row).map((value, j) => (
<TableCell key={j} className="font-mono">
{value === null ? (
<span className="text-muted-foreground italic">NULL</span>
) : (
String(value)
)}
</TableCell>
<div className="max-h-[300px] overflow-y-auto">
<div className="min-w-full inline-block align-middle">
<div className="overflow-x-auto">
<Table>
{results.length > 0 ? (
<>
<TableHeader className="sticky top-0 bg-white z-10">
<TableRow>
{Object.keys(results[0]).map((key) => (
<TableHead key={key} className="font-mono font-bold">
{key}
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{results.map((row: QueryResult, i: number) => (
<TableRow key={i} className="hover:bg-muted/50">
{Object.values(row).map((value, j) => (
<TableCell key={j} className="font-mono whitespace-nowrap">
{value === null ? (
<span className="text-muted-foreground italic">NULL</span>
) : (
String(value)
)}
</TableCell>
))}
</TableRow>
))}
</TableBody>
</>
) : (
<TableBody>
<TableRow>
<TableCell className="text-muted-foreground h-32 text-center">
{loading ? "쿼리 실행 중..." : "쿼리를 실행하면 결과가 여기에 표시됩니다."}
</TableCell>
</TableRow>
))}
</TableBody>
</>
) : (
<TableBody>
<TableRow>
<TableCell className="text-muted-foreground h-32 text-center">
{loading ? "쿼리 실행 중..." : "쿼리를 실행하면 결과가 여기에 표시됩니다."}
</TableCell>
</TableRow>
</TableBody>
)}
</Table>
</TableBody>
)}
</Table>
</div>
</div>
</div>
</div>
</div>

View File

@ -307,7 +307,11 @@ function AppLayoutInner({ children }: AppLayoutProps) {
<div key={menu.id}>
<div
className={`group flex cursor-pointer items-center justify-between rounded-lg px-3 py-2 text-sm font-medium transition-colors hover:cursor-pointer ${
isExpanded ? "bg-slate-100 text-slate-900" : "text-slate-600 hover:bg-slate-50 hover:text-slate-900"
pathname === menu.url
? "bg-gradient-to-br from-slate-100 to-blue-100/40 text-slate-900 border-l-4 border-blue-500"
: isExpanded
? "bg-slate-100 text-slate-900"
: "text-slate-600 hover:bg-slate-50 hover:text-slate-900"
} ${level > 0 ? "ml-6" : ""}`}
onClick={() => handleMenuClick(menu)}
>
@ -328,7 +332,11 @@ function AppLayoutInner({ children }: AppLayoutProps) {
{menu.children?.map((child: any) => (
<div
key={child.id}
className="flex cursor-pointer items-center rounded-lg px-3 py-2 text-sm text-slate-600 transition-colors hover:cursor-pointer hover:bg-slate-50 hover:text-slate-900"
className={`flex cursor-pointer items-center rounded-lg px-3 py-2 text-sm transition-colors hover:cursor-pointer ${
pathname === child.url
? "bg-gradient-to-br from-slate-100 to-blue-100/40 text-slate-900 border-l-4 border-blue-500"
: "text-slate-600 hover:bg-slate-50 hover:text-slate-900"
}`}
onClick={() => handleMenuClick(child)}
>
{child.icon}

45
run-windows.bat Normal file
View File

@ -0,0 +1,45 @@
@echo off
REM 스크립트가 있는 디렉토리로 이동
cd /d "%~dp0"
echo =====================================
echo PLM 솔루션 - Windows 시작
echo =====================================
echo 기존 컨테이너 및 네트워크 정리 중...
docker-compose -f docker-compose.win.yml down -v 2>nul
docker network rm plm-network 2>nul
echo PLM 서비스 시작 중...
docker-compose -f docker-compose.win.yml build --no-cache
docker-compose -f docker-compose.win.yml up -d
if %errorlevel% equ 0 (
echo.
echo ✅ PLM 서비스가 성공적으로 시작되었습니다!
echo.
echo 🌐 접속 URL:
echo • 프론트엔드 (Next.js): http://localhost:3000
echo • 백엔드 (Spring/JSP): http://localhost:9090
echo.
echo 📋 서비스 상태 확인:
echo docker-compose -f docker-compose.win.yml ps
echo.
echo 📊 로그 확인:
echo docker-compose -f docker-compose.win.yml logs
echo.
echo 5초 후 프론트엔드 페이지를 자동으로 엽니다...
timeout /t 5 /nobreak >nul
start http://localhost:3000
) else (
echo.
echo ❌ PLM 서비스 시작에 실패했습니다!
echo.
echo 🔍 문제 해결 방법:
echo 1. Docker Desktop이 실행 중인지 확인
echo 2. 포트가 사용 중인지 확인 (3000, 9090)
echo 3. 로그 확인: docker-compose -f docker-compose.win.yml logs
echo.
pause
)

71
start-all-separated.bat Normal file
View File

@ -0,0 +1,71 @@
@echo off
chcp 65001 >nul
REM 스크립트가 있는 디렉토리로 이동
cd /d "%~dp0"
echo ============================================
echo PLM 솔루션 - 전체 서비스 시작 (분리형)
echo ============================================
echo.
echo 🚀 백엔드와 프론트엔드를 순차적으로 시작합니다...
echo.
REM 백엔드 먼저 시작
echo ============================================
echo 1. 백엔드 서비스 시작 중...
echo ============================================
REM 기존 컨테이너 및 네트워크 정리
docker-compose -f docker-compose.backend.win.yml down -v 2>nul
docker-compose -f docker-compose.frontend.win.yml down -v 2>nul
docker network rm pms-network 2>nul
REM 백엔드 빌드 및 시작
docker-compose -f docker-compose.backend.win.yml build --no-cache
docker-compose -f docker-compose.backend.win.yml up -d
echo.
echo ⏳ 백엔드 서비스 안정화 대기 중... (20초)
timeout /t 20 /nobreak >nul
REM 프론트엔드 시작
echo.
echo ============================================
echo 2. 프론트엔드 서비스 시작 중...
echo ============================================
REM 프론트엔드 빌드 및 시작
docker-compose -f docker-compose.frontend.win.yml build --no-cache
docker-compose -f docker-compose.frontend.win.yml up -d
echo.
echo ⏳ 프론트엔드 서비스 안정화 대기 중... (10초)
timeout /t 10 /nobreak >nul
echo.
echo ============================================
echo 🎉 모든 서비스가 시작되었습니다!
echo ============================================
echo.
echo [DATABASE] PostgreSQL: http://39.117.244.52:11132
echo [BACKEND] Spring Boot: http://localhost:8080/api
echo [FRONTEND] Next.js: http://localhost:9771
echo.
echo 서비스 상태 확인:
echo 백엔드: docker-compose -f docker-compose.backend.win.yml ps
echo 프론트엔드: docker-compose -f docker-compose.frontend.win.yml ps
echo.
echo 로그 확인:
echo 백엔드: docker-compose -f docker-compose.backend.win.yml logs -f
echo 프론트엔드: docker-compose -f docker-compose.frontend.win.yml logs -f
echo.
echo 서비스 중지:
echo 백엔드: docker-compose -f docker-compose.backend.win.yml down
echo 프론트엔드: docker-compose -f docker-compose.frontend.win.yml down
echo 전체: stop-all-separated.bat
echo.
echo ============================================
pause

97
start-windows-simple.bat Normal file
View File

@ -0,0 +1,97 @@
@echo off
chcp 65001 >nul
REM 스크립트가 있는 디렉토리로 이동
cd /d "%~dp0"
echo ============================================
echo PLM 솔루션 - 윈도우 간편 시작
echo ============================================
echo.
REM Docker Desktop 실행 확인
echo 🔍 Docker Desktop 상태 확인 중...
docker --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Docker Desktop이 실행되지 않았습니다!
echo Docker Desktop을 먼저 실행해주세요.
echo.
pause
exit /b 1
)
echo ✅ Docker Desktop이 실행 중입니다.
echo.
REM 기존 컨테이너 정리
echo 🧹 기존 컨테이너 정리 중...
docker-compose -f docker-compose.backend.win.yml down -v 2>nul
docker-compose -f docker-compose.frontend.win.yml down -v 2>nul
docker network rm pms-network 2>nul
echo.
REM 백엔드 시작
echo ============================================
echo 🚀 1단계: 백엔드 서비스 시작 중...
echo ============================================
docker-compose -f docker-compose.backend.win.yml up -d --build
if %errorlevel% neq 0 (
echo ❌ 백엔드 시작 실패!
echo 로그를 확인하세요: docker-compose -f docker-compose.backend.win.yml logs
pause
exit /b 1
)
echo ✅ 백엔드 서비스 시작 완료
echo ⏳ 백엔드 안정화 대기 중... (30초)
timeout /t 30 /nobreak >nul
REM 프론트엔드 시작
echo.
echo ============================================
echo 🎨 2단계: 프론트엔드 서비스 시작 중...
echo ============================================
docker-compose -f docker-compose.frontend.win.yml up -d --build
if %errorlevel% neq 0 (
echo ❌ 프론트엔드 시작 실패!
echo 로그를 확인하세요: docker-compose -f docker-compose.frontend.win.yml logs
pause
exit /b 1
)
echo ✅ 프론트엔드 서비스 시작 완료
echo ⏳ 프론트엔드 안정화 대기 중... (15초)
timeout /t 15 /nobreak >nul
echo.
echo ============================================
echo 🎉 PLM 솔루션이 성공적으로 시작되었습니다!
echo ============================================
echo.
echo 📱 접속 정보:
echo • 프론트엔드: http://localhost:9771
echo • 백엔드 API: http://localhost:8080/api
echo • 데이터베이스: 39.117.244.52:11132
echo.
echo 📊 서비스 상태 확인:
echo docker-compose -f docker-compose.backend.win.yml ps
echo docker-compose -f docker-compose.frontend.win.yml ps
echo.
echo 📋 로그 확인:
echo 백엔드: docker-compose -f docker-compose.backend.win.yml logs -f
echo 프론트엔드: docker-compose -f docker-compose.frontend.win.yml logs -f
echo.
echo 🛑 서비스 중지:
echo stop-all-separated.bat 실행
echo.
REM 브라우저 자동 열기
echo 5초 후 브라우저에서 애플리케이션을 엽니다...
timeout /t 5 /nobreak >nul
start http://localhost:9771
echo.
echo 애플리케이션이 준비되었습니다!
pause

47
test-backend-build.bat Normal file
View File

@ -0,0 +1,47 @@
@echo off
chcp 65001 >nul
REM 스크립트가 있는 디렉토리로 이동
cd /d "%~dp0"
echo ============================================
echo 백엔드 빌드 테스트 (Windows 전용)
echo ============================================
echo.
echo 🔍 기존 컨테이너 정리 중...
docker-compose -f docker-compose.backend.win.yml down -v 2>nul
echo.
echo 🚀 백엔드 빌드 시작...
docker-compose -f docker-compose.backend.win.yml build --no-cache
if %errorlevel% equ 0 (
echo.
echo ✅ 백엔드 빌드 성공!
echo.
echo 🚀 백엔드 시작 중...
docker-compose -f docker-compose.backend.win.yml up -d
if %errorlevel% equ 0 (
echo ✅ 백엔드 시작 완료!
echo.
echo 📊 컨테이너 상태:
docker-compose -f docker-compose.backend.win.yml ps
echo.
echo 📋 로그 확인:
echo docker-compose -f docker-compose.backend.win.yml logs -f
echo.
echo 🌐 헬스체크:
echo http://localhost:8080/health
) else (
echo ❌ 백엔드 시작 실패!
echo 로그를 확인하세요: docker-compose -f docker-compose.backend.win.yml logs
)
) else (
echo ❌ 백엔드 빌드 실패!
echo 위의 오류 메시지를 확인하세요.
)
echo.
pause