mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-08 13:05:17 +00:00
Merge pull request #3626 from Dokploy/3535-container-creation-fails-after-vps-restart-bind-source-path-does-not-exist
feat(logs): display error messages for containers in dashboard logs
This commit is contained in:
@@ -171,6 +171,13 @@ export const ShowDockerLogs = ({ appName, serverId }: Props) => {
|
|||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
{option === "swarm" &&
|
||||||
|
services?.find((c) => c.containerId === containerId)?.error && (
|
||||||
|
<div className="rounded-md bg-destructive/10 border border-destructive/20 px-3 py-2 text-sm text-destructive">
|
||||||
|
<span className="font-medium">Error: </span>
|
||||||
|
{services.find((c) => c.containerId === containerId)?.error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<DockerLogs
|
<DockerLogs
|
||||||
serverId={serverId || ""}
|
serverId={serverId || ""}
|
||||||
containerId={containerId || "select-a-container"}
|
containerId={containerId || "select-a-container"}
|
||||||
|
|||||||
@@ -156,6 +156,13 @@ export const ShowDockerLogsStack = ({ appName, serverId }: Props) => {
|
|||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
{option === "swarm" &&
|
||||||
|
services?.find((c) => c.containerId === containerId)?.error && (
|
||||||
|
<div className="rounded-md bg-destructive/10 border border-destructive/20 px-3 py-2 text-sm text-destructive">
|
||||||
|
<span className="font-medium">Error: </span>
|
||||||
|
{services.find((c) => c.containerId === containerId)?.error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<DockerLogs
|
<DockerLogs
|
||||||
serverId={serverId || ""}
|
serverId={serverId || ""}
|
||||||
containerId={containerId || "select-a-container"}
|
containerId={containerId || "select-a-container"}
|
||||||
|
|||||||
@@ -172,7 +172,9 @@ export const getStackContainersByAppName = async (
|
|||||||
try {
|
try {
|
||||||
let result: string[] = [];
|
let result: string[] = [];
|
||||||
|
|
||||||
const command = `docker stack ps ${appName} --format 'CONTAINER ID : {{.ID}} | Name: {{.Name}} | State: {{.DesiredState}} | Node: {{.Node}} | CurrentState: {{.CurrentState}}'`;
|
const command = `docker stack ps ${appName} --no-trunc --format 'CONTAINER ID : {{.ID}} | Name: {{.Name}} | State: {{.DesiredState}} | Node: {{.Node}} | CurrentState: {{.CurrentState}} | Error: {{.Error}}'`;
|
||||||
|
|
||||||
|
console.log("command ", command);
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
const { stdout, stderr } = await execAsyncRemote(serverId, command);
|
const { stdout, stderr } = await execAsyncRemote(serverId, command);
|
||||||
|
|
||||||
@@ -212,12 +214,14 @@ export const getStackContainersByAppName = async (
|
|||||||
const currentState = parts[4]
|
const currentState = parts[4]
|
||||||
? parts[4].replace("CurrentState: ", "").trim()
|
? parts[4].replace("CurrentState: ", "").trim()
|
||||||
: "";
|
: "";
|
||||||
|
const error = parts[5] ? parts[5].replace("Error: ", "").trim() : "";
|
||||||
return {
|
return {
|
||||||
containerId,
|
containerId,
|
||||||
name,
|
name,
|
||||||
state,
|
state,
|
||||||
node,
|
node,
|
||||||
currentState,
|
currentState,
|
||||||
|
error,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,7 +238,7 @@ export const getServiceContainersByAppName = async (
|
|||||||
try {
|
try {
|
||||||
let result: string[] = [];
|
let result: string[] = [];
|
||||||
|
|
||||||
const command = `docker service ps ${appName} --format 'CONTAINER ID : {{.ID}} | Name: {{.Name}} | State: {{.DesiredState}} | Node: {{.Node}} | CurrentState: {{.CurrentState}}'`;
|
const command = `docker service ps ${appName} --no-trunc --format 'CONTAINER ID : {{.ID}} | Name: {{.Name}} | State: {{.DesiredState}} | Node: {{.Node}} | CurrentState: {{.CurrentState}} | Error: {{.Error}}'`;
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
const { stdout, stderr } = await execAsyncRemote(serverId, command);
|
const { stdout, stderr } = await execAsyncRemote(serverId, command);
|
||||||
|
|
||||||
@@ -276,12 +280,14 @@ export const getServiceContainersByAppName = async (
|
|||||||
const currentState = parts[4]
|
const currentState = parts[4]
|
||||||
? parts[4].replace("CurrentState: ", "").trim()
|
? parts[4].replace("CurrentState: ", "").trim()
|
||||||
: "";
|
: "";
|
||||||
|
const error = parts[5] ? parts[5].replace("Error: ", "").trim() : "";
|
||||||
return {
|
return {
|
||||||
containerId,
|
containerId,
|
||||||
name,
|
name,
|
||||||
state,
|
state,
|
||||||
currentState,
|
currentState,
|
||||||
node,
|
node,
|
||||||
|
error,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user