import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog' import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { $publicKey, pb } from '@/lib/stores' import { Copy, PlusIcon } from 'lucide-react' import { useState, useRef, MutableRefObject } from 'react' import { useStore } from '@nanostores/react' import { cn, copyToClipboard, isReadOnlyUser } from '@/lib/utils' import { navigate } from './router' export function AddSystemButton({ className }: { className?: string }) { const [open, setOpen] = useState(false) const port = useRef() as MutableRefObject const publicKey = useStore($publicKey) function copyDockerCompose(port: string) { copyToClipboard(`services: beszel-agent: image: "henrygd/beszel-agent" container_name: "beszel-agent" restart: unless-stopped network_mode: host volumes: - /var/run/docker.sock:/var/run/docker.sock:ro # monitor other disks / partitions by mounting a folder in /extra-filesystems # - /mnt/disk1/.beszel:/extra-filesystems/disk1:ro environment: PORT: ${port} KEY: "${publicKey}" # FILESYSTEM: /dev/sda1 # override the root partition / device for disk I/O stats`) } async function handleSubmit(e: SubmitEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const data = Object.fromEntries(formData) as Record data.users = pb.authStore.model!.id try { setOpen(false) await pb.collection('systems').create(data) navigate('/') // console.log(record) } catch (e) { console.log(e) } } return ( Add New System The agent must be running on the system to connect. Copy the{' '} docker-compose.yml for the agent below.

Click to copy

) }