Merge pull request #2766 from LaurenceJJones/feature/systemd-install-instructions

enhance: Systemd newt unit instructions
This commit is contained in:
Owen Schwartz
2026-04-02 11:40:50 -04:00
committed by GitHub
2 changed files with 53 additions and 2 deletions

View File

@@ -2607,6 +2607,9 @@
"machineClients": "Machine Clients", "machineClients": "Machine Clients",
"install": "Install", "install": "Install",
"run": "Run", "run": "Run",
"envFile": "Environment File",
"serviceFile": "Service File",
"enableAndStart": "Enable and Start",
"clientNameDescription": "The display name of the client that can be changed later.", "clientNameDescription": "The display name of the client that can be changed later.",
"clientAddress": "Client Address (Advanced)", "clientAddress": "Client Address (Advanced)",
"setupFailedToFetchSubnet": "Failed to fetch default subnet", "setupFailedToFetchSubnet": "Failed to fetch default subnet",

View File

@@ -55,7 +55,7 @@ export function NewtSiteInstallCommands({
const commandList: Record<Platform, Record<string, CommandItem[]>> = { const commandList: Record<Platform, Record<string, CommandItem[]>> = {
unix: { unix: {
All: [ Direct: [
{ {
title: t("install"), title: t("install"),
command: `curl -fsSL https://static.pangolin.net/get-newt.sh | bash` command: `curl -fsSL https://static.pangolin.net/get-newt.sh | bash`
@@ -64,6 +64,54 @@ export function NewtSiteInstallCommands({
title: t("run"), title: t("run"),
command: `newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}` command: `newt --id ${id} --secret ${secret} --endpoint ${endpoint}${acceptClientsFlag}`
} }
],
"Systemd Service": [
{
title: t("install"),
command: `curl -fsSL https://static.pangolin.net/get-newt.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}
PANGOLIN_ENDPOINT=${endpoint}${!acceptClients ? `
DISABLE_CLIENTS=true` : ""}
EOF
sudo chmod 600 /etc/newt/newt.env`
},
{
title: t("serviceFile"),
command: `sudo tee /etc/systemd/system/newt.service > /dev/null << 'EOF'
[Unit]
Description=Newt
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=root
Group=root
EnvironmentFile=/etc/newt/newt.env
ExecStart=/usr/local/bin/newt
Restart=always
RestartSec=2
UMask=0077
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF`
},
{
title: t("enableAndStart"),
command: `sudo systemctl daemon-reload
sudo systemctl enable --now newt`
}
] ]
}, },
windows: { windows: {
@@ -298,7 +346,7 @@ function getPlatformName(platformName: Platform) {
function getArchitectures(platform: Platform) { function getArchitectures(platform: Platform) {
switch (platform) { switch (platform) {
case "unix": case "unix":
return ["All"]; return ["Direct", "Systemd Service"];
case "windows": case "windows":
return ["x64"]; return ["x64"];
case "docker": case "docker":