3.9 KiB
NP Replica
This project provides a local Chinese web replica of the core NUPACK analysis/input workflow.
Run
docker compose up --build -d
Open http://127.0.0.1:18765.
Reverse Proxy
The service listens on port 18765. The current local deployment is reverse proxied as npt.lihato.icu.
Traefik only performs TLS termination, compression, and reverse proxying for npt; authentication is enforced by this application.
Endpoints
GET /GET /healthGET /api/examplePOST /api/analyzePOST /api/jobsGET /api/jobs/<job_id>
Persistent Shares
Live jobs and sessions are stored in Redis when NP_REDIS_URL is enabled. Account history and share links are stored in ./runtime/account/np-replica.sqlite3; back up both runtime directories when moving the deployment.
Notes
-
tubemode supports strand concentrations andSetSpec(max_size=...). -
complexmode supports explicit complex definitions such asA+B. -
Pair matrices are returned as a preview block to keep responses manageable.
-
The Docker image compiles ViennaRNA
RNAplotfromrna/ViennaRNA-2.7.2.tar.gzand embeds SVG structure plots into MFE results. -
Multistrand MFE plots now use a split-strand layout by default when a structure contains
+, withRNAplotretained as the fallback path. -
The web UI supports Chinese and English switching, account-scoped cloud history, result export, share controls, and async polling for submitted jobs.
-
Docker now starts three services:
np-replica,np-worker, andredis. -
Async jobs use Redis-backed storage and queueing when
NP_REDIS_URLis configured; otherwise the app falls back to the older in-memory mode. -
The browser-facing API and page behavior stay the same after enabling Redis-backed jobs.
-
Worker concurrency is controlled by
NP_WORKER_CONCURRENCYand defaults to2. -
Per-job native thread usage is capped by
NP_PER_JOB_THREAD_LIMITand defaults to1to prevent a single analysis from monopolizing the machine. -
NP_STRUCTURE_PLOT_MODEsupportsauto(default),split, andrnaplot. -
Static pages are served with ETag-based browser caching; JSON API responses remain uncached.
-
The force-directed structure viewer lazy-loads D3 only when that view is opened, so the initial page load is not blocked by the external CDN.
-
/healthuses Redis queue length plus a running-job set instead of scanning every historical job on each poll. -
Application login uses the public Authentik issuer at
https://auth.lihato.icu/with Authorization Code + PKCE. -
The current
nptinstance uses issuer/application/o/nupack-account-npt/, clientnpt-replica-web, callbackhttps://npt.lihato.icu/auth/callback, and logout returnhttps://npt.lihato.icu/. -
For the independent
npdeployment on100.64.0.11, setNP_OIDC_ISSUER=https://auth.lihato.icu/application/o/nupack-account/,NP_OIDC_CLIENT_ID=np-replica-web,NP_OIDC_REDIRECT_URI=https://np.lihato.icu/auth/callback, andNP_OIDC_POST_LOGOUT_URI=https://np.lihato.icu/. -
Redis stores the live queue and login sessions. SQLite WAL at
/data/np-replica.sqlite3stores users, owned jobs, compressed inputs/results/errors, usage totals, and durable share links. -
History and job APIs enforce ownership by the Authentik OIDC subject. Public share links expose only the selected record and can be disabled or given an expiry by its owner.
现在
docker-compose.yml面向 64 核 / 64G WSL 服务器的并发策略是:- 最多同时跑 16 个任务
- 每个任务最多用 4 个计算线程
- 后续任务进入队列等待
- 每个任务的 NUPACK 缓存上限为 8 GB
- 理论上最多占用约 64 个 native 计算线程
如果后面你发现机器还会被压满,最直接的调法就是在 docker-compose.yml 里继续压:
- 把 NP_WORKER_CONCURRENCY 改小
- 或保持并发不变,把 NP_PER_JOB_THREAD_LIMIT 改成 2 或 1