Files
nixpanel-server/server/src/index.ts
T
NixReaper 8ff00c544c feat: v0.4.0 — Apache service stack, shell access, log viewer, changelog
Service stack (backend):
- webserver.ts rewritten: apache2/php-fpm routes replacing nginx; per-account
  Apache log endpoint; PHP-FPM reload per version; apache2ctl configtest/reload
- accounts.ts: added PUT /:id/shell to toggle /bin/bash vs /usr/sbin/nologin,
  runs usermod -s and writes audit log

New UI features (nixserver):
- ShellAccess page: grant/revoke SSH access per account via AccountPicker
- ApacheLogs page: live log viewer (access/error) per account; replaces stub
- NginxLogs: re-exports ApacheLogs (NixPanel uses Apache, not NGINX)
- WebServer page: shows apache2, php8.2-fpm, php8.3-fpm status with reload
  buttons; config test; Apache log viewer

Bug fixes:
- Accounts.tsx: Lucide icon size prop type widened (string|number); removed
  unused Users import; dropped duplicate NGINX log card
- Removed soon badge from ShellAccess and ApacheLogs entries

Project:
- CHANGELOG.md created with full history from 0.2.x through 0.4.0
- All packages bumped from 0.3.2 to 0.4.0
2026-04-11 05:17:49 -05:00

40 lines
1011 B
TypeScript

import 'dotenv/config'
import { buildApp } from './app.js'
import { config } from './config.js'
import prisma from './db/client.js'
import { startScheduler, stopScheduler } from './scheduler.js'
async function start() {
let app
try {
await prisma.$connect()
console.log('[nixpanel] Database connected')
app = await buildApp()
await app.listen({ port: config.server.nixserverPort, host: config.server.host })
console.log(`[nixpanel] API running on ${config.server.host}:${config.server.nixserverPort}`)
startScheduler()
} catch (err) {
console.error('[nixpanel] Failed to start:', err)
await prisma.$disconnect()
process.exit(1)
}
const shutdown = async (signal: string) => {
console.log(`[nixpanel] ${signal} received, shutting down...`)
await app?.close()
await stopScheduler()
await prisma.$disconnect()
process.exit(0)
}
process.on('SIGTERM', () => shutdown('SIGTERM'))
process.on('SIGINT', () => shutdown('SIGINT'))
}
start()