diff --git a/.gitignore b/.gitignore index dd935c30..e1c08e55 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ installer bin .secrets test_event.json +.idea/ diff --git a/src/app/[orgId]/settings/sites/create/page.tsx b/src/app/[orgId]/settings/sites/create/page.tsx index f078b9d7..4ab0d71f 100644 --- a/src/app/[orgId]/settings/sites/create/page.tsx +++ b/src/app/[orgId]/settings/sites/create/page.tsx @@ -25,27 +25,18 @@ import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { Input } from "@app/components/ui/input"; -import { Terminal, InfoIcon } from "lucide-react"; +import { InfoIcon, Terminal } from "lucide-react"; import { Button } from "@app/components/ui/button"; import CopyTextBox from "@app/components/CopyTextBox"; import CopyToClipboard from "@app/components/CopyToClipboard"; -import { - InfoSection, - InfoSectionContent, - InfoSections, - InfoSectionTitle -} from "@app/components/InfoSection"; -import { FaWindows, FaApple, FaFreebsd, FaDocker } from "react-icons/fa"; +import { InfoSection, InfoSectionContent, InfoSections, InfoSectionTitle } from "@app/components/InfoSection"; +import { FaApple, FaCubes, FaDocker, FaFreebsd, FaWindows } from "react-icons/fa"; import { Checkbox } from "@app/components/ui/checkbox"; import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert"; import { generateKeypair } from "../[niceId]/wireguardConfig"; import { createApiClient, formatAxiosError } from "@app/lib/api"; import { useEnvContext } from "@app/hooks/useEnvContext"; -import { - CreateSiteBody, - CreateSiteResponse, - PickSiteDefaultsResponse -} from "@server/routers/site"; +import { CreateSiteBody, CreateSiteResponse, PickSiteDefaultsResponse } from "@server/routers/site"; import { toast } from "@app/hooks/useToast"; import { AxiosResponse } from "axios"; import { useParams, useRouter } from "next/navigation"; @@ -91,8 +82,20 @@ type Commands = { linux: Record; windows: Record; docker: Record; + podman: Record; }; +const platforms = [ + "linux", + "docker", + "podman", + "mac", + "windows", + "freebsd" +] as const; + +type Platform = typeof platforms[number]; + export default function Page() { const { env } = useEnvContext(); const api = createApiClient({ env }); @@ -123,7 +126,7 @@ export default function Page() { const [loadingPage, setLoadingPage] = useState(true); - const [platform, setPlatform] = useState("linux"); + const [platform, setPlatform] = useState("linux"); const [architecture, setArchitecture] = useState("amd64"); const [commands, setCommands] = useState(null); @@ -231,6 +234,29 @@ PersistentKeepalive = 5`; "Docker Run": [ `docker run -it fosrl/newt --id ${id} --secret ${secret} --endpoint ${endpoint}` ] + }, + podman: { + "Podman Quadlet": [ + `[Unit] +Description=Newt container + +[Container] +ContainerName=newt +Image=docker.io/fosrl/newt +Environment=PANGOLIN_ENDPOINT=${endpoint} +Environment=NEWT_ID=${id} +Environment=NEWT_SECRET=${secret} +# Secret=newt-secret,type=env,target=NEWT_SECRET + +[Service] +Restart=always + +[Install] +WantedBy=default.target` + ], + "Podman Run": [ + `podman run -it docker.io/fosrl/newt --id ${id} --secret ${secret} --endpoint ${endpoint}` + ] } }; setCommands(commands); @@ -246,6 +272,8 @@ PersistentKeepalive = 5`; return ["x64"]; case "docker": return ["Docker Compose", "Docker Run"]; + case "podman": + return ["Podman Quadlet", "Podman Run"]; case "freebsd": return ["amd64", "arm64"]; default: @@ -261,6 +289,8 @@ PersistentKeepalive = 5`; return "macOS"; case "docker": return "Docker"; + case "podman": + return "Podman"; case "freebsd": return "FreeBSD"; default: @@ -277,7 +307,7 @@ PersistentKeepalive = 5`; if (!platformCommands) { // get first key - const firstPlatform = Object.keys(commands)[0]; + const firstPlatform = Object.keys(commands)[0] as Platform; platformCommands = commands[firstPlatform as keyof Commands]; setPlatform(firstPlatform); @@ -303,6 +333,8 @@ PersistentKeepalive = 5`; return ; case "docker": return ; + case "podman": + return ; case "freebsd": return ; default: @@ -689,13 +721,7 @@ PersistentKeepalive = 5`; Operating System

- {[ - "linux", - "docker", - "mac", - "windows", - "freebsd" - ].map((os) => ( + {platforms.map((os) => (