mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-30 12:09:15 +00:00
feat: Implement Docker Compose stack management, container monitoring, and interactive bash terminal with new frontend and backend services.
This commit is contained in:
+25
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user