Merge pull request #870 from drudge/setup

fix(setup/validate): arm64 build fixes, improved validation
This commit is contained in:
Mauricio Siu
2024-12-13 01:07:13 -06:00
committed by GitHub
4 changed files with 68 additions and 33 deletions

View File

@@ -262,16 +262,16 @@ export function StatusRow({
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{showIcon ? ( {showIcon ? (
<> <>
{isEnabled ? (
<CheckCircle2 className="size-4 text-green-500" />
) : (
<XCircle className="size-4 text-red-500" />
)}
<span <span
className={`text-sm ${isEnabled ? "text-green-500" : "text-red-500"}`} className={`text-sm ${isEnabled ? "text-green-500" : "text-red-500"}`}
> >
{description || (isEnabled ? "Installed" : "Not Installed")} {description || (isEnabled ? "Installed" : "Not Installed")}
</span> </span>
{isEnabled ? (
<CheckCircle2 className="size-4 text-green-500" />
) : (
<XCircle className="size-4 text-red-500" />
)}
</> </>
) : ( ) : (
<span className="text-sm text-muted-foreground">{value}</span> <span className="text-sm text-muted-foreground">{value}</span>

View File

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

View File

@@ -79,6 +79,7 @@ const installRequirements = async (serverId: string, logPath: string) => {
DOCKER_VERSION=27.0.3 DOCKER_VERSION=27.0.3
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"') OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
SYS_ARCH=$(uname -m)
CURRENT_USER=$USER CURRENT_USER=$USER
echo "Installing requirements for: OS: $OS_TYPE" echo "Installing requirements for: OS: $OS_TYPE"
@@ -127,6 +128,7 @@ const installRequirements = async (serverId: string, logPath: string) => {
esac esac
echo -e "---------------------------------------------" echo -e "---------------------------------------------"
echo "| CPU Architecture | $SYS_ARCH"
echo "| Operating System | $OS_TYPE $OS_VERSION" echo "| Operating System | $OS_TYPE $OS_VERSION"
echo "| Docker | $DOCKER_VERSION" echo "| Docker | $DOCKER_VERSION"
echo -e "---------------------------------------------\n" echo -e "---------------------------------------------\n"
@@ -318,8 +320,8 @@ const installUtilities = () => `
apk add curl wget git jq openssl >/dev/null apk add curl wget git jq openssl >/dev/null
;; ;;
ubuntu | debian | raspbian) ubuntu | debian | raspbian)
apt-get update -y >/dev/null DEBIAN_FRONTEND=noninteractive apt-get update -y >/dev/null
apt-get install -y curl wget git jq openssl >/dev/null DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget git jq openssl >/dev/null
;; ;;
centos | fedora | rhel | ol | rocky | almalinux | amzn) centos | fedora | rhel | ol | rocky | almalinux | amzn)
if [ "$OS_TYPE" = "amzn" ]; then if [ "$OS_TYPE" = "amzn" ]; then
@@ -489,7 +491,8 @@ export const installRClone = () => `
echo "RClone already installed ✅" echo "RClone already installed ✅"
else else
curl https://rclone.org/install.sh | sudo bash 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 fi
`; `;
@@ -500,18 +503,20 @@ export const createTraefikInstance = () => {
echo "Traefik already exists ✅" echo "Traefik already exists ✅"
else else
# Create the dokploy-traefik service # Create the dokploy-traefik service
docker service create \ TRAEFIK_VERSION=3.1.2
--name dokploy-traefik \ docker service create \
--replicas 1 \ --name dokploy-traefik \
--constraint 'node.role==manager' \ --replicas 1 \
--network dokploy-network \ --constraint 'node.role==manager' \
--mount type=bind,src=/etc/dokploy/traefik/traefik.yml,dst=/etc/traefik/traefik.yml \ --network dokploy-network \
--mount type=bind,src=/etc/dokploy/traefik/dynamic,dst=/etc/dokploy/traefik/dynamic \ --mount type=bind,src=/etc/dokploy/traefik/traefik.yml,dst=/etc/traefik/traefik.yml \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \ --mount type=bind,src=/etc/dokploy/traefik/dynamic,dst=/etc/dokploy/traefik/dynamic \
--label traefik.enable=true \ --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--publish mode=host,target=443,published=443 \ --label traefik.enable=true \
--publish mode=host,target=80,published=80 \ --publish mode=host,target=443,published=443 \
traefik:v3.1.2 --publish mode=host,target=80,published=80 \
traefik:v$TRAEFIK_VERSION
echo "Traefik version $TRAEFIK_VERSION installed ✅"
fi fi
`; `;
@@ -524,15 +529,20 @@ const installNixpacks = () => `
else else
export NIXPACKS_VERSION=1.29.1 export NIXPACKS_VERSION=1.29.1
bash -c "$(curl -fsSL https://nixpacks.com/install.sh)" bash -c "$(curl -fsSL https://nixpacks.com/install.sh)"
echo "Nixpacks version 1.28.1 installed ✅" echo "Nixpacks version $NIXPACKS_VERSION installed ✅"
fi fi
`; `;
const installBuildpacks = () => ` const installBuildpacks = () => `
SUFFIX=""
if [ "$SYS_ARCH" = "aarch64" ] || [ "$SYS_ARCH" = "arm64" ]; then
SUFFIX="-arm64"
fi
if command_exists pack; then if command_exists pack; then
echo "Buildpacks already installed ✅" echo "Buildpacks already installed ✅"
else 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 BUILDPACKS_VERSION=0.35.0
echo "Buildpacks version 0.35.0 installed ✅" 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 fi
`; `;

View File

@@ -11,7 +11,7 @@ export const validateDocker = () => `
export const validateRClone = () => ` export const validateRClone = () => `
if command_exists rclone; then 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 else
echo "0.0.0 false" echo "0.0.0 false"
fi fi
@@ -27,7 +27,12 @@ export const validateSwarm = () => `
export const validateNixpacks = () => ` export const validateNixpacks = () => `
if command_exists nixpacks; then 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 else
echo "0.0.0 false" echo "0.0.0 false"
fi fi
@@ -35,7 +40,12 @@ export const validateNixpacks = () => `
export const validateBuildpacks = () => ` export const validateBuildpacks = () => `
if command_exists pack; then 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 else
echo "0.0.0 false" echo "0.0.0 false"
fi fi