mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-11 21:41:41 +02:00
Replace newt and olm with pangolin-cli
This commit is contained in:
+3
-1
@@ -3767,6 +3767,7 @@
|
||||
"noData": "No Data",
|
||||
"machineClients": "Machine Clients",
|
||||
"install": "Install",
|
||||
"downloadInstaller": "Download Installer",
|
||||
"run": "Run",
|
||||
"envFile": "Environment File",
|
||||
"serviceFile": "Service File",
|
||||
@@ -4363,5 +4364,6 @@
|
||||
"rdpUnicodeKeyboardMode": "Unicode keyboard mode",
|
||||
"sessionToolbarShow": "Show toolbar",
|
||||
"sessionToolbarHide": "Hide toolbar",
|
||||
"actionUpdateSiteApprovals": "Update Site Approvals"
|
||||
"actionUpdateSiteApprovals": "Update Site Approvals",
|
||||
"check": "Check"
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
SettingsSectionTitle
|
||||
} from "./Settings";
|
||||
import { CheckboxWithLabel } from "./ui/checkbox";
|
||||
import { Button } from "./ui/button";
|
||||
import { OptionSelect, type OptionSelectOption } from "./OptionSelect";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
@@ -18,11 +19,14 @@ import {
|
||||
FaLinux,
|
||||
FaWindows
|
||||
} from "react-icons/fa";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import { Download, ExternalLink } from "lucide-react";
|
||||
import { SiKubernetes, SiNixos } from "react-icons/si";
|
||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||
|
||||
export type CommandItem = string | { title: string; command: string };
|
||||
export type CommandItem =
|
||||
| string
|
||||
| { title: string; command: string }
|
||||
| { title: string; link: string };
|
||||
|
||||
const PLATFORMS = [
|
||||
"linux",
|
||||
@@ -88,25 +92,39 @@ export function NewtSiteInstallCommands({
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-newt.sh | bash`
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `${runAsRootPrefix}newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
command: `${runAsRootPrefix}pangolin up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
}
|
||||
],
|
||||
"Systemd Service": [
|
||||
"Auto Systemd Service": [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-newt.sh | bash`
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status site`
|
||||
}
|
||||
],
|
||||
"Manual Systemd Service": [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("envFile"),
|
||||
command: `# Create the directory and environment file
|
||||
sudo install -d -m 0755 /etc/newt
|
||||
sudo tee /etc/newt/newt.env > /dev/null << 'EOF'
|
||||
NEWT_ID=${id}
|
||||
NEWT_SECRET=${secret}
|
||||
sudo install -d -m 0755 /etc/pangolin
|
||||
sudo tee /etc/pangolin/pangolin-site.env > /dev/null << 'EOF'
|
||||
SITE_ID=${id}
|
||||
SITE_SECRET=${secret}
|
||||
PANGOLIN_ENDPOINT=${endpoint}${
|
||||
!acceptClients
|
||||
? `
|
||||
@@ -119,11 +137,11 @@ DISABLE_SSH=true`
|
||||
: ""
|
||||
}
|
||||
EOF
|
||||
sudo chmod 600 /etc/newt/newt.env`
|
||||
sudo chmod 600 /etc/pangolin/pangolin-site.env`
|
||||
},
|
||||
{
|
||||
title: t("serviceFile"),
|
||||
command: `sudo tee /etc/systemd/system/newt.service > /dev/null << 'EOF'
|
||||
command: `sudo tee /etc/systemd/system/pangolin-site.service > /dev/null << 'EOF'
|
||||
[Unit]
|
||||
Description=Newt
|
||||
Wants=network-online.target
|
||||
@@ -133,8 +151,8 @@ After=network-online.target
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
EnvironmentFile=/etc/newt/newt.env
|
||||
ExecStart=/usr/local/bin/newt
|
||||
EnvironmentFile=/etc/pangolin/pangolin-site.env
|
||||
ExecStart=/home/owen/fossorial/cli/bin/pangolin up site
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
UMask=0077
|
||||
@@ -148,7 +166,7 @@ EOF`
|
||||
{
|
||||
title: t("enableAndStart"),
|
||||
command: `sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now newt`
|
||||
sudo systemctl enable --now pangolin-site`
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -156,23 +174,54 @@ sudo systemctl enable --now newt`
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-newt.sh | bash`
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
command: `pangolin up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status site`
|
||||
}
|
||||
]
|
||||
},
|
||||
windows: {
|
||||
x64: [
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -o newt.exe -L "https://github.com/fosrl/newt/releases/download/${version}/newt_windows_amd64.exe"`
|
||||
link:
|
||||
version === "latest"
|
||||
? `https://github.com/fosrl/cli/releases/latest/download/pangolin-cli_windows_installer.msi`
|
||||
: `https://github.com/fosrl/cli/releases/download/${version}/pangolin-cli_windows_installer.msi`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `newt.exe --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
command: `pangolin up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status site`
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -180,19 +229,20 @@ sudo systemctl enable --now newt`
|
||||
"Docker Compose": [
|
||||
`services:
|
||||
newt:
|
||||
image: fosrl/newt
|
||||
image: fosrl/pangolin-cli
|
||||
container_name: newt
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- PANGOLIN_ENDPOINT=${endpoint}
|
||||
- NEWT_ID=${id}
|
||||
- NEWT_SECRET=${secret}${acceptClientsEnv}`
|
||||
- SITE_ID=${id}
|
||||
- SITE_SECRET=${secret}${acceptClientsEnv}`
|
||||
],
|
||||
"Docker Run": [
|
||||
`docker run -dit --network host fosrl/newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
`docker run -dit --network host fosrl/pangolin-cli up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
]
|
||||
},
|
||||
kubernetes: {
|
||||
// we are leaving this using newt until we change it to use the cli
|
||||
"Helm Chart": [
|
||||
`helm repo add fossorial https://charts.fossorial.io`,
|
||||
`helm repo update fossorial`,
|
||||
@@ -222,9 +272,9 @@ Description=Newt container
|
||||
ContainerName=newt
|
||||
Image=docker.io/fosrl/newt
|
||||
Environment=PANGOLIN_ENDPOINT=${endpoint}
|
||||
Environment=NEWT_ID=${id}
|
||||
Environment=NEWT_SECRET=${secret}${!acceptClients ? "\nEnvironment=DISABLE_CLIENTS=true" : ""}
|
||||
# Secret=newt-secret,type=env,target=NEWT_SECRET
|
||||
Environment=SITE_ID=${id}
|
||||
Environment=SITE_SECRET=${secret}${!acceptClients ? "\nEnvironment=DISABLE_CLIENTS=true" : ""}
|
||||
# Secret=newt-secret,type=env,target=SITE_SECRET
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
@@ -233,12 +283,12 @@ Restart=always
|
||||
WantedBy=default.target`
|
||||
],
|
||||
"Podman Run": [
|
||||
`podman run -dit docker.io/fosrl/newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
`podman run -dit docker.io/fosrl/pangolin-cli up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
|
||||
]
|
||||
},
|
||||
nixos: {
|
||||
Flake: [
|
||||
`${runAsRootPrefix}nix run 'nixpkgs#fosrl-newt' -- --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
`${runAsRootPrefix}nix run 'nixpkgs#pangolin-cli' -- up site --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}${disableSshFlag}`
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -377,14 +427,23 @@ WantedBy=default.target`
|
||||
)}
|
||||
<div className="mt-2 space-y-3">
|
||||
{commands.map((item, index) => {
|
||||
const isLink =
|
||||
typeof item !== "string" && "link" in item;
|
||||
const commandText =
|
||||
typeof item === "string" ? item : item.command;
|
||||
typeof item === "string"
|
||||
? item
|
||||
: isLink
|
||||
? undefined
|
||||
: item.command;
|
||||
const linkHref = isLink
|
||||
? (item as { link: string }).link
|
||||
: undefined;
|
||||
const title =
|
||||
typeof item === "string"
|
||||
? undefined
|
||||
: item.title;
|
||||
|
||||
const key = `${title ?? ""}::${commandText}`;
|
||||
const key = `${title ?? ""}::${commandText ?? linkHref}`;
|
||||
|
||||
return (
|
||||
<div key={key}>
|
||||
@@ -393,10 +452,23 @@ WantedBy=default.target`
|
||||
{title}
|
||||
</p>
|
||||
)}
|
||||
<CopyTextBox
|
||||
text={commandText}
|
||||
outline={true}
|
||||
/>
|
||||
{isLink ? (
|
||||
<Button
|
||||
asChild
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
>
|
||||
<a href={linkHref}>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
{t("downloadInstaller")}
|
||||
</a>
|
||||
</Button>
|
||||
) : (
|
||||
<CopyTextBox
|
||||
text={commandText!}
|
||||
outline={true}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Terminal } from "lucide-react";
|
||||
import { Download, Terminal } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { FaDocker, FaWindows } from "react-icons/fa";
|
||||
@@ -10,9 +10,13 @@ import {
|
||||
SettingsSectionHeader,
|
||||
SettingsSectionTitle
|
||||
} from "./Settings";
|
||||
import { Button } from "./ui/button";
|
||||
import { OptionSelect, type OptionSelectOption } from "./OptionSelect";
|
||||
|
||||
export type CommandItem = string | { title: string; command: string };
|
||||
export type CommandItem =
|
||||
| string
|
||||
| { title: string; command: string }
|
||||
| { title: string; link: string };
|
||||
|
||||
const PLATFORMS = ["unix", "docker", "windows"] as const;
|
||||
|
||||
@@ -40,14 +44,28 @@ export function OlmInstallCommands({
|
||||
|
||||
const commandList: Record<Platform, Record<string, CommandItem[]>> = {
|
||||
unix: {
|
||||
All: [
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | sudo bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin up --id ${id} --secret ${secret} --endpoint ${endpoint} --attach`
|
||||
command: `sudo pangolin up client --id ${id} --secret ${secret} --endpoint ${endpoint} --attach`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status client`
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -73,15 +91,31 @@ export function OlmInstallCommands({
|
||||
]
|
||||
},
|
||||
windows: {
|
||||
x64: [
|
||||
Run: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `# Download and run the installer to install Olm first\n
|
||||
curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/olm_windows_installer.exe"`
|
||||
link:
|
||||
version === "latest"
|
||||
? `https://github.com/fosrl/cli/releases/latest/download/pangolin-cli_windows_installer.msi`
|
||||
: `https://github.com/fosrl/cli/releases/download/${version}/pangolin-cli_windows_installer.msi`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `olm.exe --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
command: `pangolin up client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
}
|
||||
],
|
||||
Service: [
|
||||
{
|
||||
title: t("install"),
|
||||
command: `curl -fsSL https://static.pangolin.net/get-cli.sh | bash`
|
||||
},
|
||||
{
|
||||
title: t("run"),
|
||||
command: `sudo pangolin service install client --id ${id} --secret ${secret} --endpoint ${endpoint}`
|
||||
},
|
||||
{
|
||||
title: t("check"),
|
||||
command: `sudo pangolin service status client`
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -138,8 +172,17 @@ curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/ol
|
||||
<p className="font-semibold mb-3">{t("commands")}</p>
|
||||
<div className="mt-2 space-y-3">
|
||||
{commands.map((item, index) => {
|
||||
const isLink =
|
||||
typeof item !== "string" && "link" in item;
|
||||
const commandText =
|
||||
typeof item === "string" ? item : item.command;
|
||||
typeof item === "string"
|
||||
? item
|
||||
: isLink
|
||||
? undefined
|
||||
: item.command;
|
||||
const linkHref = isLink
|
||||
? (item as { link: string }).link
|
||||
: undefined;
|
||||
const title =
|
||||
typeof item === "string"
|
||||
? undefined
|
||||
@@ -152,10 +195,23 @@ curl -o olm.exe -L "https://github.com/fosrl/olm/releases/download/${version}/ol
|
||||
{title}
|
||||
</p>
|
||||
)}
|
||||
<CopyTextBox
|
||||
text={commandText}
|
||||
outline={true}
|
||||
/>
|
||||
{isLink ? (
|
||||
<Button
|
||||
asChild
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
>
|
||||
<a href={linkHref}>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
{t("downloadInstaller")}
|
||||
</a>
|
||||
</Button>
|
||||
) : (
|
||||
<CopyTextBox
|
||||
text={commandText!}
|
||||
outline={true}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user