mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #837 from wish-oss/fix/gpu-setup
fix: update GPU setup command to use sudo and add error handling
This commit is contained in:
@@ -303,7 +303,7 @@ const setupLocalServer = async (daemonConfig: any) => {
|
|||||||
await fs.writeFile(configFile, JSON.stringify(daemonConfig, null, 2));
|
await fs.writeFile(configFile, JSON.stringify(daemonConfig, null, 2));
|
||||||
|
|
||||||
const setupCommands = [
|
const setupCommands = [
|
||||||
`pkexec sh -c '
|
`sudo sh -c '
|
||||||
cp ${configFile} /etc/docker/daemon.json &&
|
cp ${configFile} /etc/docker/daemon.json &&
|
||||||
mkdir -p /etc/nvidia-container-runtime &&
|
mkdir -p /etc/nvidia-container-runtime &&
|
||||||
sed -i "/swarm-resource/d" /etc/nvidia-container-runtime/config.toml &&
|
sed -i "/swarm-resource/d" /etc/nvidia-container-runtime/config.toml &&
|
||||||
@@ -314,7 +314,14 @@ const setupLocalServer = async (daemonConfig: any) => {
|
|||||||
`rm ${configFile}`,
|
`rm ${configFile}`,
|
||||||
].join(" && ");
|
].join(" && ");
|
||||||
|
|
||||||
await execAsync(setupCommands);
|
try {
|
||||||
|
await execAsync(setupCommands);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Setup failed:", error);
|
||||||
|
throw new Error(
|
||||||
|
"Failed to configure GPU support. Please ensure you have sudo privileges and try again.",
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const addGpuLabel = async (nodeId: string, serverId?: string) => {
|
const addGpuLabel = async (nodeId: string, serverId?: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user