feat: Implement Docker Compose stack management, container monitoring, and interactive bash terminal with new frontend and backend services.

This commit is contained in:
SaelixCode
2026-02-22 14:40:54 -05:00
parent 280090bd2b
commit d5fac02da3
6 changed files with 132 additions and 133 deletions
+25 -1
View File
@@ -497,6 +497,7 @@ app.post('/api/stacks/:stackName/restart', async (req: Request, res: Response) =
});
// Direct container stop - bypasses docker compose for legacy container support
// Only stops containers that are currently running to avoid 304 errors
app.post('/api/stacks/:stackName/stop', async (req: Request, res: Response) => {
try {
const stackName = req.params.stackName as string;
@@ -504,7 +505,9 @@ app.post('/api/stacks/:stackName/stop', async (req: Request, res: Response) => {
const containers = await dockerController.getContainersByStack(stackName);
if (containers && containers.length > 0) {
for (const c of containers) {
await dockerController.stopContainer(c.Id);
if (c.State === 'running') {
await dockerController.stopContainer(c.Id);
}
}
}
res.json({ status: 'Containers stopped' });
@@ -514,6 +517,27 @@ app.post('/api/stacks/:stackName/stop', async (req: Request, res: Response) => {
}
});
// Direct container start - bypasses docker compose for legacy container support
// Only starts containers that are not currently running
app.post('/api/stacks/:stackName/start', async (req: Request, res: Response) => {
try {
const stackName = req.params.stackName as string;
const dockerController = DockerController.getInstance();
const containers = await dockerController.getContainersByStack(stackName);
if (containers && containers.length > 0) {
for (const c of containers) {
if (c.State !== 'running') {
await dockerController.startContainer(c.Id);
}
}
}
res.json({ status: 'Containers started' });
} catch (error) {
console.error('Failed to start containers:', error);
res.status(500).json({ error: 'Failed to start containers' });
}
});
// Update stack: pull images and recreate containers
app.post('/api/stacks/:stackName/update', async (req: Request, res: Response) => {
try {