Deploy isolated DeepSeek Harness on Unraid with reviewed template and LAN relay

This commit is contained in:
Mikei386 committed 2026-10-15 20:49:46 +02:00
1 parent 6e145e3d3d
commit f378f4b932
8 files changed
+247

No files matched your search

@@ -0,0 +1,4 @@
*
!Dockerfile
!entrypoint.sh
!launch.mjs
@@ -0,0 +1,6 @@
state/
workspace/
*.log
*.tar
*.tgz
.env
@@ -0,0 +1,12 @@
FROM node:24-bookworm-slim
ARG DSH_VERSION=0.2.0-rc.2
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git openssh-client python3 curl && rm -rf /var/lib/apt/lists/*
RUN npm install --prefix /opt/dsh --omit=dev --no-audit --no-fund @deepseek-ai/dsh@${DSH_VERSION} && npm cache clean --force
COPY entrypoint.sh /usr/local/bin/dsh-entrypoint
COPY launch.mjs /usr/local/lib/dsh-launch.mjs
RUN chmod 0755 /usr/local/bin/dsh-entrypoint && chmod 0644 /usr/local/lib/dsh-launch.mjs
ENV HOME=/home/node DSH_HOME=/home/node/.dsh NODE_ENV=production
USER 1000:1000
WORKDIR /workspace
EXPOSE 3080
ENTRYPOINT ["/usr/local/bin/dsh-entrypoint"]
@@ -0,0 +1,125 @@
# DeepSeek Harness on Unraid — 15 October 2026
Separate optional Unraid application; no Athena Deck, OpenCode, LibreChat or host
service changes. Current cached CA catalog (4960 entries) had no DeepSeek Harness
match. It uses PHP serialization in templates_new.json, despite its suffix.
A private v2 XML template follows the schema linked from the official Unraid docs.
## Sources
- https://github.com/deepseek-ai/deepseek-harness
- https://registry.npmjs.org/@deepseek-ai/dsh/latest
- https://docs.unraid.net/community-applications/
- https://forums.unraid.net/topic/38619-docker-template-xml-schema/
The official npm `latest` release resolved to **0.2.0-rc.2** during preparation.
This is developer-preview software. The image installs that exact package from
the official npm scope on the official Node 24 bookworm-slim base, rather than
compiling the source monorepo. Dockerfile and entrypoint are provided here.
Base-image content and transitive npm dependency resolutions can change on a
future rebuild; record the installed image ID and package lock for this run.
## Paths and setup
- Build files: `/mnt/user/appdata/deepseek-harness/build`
- Sessions/settings/plugins/credentials: `/mnt/user/appdata/deepseek-harness/state`
- Working files: `/mnt/user/appdata/deepseek-harness/workspace` → `/workspace`
- Template: `/boot/config/plugins/dockerMan/templates-user/my-DeepSeek-Harness.xml`
- Container/image: `DeepSeek-Harness` / `athena-deepseek-harness:0.2.0-rc.2`
- Browser URL: `http://192.168.1.2:3081/`
Copy these public files into the build folder. Build with:
```sh
DOCKER_BUILDKIT=0 nice -n 15 ionice -c 3 docker build \
--cpu-period=100000 --cpu-quota=100000 --cpu-shares=128 \
--memory=2g --memory-swap=2g \
-t athena-deepseek-harness:0.2.0-rc.2 \
/mnt/user/appdata/deepseek-harness/build
```
Then run the reviewed install.sh on Unraid. It refuses an existing container or
template, creates only its own two data directories and changes ownership only
on those directory roots. The runtime uses UID/GID 1000, standard bridge, one CPU,
2 GiB memory, no extra swap allowance, 256 PIDs, dropped capabilities and no new
privileges. It mounts no host Docker socket, host root or existing projects.
It publishes port 3081 only on 192.168.1.2 using the standard bridge network.
The LAN-specific publish rule is stored in ExtraParams, so a later GUI Apply
retains it; WebUI points to [IP]:3081. No existing process is stopped.
The first login uses the startup launch URL in the new container's own Docker log;
that URL is a credential and must not be copied into Git or public reports.
Authentication and Host/Origin checks remain enabled. HTTP LAN only; no reverse
proxy or public exposure is configured. Add `/workspace` in the UI, then configure
a model in Settings. No model/API credentials are supplied by this installation.
The launcher options must be checked against the pinned installed release before
claiming successful service startup.
## Persistence and recovery
Back up the state and workspace folders separately with restricted permissions,
plus the template and build recipe. The state may contain provider credentials;
never commit it or the startup token. These Unraid paths are **not** implicitly
covered by Athena Deck's own backup allowlist. On a replacement Unraid host,
rebuild the image, restore both folders and UID/GID ownership, and reinstall the
XML/run the equivalent Docker settings. No fresh-host restore has been tested.
This optional Unraid app does not add a dependency to Athena's future native
Debian installation. No model benchmark or application task is implied by a
successful HTTP/UI startup check.
## Deployment notes
The initial low-priority Unraid build waited heavily on storage during the
user's concurrent rsync and compilation. Only that own build was stopped and
its stopped intermediate container removed. The image was then built on Athena
with one CPU / 2 GiB and streamed using docker save/load; no Deck/model restart.
The published npm release differs from current master documentation: web help
contains no --public-url; a concrete non-loopback IP fails plugin validation,
and 0.0.0.0 is deliberately rejected by its startup logic. With the user's
explicit approval, launch.mjs runs upstream DSH on 127.0.0.1:3082 and adds a
byte-for-byte TCP relay on container port 3080. Host/Origin, HTTP cookies, token
authentication and WebSocket streams remain unchanged. It also rewrites only
the printed self-address to the configured LAN URL; it does not change model
provider settings. DSH_PUBLIC_URL is a wrapper setting for this release.
No upstream security checks are disabled or patched. The user explicitly
approved the LAN access and shell-execution scope after automatic review had
blocked the initially proposed relay.
An isolated Athena smoke container with no host mounts, no published ports and
no API credentials stayed running, announced readiness and showed no startup
errors or OOM. It uses the same UID/resource/security settings as Unraid.
The classic Docker builder does not support COPY --chmod; this recipe uses
COPY followed by explicit chmod, verified before deployment.
HTTP smoke acceptance: login URL returned 303 and set a session cookie; the
authenticated document returned 200 with title DeepSeek Harness. A request
using an untrusted Host returned 403. Tokens/cookies were used internally only
and never printed or stored in Git. Final image ID before transfer:
`sha256:7b774370e12bfac20f885726de54366106f7f440fa5688c3412cc07e8fc68776`,
size 1200024822 bytes. The model provider is still unconfigured.
On Unraid the imported image ID is
`sha256:6af3714388b6eaccff05d61ce4576548054091812ac034493ba97716a3038cd6`.
Because that differs from the source daemon's image ID, the imported public
launcher/entrypoint hashes and actual package version were independently
verified before startup: version 0.2.0-rc.2, UID 1000, launcher SHA256
037e95475b44c0f1232e55949da5ae7f15d2300415b47044908afc79a38e4499 and
entrypoint SHA256 5c94620a73fccd7861eff7024521e6a854e41cfa31f07f8539010b4032e81508.
The ID difference is recorded rather than asserting identical image IDs.
Startup confirms bridge LAN binding 192.168.1.2:3081, 2147483648-byte limit,
1000000000 NanoCPUs and UID/GID 1000:1000.
## Final Unraid acceptance
The running Unraid container announced readiness. Its own launch URL returned
HTTP 303 and set a session cookie; the following authenticated root request
returned HTTP 200 and title DeepSeek Harness. No startup/login credential was
printed during verification. The transient Athena smoke container was stopped
and removed. Existing Unraid/Athena services were not restarted.
Initial browser access: Unraid Docker tab → DeepSeek-Harness → Logs → open the
startup URL printed there. Thereafter use the WebUI button while the browser
cookie remains valid. The plain root link alone does not replace first login.
Select /workspace and add the intended model/provider in the UI; no inference
or shell-tool task was tested because no model credential/provider was set.
@@ -0,0 +1,4 @@
#!/bin/sh
set -eu
export DSH_BIND_IP=127.0.0.1
exec node /usr/local/lib/dsh-launch.mjs
@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
# Run only on the intended Unraid host, after reviewing the public build files.
base=/mnt/user/appdata/deepseek-harness
image=athena-deepseek-harness:0.2.0-rc.2
name=DeepSeek-Harness
template=/boot/config/plugins/dockerMan/templates-user/my-DeepSeek-Harness.xml
if docker container inspect "$name" >/dev/null 2>&1; then
echo 'Container already exists; no changes made.' >&2; exit 1
fi
test ! -e "$template"
docker image inspect "$image" >/dev/null
mkdir -p "$base/state" "$base/workspace"
chown 1000:1000 "$base/state" "$base/workspace"
chmod 700 "$base/state"
chmod 755 "$base/workspace"
cp "$base/build/my-DeepSeek-Harness.xml" "$template"
chmod 600 "$template"
docker run -d --name "$name" --network bridge --restart unless-stopped \
--cpus=1 --cpu-shares=128 --memory=2g --memory-swap=2g --pids-limit=256 \
--cap-drop=ALL --security-opt=no-new-privileges:true --init \
--log-opt max-size=10m --log-opt max-file=2 \
--label net.unraid.docker.managed=dockerman \
--label 'net.unraid.docker.webui=http://[IP]:3081/' \
-p 192.168.1.2:3081:3080 \
-e TZ=Europe/Berlin -e DSH_TRUSTED_HOST=192.168.1.2 \
-e DSH_PUBLIC_URL=http://192.168.1.2:3081/ \
-v "$base/state:/home/node/.dsh:rw" \
-v "$base/workspace:/workspace:rw" "$image"
@@ -0,0 +1,45 @@
// This pinned DSH release has no --public-url. Rewrite only its printed address;
// listener authentication and Host/Origin validation remain entirely upstream.
import { spawn } from 'node:child_process';
import net from 'node:net';
const ip = process.env.DSH_BIND_IP;
const publicUrl = new URL(process.env.DSH_PUBLIC_URL);
if (!ip || !['http:', 'https:'].includes(publicUrl.protocol) || publicUrl.pathname !== '/' || publicUrl.search || publicUrl.hash || publicUrl.username || publicUrl.password) {
throw new Error('A plain HTTP(S) root URL and a container bind address are required.');
}
// User-approved LAN relay. Bytes, Host/Origin headers and authentication remain
// unchanged; DSH itself retains its required loopback listener.
const relay = net.createServer(client => {
const upstream = net.connect(3082, '127.0.0.1');
client.pipe(upstream); upstream.pipe(client);
client.on('error', () => upstream.destroy());
upstream.on('error', () => client.destroy());
client.on('close', () => upstream.destroy());
upstream.on('close', () => client.destroy());
});
relay.listen(3080, '0.0.0.0');
const child = spawn('/opt/dsh/node_modules/.bin/dsh', [
'web', '--no-open', '--port', '3082', '--host', ip,
'--trusted-host', process.env.DSH_TRUSTED_HOST,
], { stdio: ['ignore', 'pipe', 'pipe'] });
function forward(stream, destination) {
let pending = '';
const emit = line => {
for (const host of [ip, '127.0.0.1', 'localhost']) line = line.replaceAll(`http://${host}:3082/`, publicUrl.href);
destination.write(line);
};
stream.setEncoding('utf8');
stream.on('data', text => {
pending += text;
let end;
while ((end = pending.indexOf('\n')) >= 0) {
emit(pending.slice(0, end + 1)); pending = pending.slice(end + 1);
}
});
stream.on('end', () => { if (pending) emit(pending); });
}
forward(child.stdout, process.stdout); forward(child.stderr, process.stderr);
for (const signal of ['SIGTERM', 'SIGINT']) process.on(signal, () => { relay.close(); child.kill(signal); });
relay.on('error', error => { console.error(error.message); child.kill('SIGTERM'); process.exitCode = 1; });
child.on('error', error => { console.error(error.message); relay.close(); process.exitCode = 1; });
child.on('exit', (code, signal) => { relay.close(); process.exitCode = code ?? (signal ? 1 : 0); });
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<Container version="2">
<Name>DeepSeek-Harness</Name>
<Repository>athena-deepseek-harness:0.2.0-rc.2</Repository>
<Registry />
<Network>bridge</Network>
<Privileged>false</Privileged>
<Project>https://github.com/deepseek-ai/deepseek-harness</Project>
<Support>https://github.com/deepseek-ai/deepseek-harness/issues</Support>
<Overview>DeepSeek Harness developer preview. Official npm runtime in a local image. Persistent application state and isolated workspace. First login: use the launch URL in this container log. No model credentials preconfigured.</Overview>
<Category>Productivity: Tools:</Category>
<WebUI>http://[IP]:3081/</WebUI>
<ExtraParams>--restart=unless-stopped --cpus=1 --cpu-shares=128 --memory=2g --memory-swap=2g --pids-limit=256 --cap-drop=ALL --security-opt=no-new-privileges:true --init --log-opt max-size=10m --log-opt max-file=2 --publish=192.168.1.2:3081:3080/tcp</ExtraParams>
<PostArgs />
<Icon />
<TemplateURL />
<Config Name="Application state" Target="/home/node/.dsh" Default="/mnt/user/appdata/deepseek-harness/state" Mode="rw" Description="Sessions, settings, credentials and plugins" Type="Path" Display="always" Required="true" Mask="false">/mnt/user/appdata/deepseek-harness/state</Config>
<Config Name="Workspace" Target="/workspace" Default="/mnt/user/appdata/deepseek-harness/workspace" Mode="rw" Description="Dedicated working files" Type="Path" Display="always" Required="true" Mask="false">/mnt/user/appdata/deepseek-harness/workspace</Config>
<Config Name="Public URL" Target="DSH_PUBLIC_URL" Default="http://192.168.1.2:3081/" Mode="" Description="Browser-facing URL" Type="Variable" Display="always" Required="true" Mask="false">http://192.168.1.2:3081/</Config>
<Config Name="Trusted host" Target="DSH_TRUSTED_HOST" Default="192.168.1.2" Mode="" Description="Exact browser-facing host" Type="Variable" Display="always" Required="true" Mask="false">192.168.1.2</Config>
<Config Name="Timezone" Target="TZ" Default="Europe/Berlin" Mode="" Description="Local timezone" Type="Variable" Display="always" Required="true" Mask="false">Europe/Berlin</Config>
</Container>