diff --git a/static/js/launch_progress.js b/static/js/launch_progress.js index dffba3e..01e17b5 100644 --- a/static/js/launch_progress.js +++ b/static/js/launch_progress.js @@ -499,7 +499,8 @@ async function startLaunch(data) { `; stackDeployStepElement.querySelector('.step-content').appendChild(stackProgressDiv); - const stackResult = await deployStack(dockerComposeResult.content, `docupulse_${data.port}`, data.port); + const stackName = generateStackName(data.port); + const stackResult = await deployStack(dockerComposeResult.content, stackName, data.port); launchReport.steps.push({ step: 'Stack Deployment', status: stackResult.success ? 'success' : 'error', @@ -530,7 +531,7 @@ async function startLaunch(data) { // Continue with the process using the available data stackResult.data = stackResult.data || { - name: `docupulse_${data.port}`, + name: stackName, status: 'creating', id: null }; @@ -2652,7 +2653,7 @@ async function deployStack(dockerComposeContent, stackName, port) { 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content }, body: JSON.stringify({ - name: `docupulse_${port}`, + name: stackName, StackFileContent: dockerComposeContent, Env: [ { @@ -2727,7 +2728,7 @@ async function deployStack(dockerComposeContent, stackName, port) { // Start polling immediately since the stack creation was initiated console.log('Starting to poll for stack status after 504 timeout...'); - const pollResult = await pollStackStatus(`docupulse_${port}`, 15 * 60 * 1000); // 15 minutes max + const pollResult = await pollStackStatus(stackName, 15 * 60 * 1000); // 15 minutes max return pollResult; } @@ -2742,7 +2743,7 @@ async function deployStack(dockerComposeContent, stackName, port) { // If stack is being created, poll for status if (result.data.status === 'creating') { console.log('Stack is being created, polling for status...'); - const pollResult = await pollStackStatus(`docupulse_${port}`, 10 * 60 * 1000); // 10 minutes max + const pollResult = await pollStackStatus(stackName, 10 * 60 * 1000); // 10 minutes max return pollResult; } @@ -2917,4 +2918,16 @@ async function pollStackStatus(stackName, maxWaitTime = 15 * 60 * 1000) { status: lastKnownStatus } }; -} \ No newline at end of file +} + +// Helper function to generate unique stack names with timestamp +function generateStackName(port) { + const now = new Date(); + const timestamp = now.getFullYear().toString() + + (now.getMonth() + 1).toString().padStart(2, '0') + + now.getDate().toString().padStart(2, '0') + '_' + + now.getHours().toString().padStart(2, '0') + + now.getMinutes().toString().padStart(2, '0') + + now.getSeconds().toString().padStart(2, '0'); + return `docupulse_${port}_${timestamp}`; +} \ No newline at end of file diff --git a/utils/__pycache__/event_logger.cpython-313.pyc b/utils/__pycache__/event_logger.cpython-313.pyc index dad25b1..c794a08 100644 Binary files a/utils/__pycache__/event_logger.cpython-313.pyc and b/utils/__pycache__/event_logger.cpython-313.pyc differ