@stacksjs/ts-cloud 0.7.123 → 0.7.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/bin/cli.js +233 -233
  2. package/dist/bin/dashboard-server.js +1 -1
  3. package/dist/{chunk-xes5vst2.js → chunk-050r7ycy.js} +3 -0
  4. package/dist/{chunk-8ynjhsh3.js → chunk-29rse4p1.js} +1 -1
  5. package/dist/{chunk-gtrecc8b.js → chunk-4q7jx76n.js} +18 -3
  6. package/dist/{chunk-b801ga2t.js → chunk-fgk8cqew.js} +1 -1
  7. package/dist/{chunk-w2zd56qm.js → chunk-k2yyatfw.js} +2 -2
  8. package/dist/{chunk-48czwsvj.js → chunk-vn6g8f60.js} +5 -5
  9. package/dist/deploy/index.js +5 -5
  10. package/dist/drivers/index.js +2 -2
  11. package/dist/drivers/shared/deploy-script.d.ts +18 -0
  12. package/dist/index.js +5 -5
  13. package/dist/protection/index.js +1 -1
  14. package/dist/spend/index.js +2 -2
  15. package/dist/ui/account/automation.html +3 -3
  16. package/dist/ui/account/security.html +2 -2
  17. package/dist/ui/applications/compose.html +4 -4
  18. package/dist/ui/applications/new.html +2 -2
  19. package/dist/ui/data/backups.html +4 -4
  20. package/dist/ui/data/services.html +4 -4
  21. package/dist/ui/data/volumes.html +4 -4
  22. package/dist/ui/index.html +3 -3
  23. package/dist/ui/infrastructure/topology.html +4 -4
  24. package/dist/ui/integrations.html +2 -2
  25. package/dist/ui/operations/alerts.html +4 -4
  26. package/dist/ui/operations/configuration.html +4 -4
  27. package/dist/ui/operations/jobs.html +3 -3
  28. package/dist/ui/operations/maintenance.html +3 -3
  29. package/dist/ui/operations/observability.html +3 -3
  30. package/dist/ui/operations/previews.html +3 -3
  31. package/dist/ui/operations/queue.html +3 -3
  32. package/dist/ui/operations/regions.html +4 -4
  33. package/dist/ui/operations/releases.html +4 -4
  34. package/dist/ui/operations/spend.html +3 -3
  35. package/dist/ui/operations/workloads.html +3 -3
  36. package/dist/ui/security.html +2 -2
  37. package/dist/ui/server/actions.html +4 -4
  38. package/dist/ui/server/activity.html +2 -2
  39. package/dist/ui/server/capacity.html +4 -4
  40. package/dist/ui/server/database.html +4 -4
  41. package/dist/ui/server/deployments.html +4 -4
  42. package/dist/ui/server/diagnostics.html +2 -2
  43. package/dist/ui/server/firewall.html +3 -3
  44. package/dist/ui/server/fleet.html +4 -4
  45. package/dist/ui/server/logs.html +3 -3
  46. package/dist/ui/server/metrics.html +4 -4
  47. package/dist/ui/server/security.html +2 -2
  48. package/dist/ui/server/services.html +2 -2
  49. package/dist/ui/server/sites.html +4 -4
  50. package/dist/ui/server/ssh-keys.html +3 -3
  51. package/dist/ui/server/team.html +4 -4
  52. package/dist/ui/server/terminal.html +2 -2
  53. package/dist/ui/serverless/alarms.html +4 -4
  54. package/dist/ui/serverless/assets.html +2 -2
  55. package/dist/ui/serverless/cost.html +2 -2
  56. package/dist/ui/serverless/data.html +4 -4
  57. package/dist/ui/serverless/deployments.html +2 -2
  58. package/dist/ui/serverless/firewall.html +2 -2
  59. package/dist/ui/serverless/functions.html +4 -4
  60. package/dist/ui/serverless/logs.html +4 -4
  61. package/dist/ui/serverless/metrics.html +2 -2
  62. package/dist/ui/serverless/queues.html +4 -4
  63. package/dist/ui/serverless/secrets.html +4 -4
  64. package/dist/ui/serverless/traces.html +4 -4
  65. package/dist/ui/serverless.html +4 -4
  66. package/package.json +3 -3
@@ -6170,7 +6170,7 @@ writeFileSync(candidatePath, JSON.stringify(candidate, null, 2) + '\\n', { mode:
6170
6170
  `.trim();return[`__tsc_fragment_candidate="$(mktemp "${E}.candidate.XXXXXX")"`,`cat > "$__tsc_fragment_candidate" <<'${T}'`,_,T,'chmod 0600 "$__tsc_fragment_candidate"',`if [ -f ${E} ]; then TS_CLOUD_RPX_CURRENT_FRAGMENT=${E} TS_CLOUD_RPX_CANDIDATE_FRAGMENT="$__tsc_fragment_candidate" ${t.bunBin} -e ${B9(N)}; fi`,`mv -f "$__tsc_fragment_candidate" ${E}`,`chmod 0600 ${E}`]}function lW(E){return`rpx-cert-renew-${(E||"app").replace(/[^a-z0-9._-]+/gi,"-")}.service`}function iW(E){let _=new Set;for(let T of E.proxies){let t=T.to;if(!t||t.startsWith("*")||t.includes(":")||!t.includes("."))continue;_.add(t)}return[..._]}function W9(E){let{config:_,proxy:T}=E,t=_.acmeChallengeWebroot,N=iW(_);if(!T.onDemandTls||!t||N.length===0)return[];let d=E.bunBin??"/usr/local/bin/bun",R=T.version??"latest",L=_.productionCerts.certsDir,A=T.onDemandTlsEmail??`webmaster@${N[0]}`,S=`${d} ${RT}/node_modules/@stacksjs/tlsx/dist/bin/cli.js`,h=N.join(","),O=N.join(" "),r=(E.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),U=`${XS}/renew-certs-${r}.sh`,I=lW(r),X=`rpx-cert-renew-${r}.timer`,B=["#!/bin/sh","# Generated by ts-cloud — issue/renew rpx gateway TLS certs via tlsx http-01.","# The running gateway serves the challenge from $WEBROOT on :80, so this needs","# no downtime and no DNS credentials. Reloads the gateway only if a cert changed.","set -u",`CERTS='${L}'`,`WEBROOT='${t}'`,`EMAIL='${A}'`,`TLSX="${S}"`,`DOMAINS='${h}'`,"DNS_ATTEMPTS='24'","DNS_DELAY_SECONDS='5'","wait_for_dns() {",' d="$1"'," attempt=1",' while ! getent ahosts "$d" >/dev/null 2>&1; do',' if [ "$attempt" -ge "$DNS_ATTEMPTS" ]; then',' echo "DNS for $d did not become resolvable after $DNS_ATTEMPTS attempts" >&2'," return 1"," fi",' echo "Waiting for public DNS before ACME: $d (attempt $attempt/$DNS_ATTEMPTS)"',' sleep "$DNS_DELAY_SECONDS"'," attempt=$((attempt + 1))"," done","}",'before=$(cat "$CERTS"/*.crt 2>/dev/null | sha256sum)',`for d in ${O}; do`,' if [ ! -s "$CERTS/$d.crt" ]; then',' if wait_for_dns "$d"; then',' $TLSX acme:issue -d "$d" --method http-01 --webroot "$WEBROOT" --dir "$CERTS" --prod --email "$EMAIL" || echo "issue $d failed (non-fatal)"'," else",' echo "issue $d skipped until DNS resolves (non-fatal)"'," fi"," # rpx reloads its SNI set when a PEM appears. Complete that reload"," # before the next hostname starts http-01, or :80 can disappear in"," # the middle of the following challenge on a multi-domain deploy.",` [ -s "$CERTS/$d.crt" ] && systemctl restart ${cN}`," fi","done",'$TLSX acme:renew --domains "$DOMAINS" --method http-01 --webroot "$WEBROOT" --dir "$CERTS" --days 30 --prod --email "$EMAIL" || echo "renew: some domains failed (non-fatal)"','rm -f "$CERTS"/*.chain.crt','after=$(cat "$CERTS"/*.crt 2>/dev/null | sha256sum)',`[ "$before" = "$after" ] || systemctl restart ${cN}`].join(`
6171
6171
  `),z=["[Unit]",`Description=Issue/renew rpx gateway TLS certs for ${r} (tlsx http-01)`,`After=network-online.target ${cN}`,"Wants=network-online.target","","[Service]","Type=oneshot",`ExecStart=${U}`].join(`
6172
6172
  `),P=["[Unit]",`Description=Daily rpx gateway TLS cert issuance/renewal for ${r}`,"","[Timer]","OnCalendar=*-*-* 03:30:00","RandomizedDelaySec=1h","Persistent=true","","[Install]","WantedBy=timers.target"].join(`
6173
- `);return[`mkdir -p ${t}`,`(cd ${RT} && ${d} add @stacksjs/tlsx@${R}) || true`,...yR(U,B,"TS_CLOUD_RENEW_EOF"),`chmod +x ${U}`,...yR(`/etc/systemd/system/${I}`,z,"TS_CLOUD_RENEW_SVC_EOF"),...yR(`/etc/systemd/system/${X}`,P,"TS_CLOUD_RENEW_TIMER_EOF"),"systemctl daemon-reload",`systemctl enable --now ${X} || true`,`${U} || true`]}function Ud(E){let{config:_,proxy:T}=E,t=E.bunBin??"/usr/local/bin/bun",N=T.version??"latest",d=_.productionCerts.certsDir,R=(E.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),L=JSON.stringify({slug:R,..._},null,2),A=F9(Cd,d),h=[`Environment=RPX_UPSTREAM_TIMEOUT=${T.upstreamTimeout??60}`];if(typeof T.maxUpstreamConns==="number")h.push(`Environment=RPX_MAX_UPSTREAM_CONNS=${T.maxUpstreamConns}`);let O=T.memoryHigh??"512M",r=T.memoryMax??"768M";return["set -euo pipefail",`mkdir -p ${XS} ${Cd} ${d} ${RT}`,`rm -rf ${RT}.next ${RT}.prev`,`mkdir -p ${RT}.next`,`(cd ${RT}.next && ${t} add @stacksjs/rpx@${N})`,`mv ${RT} ${RT}.prev`,`mv ${RT}.next ${RT}`,`rm -rf ${RT}.prev`,`ln -sfn ${RT}/node_modules ${XS}/node_modules`,...nW(`${Cd}/${R}.json`,L,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:t,preserveManagementDashboardRoutes:E.preserveManagementDashboardRoutes}),...yR(zI,A,"TS_CLOUD_RPX_EOF"),`${t} build --production --compile --outfile ${cS}.next ${zI}`,`chmod 0755 ${cS}.next`,`mv -f ${cS}.next ${cS}`,...yR(`/etc/systemd/system/${cN}`,["[Unit]","Description=rpx reverse-proxy gateway (managed by ts-cloud)","After=network.target network-online.target","Wants=network-online.target","","[Service]","Type=simple",`ExecStart=${cS}`,`WorkingDirectory=${RT}`,"Environment=BUN_INSTALL=/root/.bun","Environment=APP_ENV=production","Environment=NODE_ENV=production",...h,"MemoryAccounting=true",`MemoryHigh=${O}`,`MemoryMax=${r}`,"OOMPolicy=stop","Restart=always","RestartSec=5","StartLimitIntervalSec=120","StartLimitBurst=5",`ExecStartPre=/bin/sh -c 'for p in 80 443; do fuser -k -n tcp "$p" 2>/dev/null || true; done; sleep 1'`,"LimitNOFILE=1048576","AmbientCapabilities=CAP_NET_BIND_SERVICE","","[Install]","WantedBy=multi-user.target"].join(`
6173
+ `);return[`mkdir -p ${t}`,`(cd ${RT} && ${d} add @stacksjs/tlsx@${R}) || true`,...yR(U,B,"TS_CLOUD_RENEW_EOF"),`chmod +x ${U}`,...yR(`/etc/systemd/system/${I}`,z,"TS_CLOUD_RENEW_SVC_EOF"),...yR(`/etc/systemd/system/${X}`,P,"TS_CLOUD_RENEW_TIMER_EOF"),"systemctl daemon-reload",`systemctl enable --now ${X} || true`,`${U} || true`]}function Ud(E){let{config:_,proxy:T}=E,t=E.bunBin??"/usr/local/bin/bun",N=T.version??"latest",d=_.productionCerts.certsDir,R=(E.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),L=JSON.stringify({slug:R,..._},null,2),A=F9(Cd,d),h=[`Environment=RPX_UPSTREAM_TIMEOUT=${T.upstreamTimeout??60}`];if(typeof T.maxUpstreamConns==="number")h.push(`Environment=RPX_MAX_UPSTREAM_CONNS=${T.maxUpstreamConns}`);let O=T.memoryHigh??"512M",r=T.memoryMax??"768M";return["set -euo pipefail",`mkdir -p ${XS} ${Cd} ${d} ${RT}`,`rm -rf ${RT}.next ${RT}.prev`,`mkdir -p ${RT}.next`,`(cd ${RT}.next && ${t} add @stacksjs/rpx@${N})`,`mv ${RT} ${RT}.prev`,`mv ${RT}.next ${RT}`,`rm -rf ${RT}.prev`,`ln -sfn ${RT}/node_modules ${XS}/node_modules`,...nW(`${Cd}/${R}.json`,L,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:t,preserveManagementDashboardRoutes:E.preserveManagementDashboardRoutes}),...yR(zI,A,"TS_CLOUD_RPX_EOF"),`${t} build --production --compile --outfile ${cS}.next ${zI}`,`chmod 0755 ${cS}.next`,`mv -f ${cS}.next ${cS}`,...yR(`/etc/systemd/system/${cN}`,["[Unit]","Description=rpx reverse-proxy gateway (managed by ts-cloud)","After=network.target network-online.target","Wants=network-online.target","","[Service]","Type=simple",`ExecStart=${cS}`,`WorkingDirectory=${RT}`,"Environment=BUN_INSTALL=/root/.bun","Environment=APP_ENV=production","Environment=NODE_ENV=production",...h,"MemoryAccounting=true",`MemoryHigh=${O}`,`MemoryMax=${r}`,"CPUWeight=500","IOWeight=500","OOMPolicy=stop","Restart=always","RestartSec=5","StartLimitIntervalSec=120","StartLimitBurst=5",`ExecStartPre=/bin/sh -c 'for p in 80 443; do fuser -k -n tcp "$p" 2>/dev/null || true; done; sleep 1'`,"LimitNOFILE=1048576","AmbientCapabilities=CAP_NET_BIND_SERVICE","","[Install]","WantedBy=multi-user.target"].join(`
6174
6174
  `),"TS_CLOUD_RPX_UNIT_EOF"),"systemctl daemon-reload","systemctl disable --now bun-gateway.service 2>/dev/null || true","systemctl disable --now bun-gateway-renew.timer bun-gateway-renew.service 2>/dev/null || true","rm -f /etc/systemd/system/bun-gateway-renew.timer /etc/systemd/system/bun-gateway-renew.service","systemctl disable --now ts-cloud-nginx.service 2>/dev/null || true",`for timer in /etc/systemd/system/rpx-cert-renew-*.timer; do [ -e "$timer" ] || continue; unit="$(basename "$timer")"; tenant="\${unit#rpx-cert-renew-}"; tenant="\${tenant%.timer}"; [ -f "${Cd}/$tenant.json" ] && continue; systemctl disable --now "$unit" 2>/dev/null || true; rm -f "$timer" "/etc/systemd/system/rpx-cert-renew-$tenant.service" "${XS}/renew-certs-$tenant.sh"; done`,`systemctl enable ${cN}`,`systemctl restart ${cN}`,...W9(E)]}function kO(E){let _=(E.slug||"app").replace(/[^a-z0-9._-]+/gi,"-"),T=JSON.stringify({slug:_,...E.config},null,2);return["set -euo pipefail",`mkdir -p ${Cd}`,...nW(`${Cd}/${_}.json`,T,"TS_CLOUD_RPX_FRAGMENT_EOF",{bunBin:"/usr/local/bin/bun",preserveManagementDashboardRoutes:E.preserveManagementDashboardRoutes}),`systemctl restart ${cN}`]}function xR(E=[],_={}){let T=_.path??"/root/.ssh/authorized_keys",N=[`mkdir -p ${T.replace(/\/[^/]*$/,"")}`,`touch ${T}`,`sed -i '/^${aW("# >>> ts-cloud managed keys >>>")}$/,/^${aW("# <<< ts-cloud managed keys <<<")}$/d' ${T}`];if(E.length>0){let d=["# >>> ts-cloud managed keys >>>",...E.map((R)=>`${R.publicKey.trim()} ${R.name}`),"# <<< ts-cloud managed keys <<<"].join(`
6175
6175
  `);N.push(`cat >> ${T} <<'TS_CLOUD_KEYS_EOF'`,d,"TS_CLOUD_KEYS_EOF",`chmod 600 ${T}`)}return N}function aW(E){return E.replace(/[.*[\]\\/^$]/g,"\\$&")}uL();jI();function oW(E,_){let T=`/tmp/ts-cloud-${E}.sh`,t=`TS_CLOUD_${E.toUpperCase().replace(/[^A-Z0-9]/g,"_")}_EOF`;return[`cat > ${T} <<'${t}'`,_.replace(/\n$/,""),t,`chmod +x ${T}`,`bash ${T} || echo "ts-cloud: ${E} setup did not complete; continuing" >&2`,`rm -f ${T}`]}function pW(E,_){if(E===!1)return;if(E===!0||E===void 0)return _;return E}var sW={enabled:!0,ports:[80,443]},H9={mode:"detection",paranoiaLevel:1};function e9(E=!0,_=[]){let T=pW(E,sW);if(!T||T.enabled===!1)return[];let t=[...new Set([...T.ports??sW.ports??[],..._])].sort((N,d)=>N-d);return oW("ddos",ir({...T,ports:t}))}function j9(E=!0){let _=pW(E,H9);if(!_||_.mode==="off")return[];return oW("waf",eI(_))}function Ez(E={},_=[]){return[...e9(E.ddos,_),...j9(E.waf)]}function P9(E){return`${E}-sftp`}function _z(E){return E.port??2222}function f9(E){let _=E.sftp.storage;if(_?.type==="efs"&&_.path)return _.path;return`/var/sftp/${E.slug}`}function qR(E){return`'${E.split("'").join("'\\''")}'`}function Tz(E,_){if(_==="aws")return;let T=E.storage;if(T?.type==="s3"||!T&&!!E.bucket)throw Error(`sftp: bucket-backed storage is only available on the aws provider (Transfer Family). On ${_}, use storage: { type: 'efs' } to serve a directory on the server.`);for(let[N,d]of Object.entries(E.users))if(!d.sshPublicKeys?.length)throw Error(`sftp: user ${N} needs at least one SSH public key`)}function tz(E){let{slug:_,sftp:T}=E,t=P9(_),N=f9(E),d=_z(T),R="/etc/ts-sftp/host_key",L="/etc/ts-sftp/users",A=T.serviceUser??"ts-sftp",S=[`# --- ts-sftp (${t}) ---`,`id -u ${A} >/dev/null 2>&1 || useradd --system --home-dir ${qR(N)} --shell /usr/sbin/nologin ${A}`,'export HOME="${HOME:-/root}"','command -v bun >/dev/null 2>&1 || (curl -fsSL https://bun.sh/install | bash && ln -sf "$HOME/.bun/bin/bun" /usr/local/bin/bun)',`mkdir -p ${qR(N)} /etc/ts-sftp /etc/ts-sftp/users /opt/ts-sftp`,"chmod 750 /etc/ts-sftp",`cd /opt/ts-sftp && [ -f package.json ] || printf '{"name":"ts-sftp-host","private":true}' > package.json`,`cd /opt/ts-sftp && bun add ts-sftp@${T.version??"latest"} --no-save --production || bun add ts-sftp@${T.version??"latest"}`,`[ -f /etc/ts-sftp/host_key ] || bun /opt/ts-sftp/node_modules/ts-sftp/dist/bin/cli.js keygen --out /etc/ts-sftp/host_key --comment ${qR(`${_}-sftp`)}`,"chmod 600 /etc/ts-sftp/host_key",'BUN_REAL=$(readlink -f "$(command -v bun)")','case "$BUN_REAL" in /root/*) install -m 0755 "$BUN_REAL" /usr/local/bin/ts-sftp-bun; BUN_BIN=/usr/local/bin/ts-sftp-bun;; *) BUN_BIN="$BUN_REAL";; esac'],h=[];for(let[O,r]of Object.entries(T.users)){let U=(r.homeDirectory??O).replace(/^\/+|\/+$/g,"");if(!U||U.split("/").includes(".."))throw Error(`sftp: invalid homeDirectory for user ${O}`);let I=`/etc/ts-sftp/users/${O}.pub`;S.push(`mkdir -p ${qR(`${N}/${U}`)}`,`printf '%s\\n' ${qR(r.sshPublicKeys.join(`
6176
6176
  `))} > ${I}`,`chmod 644 ${I}`),h.push(`--user ${O}:${I}`)}return S.push(`chown -R ${A}:${A} ${qR(N)} /etc/ts-sftp`,`cat > /etc/systemd/system/${t}.service <<TSCLOUD_SFTP_UNIT`,"[Unit]","Description=ts-sftp file transfer server","After=network.target","","[Service]",`User=${A}`,`ExecStart=$BUN_BIN /opt/ts-sftp/node_modules/ts-sftp/dist/bin/cli.js serve --root ${N} --host-key /etc/ts-sftp/host_key --port ${d}${T.readOnly?" --read-only":""} ${h.join(" ")}`,"Restart=always","RestartSec=2","NoNewPrivileges=true","PrivateTmp=true","ProtectSystem=strict",`ReadWritePaths=${N}`,"","[Install]","WantedBy=multi-user.target","TSCLOUD_SFTP_UNIT","systemctl daemon-reload",`systemctl enable ${t}.service`,`systemctl restart ${t}.service`),S}function Nz(E){return E?[_z(E)]:[]}var Y9=[80,443];function PI(E={}){if(E.enabled===!1)return[];let _=[...new Set([...Y9,...E.allowedPorts||[]])].filter((t)=>Number.isInteger(t)&&t>=1&&t<=65535).sort((t,N)=>t-N),T=["export DEBIAN_FRONTEND=noninteractive","command -v ufw >/dev/null 2>&1 || apt-get install -y ufw","ufw --force reset","ufw default deny incoming","ufw default allow outgoing","ufw allow OpenSSH"];for(let t of _)T.push(`ufw allow ${t}/tcp`);return T.push("ufw --force enable"),T}function FS(E){let _=E.infrastructure?.compute??{},T=_.runtime==="php"||!!_.php,t=T||!!_.managedServices,N=t?YR():[],d=!rd(_),R=T?[...N,...yO({versions:_.php?.versions,default:_.php?.default,extensions:_.php?.extensions,installNginx:d,optimizeForProduction:_.php?.optimizeForProduction,ini:_.php?.ini}),...d?vW():[]]:void 0,L=[],A=__(E);if(!T&&t)L.push(...N);if(L.push(...gR(E.notifications)),_.managedServices)L.push(...ZO(_.managedServices),...$S(A,_.managedServices));let S=E.infrastructure?.sftp;if(S)Tz(S,It(E)),L.push(...tz({slug:E.project.slug,sftp:S}));if(L.push(...PI(_.firewall??(T?{enabled:!0}:{enabled:!1}))),L.push(...Ez({ddos:_.ddos,waf:_.waf},_.firewall?.allowedPorts??[])),L.push(...hd(_.autoUpdates??T)),L.push(...Od(_.monitoring??T)),L.push(...xR(_.sshKeys)),_.backups?.enabled)L.push(...gO({database:A,backups:_.backups}));return{runtime:_.runtime||"bun",runtimeVersion:_.runtimeVersion||"latest",phpBox:T,phpProvision:R,servicesProvision:L.length>0?L:void 0}}function qT(E={}){let{runtime:_="bun",runtimeVersion:T="latest",systemPackages:t=[],database:N,phpProvision:d,servicesProvision:R,caddyfile:L,rpxProvision:A,baked:S=!1,swapGb:h=2}=E,O=new Set(t);if(N==="sqlite")O.add("sqlite3");else if(N==="mysql")O.add("mysql-client");else if(N==="postgres")O.add("postgresql-client");let r=`#!/bin/bash
@@ -22050,6 +22050,9 @@ function resolveManagementDashboardSites(config, environment, opts) {
22050
22050
  preStart: ["bun install --production --no-save"],
22051
22051
  start: `bun ${DASHBOARD_ENTRY} --box --host 127.0.0.1 --port ${port}`,
22052
22052
  port,
22053
+ cpuWeight: 10,
22054
+ ioWeight: 10,
22055
+ tasksMax: 128,
22053
22056
  env: {
22054
22057
  APP_ENV: "production",
22055
22058
  NODE_ENV: "production",
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveStatePath,
6
6
  statePath
7
- } from "./chunk-xes5vst2.js";
7
+ } from "./chunk-050r7ycy.js";
8
8
 
9
9
  // src/spend/model.ts
10
10
  var METER_KEYS = [
@@ -25,7 +25,7 @@ import {
25
25
  resolveProjectStackName,
26
26
  resolveStatePath,
27
27
  statePath
28
- } from "./chunk-xes5vst2.js";
28
+ } from "./chunk-050r7ycy.js";
29
29
  import {
30
30
  __require
31
31
  } from "./chunk-v0bahtg2.js";
@@ -1961,6 +1961,8 @@ function buildRpxProvisionScript(options) {
1961
1961
  "MemoryAccounting=true",
1962
1962
  `MemoryHigh=${memoryHigh}`,
1963
1963
  `MemoryMax=${memoryMax}`,
1964
+ "CPUWeight=500",
1965
+ "IOWeight=500",
1964
1966
  "OOMPolicy=stop",
1965
1967
  "Restart=always",
1966
1968
  "RestartSec=5",
@@ -5654,8 +5656,16 @@ function buildSiteDeployScript(options) {
5654
5656
  healthCheckPath,
5655
5657
  healthGateSeconds = 5,
5656
5658
  memoryHigh = "2G",
5657
- memoryMax
5659
+ memoryMax,
5660
+ cpuWeight,
5661
+ ioWeight,
5662
+ tasksMax
5658
5663
  } = options;
5664
+ const qosDirectives = [
5665
+ ...cpuWeight != null ? [`CPUWeight=${cpuWeight}`] : [],
5666
+ ...ioWeight != null ? [`IOWeight=${ioWeight}`] : [],
5667
+ ...tasksMax != null ? [`TasksMax=${tasksMax}`] : []
5668
+ ];
5659
5669
  const zeroDowntime = options.zeroDowntime ?? port != null;
5660
5670
  const base = options.appDir ?? `/var/www/${siteName}`;
5661
5671
  const paths = releasePaths(base, releaseId);
@@ -5704,6 +5714,7 @@ function buildSiteDeployScript(options) {
5704
5714
  "MemoryAccounting=true",
5705
5715
  ...memoryHigh ? [`MemoryHigh=${memoryHigh}`] : [],
5706
5716
  ...memoryMax ? [`MemoryMax=${memoryMax}`] : [],
5717
+ ...qosDirectives,
5707
5718
  `EnvironmentFile=${paths.releases}/%i/.env`,
5708
5719
  `Environment=PORT=${port}`,
5709
5720
  "",
@@ -5744,6 +5755,7 @@ function buildSiteDeployScript(options) {
5744
5755
  "MemoryAccounting=true",
5745
5756
  ...memoryHigh ? [`MemoryHigh=${memoryHigh}`] : [],
5746
5757
  ...memoryMax ? [`MemoryMax=${memoryMax}`] : [],
5758
+ ...qosDirectives,
5747
5759
  `EnvironmentFile=${paths.current}/.env`,
5748
5760
  ...port ? [`Environment=PORT=${port}`] : [],
5749
5761
  "",
@@ -6694,7 +6706,10 @@ async function deploySiteRelease(driver, options, logger = noopLogger2) {
6694
6706
  zeroDowntime: site.zeroDowntime !== false,
6695
6707
  healthCheckPath: site.healthCheck?.path,
6696
6708
  memoryHigh: site.memoryHigh,
6697
- memoryMax: site.memoryMax
6709
+ memoryMax: site.memoryMax,
6710
+ cpuWeight: site.cpuWeight,
6711
+ ioWeight: site.ioWeight,
6712
+ tasksMax: site.tasksMax
6698
6713
  });
6699
6714
  const wantsNginxStatic = kind === "server-static" && !usesRpxProxy(compute) && !!site.domain;
6700
6715
  const staticVhost = wantsNginxStatic ? buildNginxVhostScript({
@@ -8,7 +8,7 @@ import {
8
8
  phpRuntimeLayerAssets,
9
9
  runPhpBuildHooks,
10
10
  sha256
11
- } from "./chunk-xes5vst2.js";
11
+ } from "./chunk-050r7ycy.js";
12
12
 
13
13
  // src/deploy/serverless-image.ts
14
14
  import { execFileSync } from "node:child_process";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  buildAndPushServerlessImage
3
- } from "./chunk-b801ga2t.js";
3
+ } from "./chunk-fgk8cqew.js";
4
4
  import"./chunk-50jpda9q.js";
5
5
  import"./chunk-zqtpg06c.js";
6
- import"./chunk-xes5vst2.js";
6
+ import"./chunk-050r7ycy.js";
7
7
  import"./chunk-v0bahtg2.js";
8
8
  export {
9
9
  buildAndPushServerlessImage
@@ -9,7 +9,7 @@ import {
9
9
  step,
10
10
  success,
11
11
  warn
12
- } from "./chunk-b801ga2t.js";
12
+ } from "./chunk-fgk8cqew.js";
13
13
  import {
14
14
  AwsBackupClient,
15
15
  CloudWatchLogsClient,
@@ -50,7 +50,7 @@ import {
50
50
  resolveSiteKind,
51
51
  resolveUiSource,
52
52
  siteInstallBase
53
- } from "./chunk-gtrecc8b.js";
53
+ } from "./chunk-4q7jx76n.js";
54
54
  import {
55
55
  SSMClient
56
56
  } from "./chunk-7m60qnc8.js";
@@ -104,7 +104,7 @@ import {
104
104
  spendOpenApiPaths,
105
105
  telemetryCursor,
106
106
  telemetryEstimatedMonthlyCost
107
- } from "./chunk-8ynjhsh3.js";
107
+ } from "./chunk-29rse4p1.js";
108
108
  import {
109
109
  artifactKey,
110
110
  buildCloudFormationTemplate,
@@ -126,7 +126,7 @@ import {
126
126
  resolveStatePath,
127
127
  setStateDir,
128
128
  statePath
129
- } from "./chunk-xes5vst2.js";
129
+ } from "./chunk-050r7ycy.js";
130
130
  import {
131
131
  __require
132
132
  } from "./chunk-v0bahtg2.js";
@@ -1729,7 +1729,7 @@ async function deployServerlessApp(config, environment, opts = {}) {
1729
1729
  }
1730
1730
  if (imageMode) {
1731
1731
  step("Building + pushing container image");
1732
- const { buildAndPushServerlessImage } = await import("./chunk-w2zd56qm.js");
1732
+ const { buildAndPushServerlessImage } = await import("./chunk-k2yyatfw.js");
1733
1733
  const built = await buildAndPushServerlessImage({
1734
1734
  app,
1735
1735
  projectRoot,
@@ -36,7 +36,7 @@ import {
36
36
  synchronizeDashboardUsers,
37
37
  trackDashboardOperation,
38
38
  verifyStaticApiOrigin
39
- } from "../chunk-48czwsvj.js";
39
+ } from "../chunk-vn6g8f60.js";
40
40
  import {
41
41
  deleteStaticSite,
42
42
  deployStaticSite,
@@ -50,7 +50,7 @@ import {
50
50
  } from "../chunk-v0vpamnf.js";
51
51
  import {
52
52
  buildAndPushServerlessImage
53
- } from "../chunk-b801ga2t.js";
53
+ } from "../chunk-fgk8cqew.js";
54
54
  import"../chunk-6a1t7fnq.js";
55
55
  import"../chunk-nsgqsmrh.js";
56
56
  import"../chunk-01d86gt1.js";
@@ -83,15 +83,15 @@ import {
83
83
  siteInstallBase,
84
84
  validateDeploymentConfig,
85
85
  verifyAddressRecord
86
- } from "../chunk-gtrecc8b.js";
86
+ } from "../chunk-4q7jx76n.js";
87
87
  import"../chunk-7m60qnc8.js";
88
88
  import"../chunk-4cjrg98a.js";
89
89
  import"../chunk-rds0sy87.js";
90
90
  import"../chunk-zqtpg06c.js";
91
- import"../chunk-8ynjhsh3.js";
91
+ import"../chunk-29rse4p1.js";
92
92
  import"../chunk-va2yd85b.js";
93
93
  import"../chunk-aa2dkn7b.js";
94
- import"../chunk-xes5vst2.js";
94
+ import"../chunk-050r7ycy.js";
95
95
  import"../chunk-v0bahtg2.js";
96
96
  export {
97
97
  verifyStaticApiOrigin,
@@ -68,14 +68,14 @@ import {
68
68
  waitForSsh,
69
69
  wrapCloudInitUserData,
70
70
  writeResizeCheckpoint
71
- } from "../chunk-gtrecc8b.js";
71
+ } from "../chunk-4q7jx76n.js";
72
72
  import"../chunk-7m60qnc8.js";
73
73
  import"../chunk-4cjrg98a.js";
74
74
  import"../chunk-rds0sy87.js";
75
75
  import"../chunk-zqtpg06c.js";
76
76
  import"../chunk-va2yd85b.js";
77
77
  import"../chunk-aa2dkn7b.js";
78
- import"../chunk-xes5vst2.js";
78
+ import"../chunk-050r7ycy.js";
79
79
  import"../chunk-v0bahtg2.js";
80
80
  export {
81
81
  writeResizeCheckpoint,
@@ -81,6 +81,24 @@ export interface BuildSiteDeployScriptOptions {
81
81
  memoryHigh?: string;
82
82
  /** systemd `MemoryMax` for the app unit. Unset by default. */
83
83
  memoryMax?: string;
84
+ /**
85
+ * systemd `CPUWeight` for the unit — relative CPU share under contention.
86
+ *
87
+ * Everything on a shared box competes for the same eight cores, and not
88
+ * everything on it matters equally: the gateway every tenant is served
89
+ * through should outrank a batch scanner, and a monitoring dashboard should
90
+ * outrank neither. Left unset the kernel gives every unit the same weight,
91
+ * so a background job saturating the CPU degrades the serving path just as
92
+ * much as it degrades itself.
93
+ *
94
+ * Unset by default: a box with one workload has nothing to prioritise, and
95
+ * inventing a hierarchy where none was asked for is its own surprise.
96
+ */
97
+ cpuWeight?: number;
98
+ /** systemd `IOWeight` — the same idea for disk bandwidth. Unset by default. */
99
+ ioWeight?: number;
100
+ /** systemd `TasksMax` — cap on threads/processes. Unset by default. */
101
+ tasksMax?: number;
84
102
  }
85
103
  /**
86
104
  * Build the remote shell commands that install/refresh a server-app site on a
package/dist/index.js CHANGED
@@ -208,7 +208,7 @@ import {
208
208
  verifyUpdateSignature,
209
209
  webhookEndpoint,
210
210
  zeroCapacity
211
- } from "./chunk-48czwsvj.js";
211
+ } from "./chunk-vn6g8f60.js";
212
212
  import {
213
213
  deleteStaticSite,
214
214
  deployStaticSite,
@@ -222,7 +222,7 @@ import {
222
222
  } from "./chunk-v0vpamnf.js";
223
223
  import {
224
224
  buildAndPushServerlessImage
225
- } from "./chunk-b801ga2t.js";
225
+ } from "./chunk-fgk8cqew.js";
226
226
  import {
227
227
  ApplicationAutoScalingClient,
228
228
  BedrockClient,
@@ -341,7 +341,7 @@ import {
341
341
  waitForCloudInit,
342
342
  waitForSsh,
343
343
  wrapCloudInitUserData
344
- } from "./chunk-gtrecc8b.js";
344
+ } from "./chunk-4q7jx76n.js";
345
345
  import {
346
346
  EC2Client,
347
347
  SSMClient
@@ -514,7 +514,7 @@ import {
514
514
  zeroFill,
515
515
  zoneOffsetMs,
516
516
  zonedParts
517
- } from "./chunk-8ynjhsh3.js";
517
+ } from "./chunk-29rse4p1.js";
518
518
  import {
519
519
  DEFAULT_ATTACK_MODE_HOURS,
520
520
  MAX_CONTROL_HOURS,
@@ -978,7 +978,7 @@ import {
978
978
  withSecurity,
979
979
  withTimeout,
980
980
  xrayManager
981
- } from "./chunk-xes5vst2.js";
981
+ } from "./chunk-050r7ycy.js";
982
982
  import {
983
983
  __require
984
984
  } from "./chunk-v0bahtg2.js";
@@ -44,7 +44,7 @@ import {
44
44
  parseChain,
45
45
  propagationHeaders,
46
46
  recursionBlockedResponse
47
- } from "../chunk-xes5vst2.js";
47
+ } from "../chunk-050r7ycy.js";
48
48
  import"../chunk-v0bahtg2.js";
49
49
  export {
50
50
  wafEventTelemetry,
@@ -82,9 +82,9 @@ import {
82
82
  zeroFill,
83
83
  zoneOffsetMs,
84
84
  zonedParts
85
- } from "../chunk-8ynjhsh3.js";
85
+ } from "../chunk-29rse4p1.js";
86
86
  import"../chunk-aa2dkn7b.js";
87
- import"../chunk-xes5vst2.js";
87
+ import"../chunk-050r7ycy.js";
88
88
  import"../chunk-v0bahtg2.js";
89
89
  export {
90
90
  zonedParts,