feat: implement service management system for Nginx, PHP, and MySQL with IPC handlers and process orchestration

This commit is contained in:
Ümit Tunç
2026-03-28 22:04:21 +03:00
parent d9e1e758a6
commit 139b8df7b2
15 changed files with 90 additions and 39 deletions
+5 -5
View File
@@ -32,13 +32,13 @@ export function registerIpcHandlers(): void {
ipcMain.handle('services:start', async (_event, serviceName: string) => {
try {
const settings = configService.getSettings()
const binDir = path.join(app.getPath('userData'), 'bin')
const binDir = path.join(configService.getBasePath(), 'bin')
if (serviceName === 'nginx') {
const rootPath = path.join(app.getAppPath(), 'www')
const nginxDir = path.join(binDir, 'nginx')
const binPath = findExecutable(nginxDir, 'nginx.exe')
const logDir = path.join(app.getPath('userData'), 'logs')
const logDir = path.join(configService.getBasePath(), 'logs')
if (!binPath) return { success: false, message: 'Nginx executable bulunamadı. Lütfen indirin.' }
@@ -121,8 +121,8 @@ export function registerIpcHandlers(): void {
const mysqlId = mysqlVersion ? `mysql-${mysqlVersion}` : null
const dataDir = mysqlId
? path.join(app.getPath('userData'), `mysql_data_${mysqlId}`)
: path.join(app.getPath('userData'), 'mysql_data')
? path.join(configService.getBasePath(), `mysql_data_${mysqlId}`)
: path.join(configService.getBasePath(), 'mysql_data')
const mysqlDir = mysqlId ? path.join(binDir, mysqlId) : binDir
const binPath = findExecutable(mysqlDir, 'mysqld.exe')
@@ -142,7 +142,7 @@ export function registerIpcHandlers(): void {
const mysqlPort = mysqlId ? (settings.mysqlPorts?.[mysqlId] || '3306') : settings.mysqlPort
const sanitizedServiceName = serviceName.replace(/:/g, '_')
const logFile = path.join(app.getPath('userData'), 'logs', `${sanitizedServiceName}_error.log`)
const logFile = path.join(configService.getBasePath(), 'logs', `${sanitizedServiceName}_error.log`)
const configPath = await configService.generateConfig('my.ini.template', `my_${mysqlId || 'default'}.ini`, {
PORT: mysqlPort,