fix: Prevent nodemon restarts during policy creation

- Move temp directory outside app folder to /tmp/minio-webui-temp
- Add nodemon.json to ignore temp, logs, and node_modules
- Add TEMP_DIR environment variable configuration
- Add cleanup routine for old temporary policy files (>1 hour)
- Update both dev and production Dockerfiles
- Update docker-compose configurations

This fixes the 500 error during QuickStartWizard policy creation
caused by nodemon restarting when temporary files were created.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This commit is contained in:
2025-07-24 09:35:03 +02:00
co-authored by Claude
parent 9cdd7b0050
commit 93d9c47ad5
6 changed files with 45 additions and 6 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"watch": ["src"],
"ext": "js,json",
"ignore": [
"src/**/*.spec.js",
"node_modules",
"logs",
"temp",
"*.log",
"*.tmp",
"*.temp"
],
"delay": "1000"
}
+23
View File
@@ -19,11 +19,34 @@ class MinIOService {
async ensureTempDir() {
try {
await fs.mkdir(this.tempDir, { recursive: true });
// Clean up old temp files (older than 1 hour)
this.cleanupTempFiles();
} catch (error) {
logger.error('Failed to create temp directory:', error);
}
}
async cleanupTempFiles() {
try {
const files = await fs.readdir(this.tempDir);
const now = Date.now();
const oneHour = 60 * 60 * 1000;
for (const file of files) {
if (file.endsWith('.json')) {
const filePath = path.join(this.tempDir, file);
const stats = await fs.stat(filePath);
if (now - stats.mtimeMs > oneHour) {
await fs.unlink(filePath);
logger.debug(`Cleaned up old temp file: ${file}`);
}
}
}
} catch (error) {
logger.debug('Error cleaning temp files:', error);
}
}
// Execute MinIO CLI command with timeout and error handling
async executeCommand(command, options = {}) {
const { timeout = 30000, parseJson = false } = options;