fix(setup/validate): arm64 build fixes, improved validation

This commit is contained in:
Nicholas Penree 2024-12-12 12:02:09 -05:00
parent bb31bef8bc
commit 1c498ee2d2
3 changed files with 61 additions and 26 deletions

View File

@ -1,4 +1,5 @@
import { AlertBlock } from "@/components/shared/alert-block";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
@ -8,9 +9,8 @@ import {
} from "@/components/ui/card";
import { api } from "@/utils/api";
import { Loader2, PcCase, RefreshCw } from "lucide-react";
import { StatusRow } from "./gpu-support";
import { Button } from "@/components/ui/button";
import { useState } from "react";
import { StatusRow } from "./gpu-support";
interface Props {
serverId: string;
@ -66,7 +66,7 @@ export const ValidateServer = ({ serverId }: Props) => {
{isLoading ? (
<div className="flex items-center justify-center text-muted-foreground py-4">
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
<span>Checking Server Configuration</span>
<span>Checking Server configuration</span>
</div>
) : (
<div className="grid w-full gap-4">
@ -113,16 +113,31 @@ export const ValidateServer = ({ serverId }: Props) => {
}
/>
<StatusRow
label="Dokploy Network Installed"
isEnabled={data?.isDokployNetworkInstalled}
label="Docker Swarm Initialized"
isEnabled={data?.isSwarmInstalled}
description={
data?.isSwarmInstalled
? "Initialized"
: "Not Initialized"
}
/>
<StatusRow
label="Swarm Installed"
isEnabled={data?.isSwarmInstalled}
label="Dokploy Network Created"
isEnabled={data?.isDokployNetworkInstalled}
description={
data?.isDokployNetworkInstalled
? "Created"
: "Not Created"
}
/>
<StatusRow
label="Main Directory Created"
isEnabled={data?.isMainDirectoryInstalled}
description={
data?.isMainDirectoryInstalled
? "Created"
: "Not Created"
}
/>
</div>
</div>

View File

@ -79,6 +79,7 @@ const installRequirements = async (serverId: string, logPath: string) => {
DOCKER_VERSION=27.0.3
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
SYS_ARCH=$(uname -m)
CURRENT_USER=$USER
echo "Installing requirements for: OS: $OS_TYPE"
@ -127,6 +128,7 @@ const installRequirements = async (serverId: string, logPath: string) => {
esac
echo -e "---------------------------------------------"
echo "| CPU Architecture | $SYS_ARCH"
echo "| Operating System | $OS_TYPE $OS_VERSION"
echo "| Docker | $DOCKER_VERSION"
echo -e "---------------------------------------------\n"
@ -489,7 +491,8 @@ export const installRClone = () => `
echo "RClone already installed ✅"
else
curl https://rclone.org/install.sh | sudo bash
echo "RClone installed successfully ✅"
RCLONE_VERSION=$(rclone --version | head -n 1 | awk '{print $2}' | sed 's/^v//')
echo "RClone version $RCLONE_VERSION installed ✅"
fi
`;
@ -500,18 +503,20 @@ export const createTraefikInstance = () => {
echo "Traefik already exists ✅"
else
# Create the dokploy-traefik service
docker service create \
--name dokploy-traefik \
--replicas 1 \
--constraint 'node.role==manager' \
--network dokploy-network \
--mount type=bind,src=/etc/dokploy/traefik/traefik.yml,dst=/etc/traefik/traefik.yml \
--mount type=bind,src=/etc/dokploy/traefik/dynamic,dst=/etc/dokploy/traefik/dynamic \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--label traefik.enable=true \
--publish mode=host,target=443,published=443 \
--publish mode=host,target=80,published=80 \
traefik:v3.1.2
TRAEFIK_VERSION=3.1.2
docker service create \
--name dokploy-traefik \
--replicas 1 \
--constraint 'node.role==manager' \
--network dokploy-network \
--mount type=bind,src=/etc/dokploy/traefik/traefik.yml,dst=/etc/traefik/traefik.yml \
--mount type=bind,src=/etc/dokploy/traefik/dynamic,dst=/etc/dokploy/traefik/dynamic \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--label traefik.enable=true \
--publish mode=host,target=443,published=443 \
--publish mode=host,target=80,published=80 \
traefik:v$TRAEFIK_VERSION
echo "Traefik version $TRAEFIK_VERSION installed ✅"
fi
`;
@ -524,15 +529,20 @@ const installNixpacks = () => `
else
export NIXPACKS_VERSION=1.29.1
bash -c "$(curl -fsSL https://nixpacks.com/install.sh)"
echo "Nixpacks version 1.28.1 installed ✅"
echo "Nixpacks version $NIXPACKS_VERSION installed ✅"
fi
`;
const installBuildpacks = () => `
SUFFIX=""
if [ "$SYS_ARCH" = "aarch64" ] || [ "$SYS_ARCH" = "arm64" ]; then
SUFFIX="-arm64"
fi
if command_exists pack; then
echo "Buildpacks already installed ✅"
else
curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.35.0/pack-v0.35.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack
echo "Buildpacks version 0.35.0 installed ✅"
BUILDPACKS_VERSION=0.35.0
curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.35.0/pack-v$BUILDPACKS_VERSION-linux$SUFFIX.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack
echo "Buildpacks version $BUILDPACKS_VERSION installed ✅"
fi
`;

View File

@ -11,7 +11,7 @@ export const validateDocker = () => `
export const validateRClone = () => `
if command_exists rclone; then
echo "$(rclone --version | head -n 1 | awk '{print $2}') true"
echo "$(rclone --version | head -n 1 | awk '{print $2}' | sed 's/^v//') true"
else
echo "0.0.0 false"
fi
@ -27,7 +27,12 @@ export const validateSwarm = () => `
export const validateNixpacks = () => `
if command_exists nixpacks; then
echo "$(nixpacks --version | awk '{print $2}') true"
version=$(nixpacks --version | awk '{print $2}')
if [ -n "$version" ]; then
echo "$version true"
else
echo "0.0.0 false"
fi
else
echo "0.0.0 false"
fi
@ -35,7 +40,12 @@ export const validateNixpacks = () => `
export const validateBuildpacks = () => `
if command_exists pack; then
echo "$(pack --version | awk '{print $1}') true"
version=$(pack --version | awk '{print $1}')
if [ -n "$version" ]; then
echo "$version true"
else
echo "0.0.0 false"
fi
else
echo "0.0.0 false"
fi