Run on Bun: bun install, bun --bun next, both dev2 sites on Bun (#222)
Some checks are pending
CI / build (push) Waiting to run
Deploy to dev2 / deploy (push) Waiting to run
test / test (push) Waiting to run

* Run on Bun: bun install, bun --bun next, both dev2 sites on Bun

Moves logicsrc.com and app.logicsrc.com (one image) off Node + npm onto Bun,
following the fleet recipe (phonenumbers.bot pilot).

- Package manager: bun.lock migrated from package-lock.json, so every resolved
  version is unchanged; packageManager bun@1.4.2. Root scripts run each
  workspace with `bun run --cwd <dir>` instead of `npm --workspace`.
- Bun 1.4.2, not the fleet's 1.4.0: 1.4.0 re-resolves this workspace's `file:`
  cross-references differently on every install, so its own lockfile never
  passes --frozen-lockfile. 1.4.2 is stable on it.
- Runtime: logicsrc-web runs `bun --bun next build/start`; apps/pwa (Express,
  app.logicsrc.com) runs `bun src/server.mjs`.
- Image: .nixpacks/Dockerfile (the path both dev2 compose stacks build) is now
  a hand-written oven/bun image carrying the whole workspace, run as the
  non-root bun user. ENTRYPOINT stays `bash -l -c` so a compose `command:` is
  one string, as before; app.logicsrc.com's compose starts it with
  "npm --workspace @logicsrc/pwa run start", which .nixpacks/npm (the image's
  only `npm`) turns into `bun run start` in apps/pwa. Port 3000, the PUBLIC_URL
  build arg and the / health path are unchanged. The nixpacks .nix and
  build.sh are gone.
- CI: both workflows install with bun and run every script through bun (Node
  stays only as the interpreter for vitest/tsc/node --test/Playwright, as
  before), and CI now boots the site under Bun.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: boot check on port 3100 and stop it before Playwright needs 3000

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(web): keep next dev on port 5174, which Playwright waits on

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-01 08:14:40 -07:00 • committed by GitHub
parent e62c546a1e
commit 20797a98f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1917 additions and 9609 deletions

6
.dockerignore Normal file
View file

@ -0,0 +1,6 @@
.git
node_modules
**/node_modules
**/.next
**/dist
.env*

View file

@ -20,26 +20,47 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
# Bun is the package manager and the production runtime; the version comes
# from packageManager in package.json, the same Bun the image pins.
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
# Node stays as the interpreter for the test tooling (vitest, tsc,
# node --test, Playwright), which ran on Node 24 before.
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 24 node-version: 24
cache: npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: bun install --frozen-lockfile
- name: Build and unit tests - name: Build and unit tests
run: npm run check run: bun run check
- name: Validate schema fixtures - name: Validate schema fixtures
run: npm run schemas:validate run: bun run schemas:validate
- name: API contract tests - name: API contract tests
run: npm run test:contract run: bun run test:contract
- name: The site serves under Bun
# Port 3100 and stopped afterwards: Playwright's webServer below needs 3000.
run: |
cd apps/logicsrc-web
PORT=3100 bun --bun ../../node_modules/next/dist/bin/next start > /tmp/web.log 2>&1 &
pid=$!
for i in $(seq 1 60); do
code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3100/ || true)
if [ "$code" = 200 ]; then echo "/ -> $code"; kill "$pid"; exit 0; fi
sleep 1
done
cat /tmp/web.log; kill "$pid" || true; exit 1
- name: Install Playwright browsers - name: Install Playwright browsers
run: npx playwright install --with-deps chromium run: bunx playwright install --with-deps chromium
- name: Playwright E2E - name: Playwright E2E
run: npm run test:e2e run: bun run test:e2e

View file

@ -15,17 +15,21 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
# Node runs the test tooling (vitest, tsc, node --test), as before.
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 24 node-version: 24
cache: npm
- run: npm ci - run: bun install --frozen-lockfile
# Workspace packages (e.g. @logicsrc/plugin-core, @logicsrc/validators) # Workspace packages (e.g. @logicsrc/plugin-core, @logicsrc/validators)
# publish from dist/, so dependents can't resolve them until built. # publish from dist/, so dependents can't resolve them until built.
- run: npm run build - run: bun run build
- run: npm test - run: bun run test
env: env:
CI: true CI: true

View file

@ -1,36 +1,48 @@
FROM ghcr.io/railwayapp/nixpacks:ubuntu-1745885067 # syntax=docker/dockerfile:1
#
# logicsrc.com and app.logicsrc.com, run on Bun. One image serves both sites.
#
# This file lives at .nixpacks/Dockerfile because that is the path dev2's compose
# stacks build (cli-tools dev2/dev2-site provision records it per site, and
# re-provisioning keeps it). It used to be nixpacks output (Node + npm); it is now
# a hand-written Bun image, so do not regenerate it with nixpacks.
#
# Contract with dev2, unchanged from the Node image:
# - Listens on 3000 inside the container and answers / for the deploy health check.
# - ENTRYPOINT is `bash -l -c`, so a compose `command:` is ONE string, as before.
# logicsrc.com uses the default CMD; app.logicsrc.com's compose overrides it
# with "npm --workspace @logicsrc/pwa run start", which .nixpacks/npm (the
# image's `npm`) turns into `bun run start` in apps/pwa.
# - Takes the PUBLIC_URL build arg; secrets come from app.env at run time.
#
# The whole workspace tree ships, not a Next standalone bundle: app.logicsrc.com
# runs apps/pwa (Express) from the same image, with its own dependencies.
#
# Bun 1.4.2, not the fleet's usual 1.4.0: 1.4.0 re-resolves this workspace's
# `file:` cross-references differently on every install, so its own lockfile
# never passes --frozen-lockfile. 1.4.2 is stable on it.
ENTRYPOINT ["/bin/bash", "-l", "-c"] FROM oven/bun:1.4.2-slim AS build
WORKDIR /app/ WORKDIR /app
ARG PUBLIC_URL ARG PUBLIC_URL
ENV PUBLIC_URL=$PUBLIC_URL ENV PUBLIC_URL=$PUBLIC_URL \
NEXT_TELEMETRY_DISABLED=1
COPY . .
COPY .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix RUN bun install --frozen-lockfile
RUN nix-env -if .nixpacks/nixpkgs-ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.nix && nix-collect-garbage -d # Every workspace build (tsc, vite, `bun --bun next build`), in dependency order.
RUN bun run build
ARG CI NIXPACKS_METADATA NIXPACKS_NODE_VERSION NODE_ENV NPM_CONFIG_PRODUCTION
ENV CI=$CI NIXPACKS_METADATA=$NIXPACKS_METADATA NIXPACKS_NODE_VERSION=$NIXPACKS_NODE_VERSION NODE_ENV=$NODE_ENV NPM_CONFIG_PRODUCTION=$NPM_CONFIG_PRODUCTION
# setup phase
# noop
# install phase
ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH
COPY . /app/.
RUN --mount=type=cache,id=myZsC0wNW9Q-/root/npm,target=/root/.npm npm ci
# build phase
COPY . /app/.
RUN --mount=type=cache,id=myZsC0wNW9Q-apps/logicsrc-web/next/cache,target=/app/apps/logicsrc-web/.next/cache --mount=type=cache,id=myZsC0wNW9Q-node_modules/cache,target=/app/node_modules/.cache npm run build
RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
# start
COPY . /app
CMD ["npm run start"]
FROM oven/bun:1.4.2-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
PORT=3000
COPY --from=build --chown=bun:bun /app /app
COPY --chown=root:root .nixpacks/npm /usr/local/bin/npm
# The oven/bun image ships a non-root `bun` user.
USER bun
EXPOSE 3000
ENTRYPOINT ["/bin/bash", "-l", "-c"]
# logicsrc.com: Next's own entry file run directly by Bun, one process, no
# wrapper (`bun run start` would leave three bun processes stacked up).
CMD ["cd apps/logicsrc-web && exec bun --bun /app/node_modules/next/dist/bin/next start"]

View file

@ -1 +0,0 @@
docker build /home/anthony/src/profullstack/logicsrc/.claude/worktrees/dev2-logicsrc.com-8sr7z6_r -f /home/anthony/src/profullstack/logicsrc/.claude/worktrees/dev2-logicsrc.com-8sr7z6_r/.nixpacks/Dockerfile -t 4c321096-0f24-4fcc-8a9b-8098036fecc1 --build-arg CI=true --build-arg NIXPACKS_METADATA=node --build-arg NIXPACKS_NODE_VERSION=22 --build-arg NODE_ENV=production --build-arg NPM_CONFIG_PRODUCTION=false

View file

@ -1,21 +0,0 @@
{ }:
let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7.tar.gz") { overlays = [ (import (builtins.fetchTarball "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz")) ]; };
in with pkgs;
let
APPEND_LIBRARY_PATH = "${lib.makeLibraryPath [ gcc-unwrapped ] }";
myLibraries = writeText "libraries" ''
export LD_LIBRARY_PATH="${APPEND_LIBRARY_PATH}:$LD_LIBRARY_PATH"
'';
in
buildEnv {
name = "ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env";
paths = [
(runCommand "ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env" { } ''
mkdir -p $out/etc/profile.d
cp ${myLibraries} $out/etc/profile.d/ffeebf0acf3ae8b29f8c7049cd911b9636efd7e7-env.sh
'')
nodejs_22 npm-9_x
];
}

28
.nixpacks/npm Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
# npm compatibility shim for the Bun image (see .nixpacks/Dockerfile).
#
# dev2's compose for app.logicsrc.com starts this image with the fixed command
# string "npm --workspace @logicsrc/pwa run start" (rendered by cli-tools
# dev2-site from the old Railway start command). The image has no Node and no
# npm, so this translates exactly that shape, `npm [--workspace NAME] run
# SCRIPT [ARGS...]`, into `bun run SCRIPT` inside the workspace's directory.
# Anything else is refused loudly rather than guessed at.
set -eu
ROOT=/app
ws=""
if [ "${1:-}" = "--workspace" ] || [ "${1:-}" = "-w" ]; then ws=$2; shift 2; fi
if [ "${1:-}" != "run" ] || [ $# -lt 2 ]; then
echo "npm shim: only 'npm [--workspace NAME] run SCRIPT' is supported (got: $*)" >&2
exit 64
fi
shift
dir=$ROOT
if [ -n "$ws" ]; then
dir=""
for pj in "$ROOT"/apps/*/package.json "$ROOT"/packages/*/package.json "$ROOT"/plugins/*/package.json; do
if grep -q "\"name\": *\"$ws\"" "$pj"; then dir=$(dirname "$pj"); break; fi
done
[ -n "$dir" ] || { echo "npm shim: no workspace named $ws" >&2; exit 66; }
fi
cd "$dir"
exec bun run "$@"

View file

@ -43,8 +43,8 @@ scripts/
## Quick Start ## Quick Start
```bash ```bash
npm install bun install
npm run check bun run check
npm --workspace @logicsrc/cli run dev -- --openspec agentswarm --yolo --repo profullstack/logicsrc npm --workspace @logicsrc/cli run dev -- --openspec agentswarm --yolo --repo profullstack/logicsrc
npm --workspace @logicsrc/cli run dev -- openspec import npm --workspace @logicsrc/cli run dev -- openspec import
npm --workspace @logicsrc/cli run dev -- openspec export --out logicsrc-openspec-summary.md npm --workspace @logicsrc/cli run dev -- openspec export --out logicsrc-openspec-summary.md

View file

@ -4,9 +4,9 @@
"private": true, "private": true,
"description": "LogicSRC standards and open specification PWA (Next.js).", "description": "LogicSRC standards and open specification PWA (Next.js).",
"scripts": { "scripts": {
"dev": "next dev -p 5174", "dev": "bun --bun next dev -p 5174",
"build": "next build", "build": "bun --bun next build",
"start": "next start", "start": "bun --bun next start",
"test": "vitest run contract", "test": "vitest run contract",
"test:contract": "vitest run contract", "test:contract": "vitest run contract",
"test:e2e": "playwright test" "test:e2e": "playwright test"

View file

@ -23,7 +23,7 @@ export default defineConfig({
} }
], ],
webServer: { webServer: {
command: "npm run dev", command: "bun run dev",
url: "http://127.0.0.1:5174", url: "http://127.0.0.1:5174",
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
timeout: 120_000 timeout: 120_000

View file

@ -3,14 +3,11 @@
"version": "0.1.1", "version": "0.1.1",
"private": true, "private": true,
"type": "module", "type": "module",
"description": "LogicSRC credentials — Express app on Postgres (@profullstack/libsql-pg): auth + end-to-end-encrypted team credential sharing.", "description": "LogicSRC credentials \u2014 Express app on Postgres (@profullstack/libsql-pg): auth + end-to-end-encrypted team credential sharing.",
"engines": {
"node": ">=20"
},
"scripts": { "scripts": {
"start": "node src/server.mjs", "start": "bun src/server.mjs",
"dev": "node --watch src/server.mjs", "dev": "bun --watch src/server.mjs",
"migrate": "node src/migrate.mjs", "migrate": "bun src/migrate.mjs",
"test": "node --test" "test": "node --test"
}, },
"dependencies": { "dependencies": {

1783
bun.lock Normal file

File diff suppressed because it is too large Load diff

9521
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,21 +5,21 @@
"description": "LogicSRC open coordination standards and CommandBoard.run reference implementation.", "description": "LogicSRC open coordination standards and CommandBoard.run reference implementation.",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"packageManager": "npm@11.11.0", "packageManager": "bun@1.4.2",
"workspaces": [ "workspaces": [
"packages/*", "packages/*",
"plugins/*", "plugins/*",
"apps/*" "apps/*"
], ],
"scripts": { "scripts": {
"build": "npm --workspace @logicsrc/schemas run build && npm --workspace @logicsrc/validators run build && npm --workspace @logicsrc/sdk run build && npm --workspace @logicsrc/agentad run build && npm --workspace @logicsrc/ans run build && npm --workspace @logicsrc/plugin-core run build && npm --workspace @logicsrc/agentstack run build && npm --workspace @logicsrc/agentswarm run build && npm --workspace @logicsrc/account-core run build && npm --workspace @logicsrc/plugin-coinpay run build && npm --workspace @logicsrc/plugin-ugig run build && npm --workspace @logicsrc/plugin-sh1pt run build && npm --workspace @logicsrc/plugin-c0mpute run build && npm --workspace @logicsrc/plugin-feed-discovery run build && npm --workspace @logicsrc/plugin-social-accounts run build && npm --workspace @logicsrc/plugin-email-accounts run build && npm --workspace @logicsrc/plugin-agentbbs run build && npm --workspace @logicsrc/plugin-agentgit run build && npm --workspace @logicsrc/plugin-agentmail run build && npm --workspace @logicsrc/plugin-credential-sharing run build && npm --workspace @logicsrc/openontology run build && npm --workspace @logicsrc/openprd run build && npm --workspace @logicsrc/opencontext run build && npm --workspace @logicsrc/opencreds run build && npm --workspace @logicsrc/tui run build && npm --workspace @logicsrc/openfleet run build && npm --workspace @logicsrc/cli run build && npm --workspace @profullstack/logicsrc-mcp run build && npm --workspace @logicsrc/commandboard-api run build && npm --workspace @logicsrc/commandboard-web run build && npm --workspace @logicsrc/web run build", "build": "bun run --cwd packages/schemas build && bun run --cwd packages/validators build && bun run --cwd packages/sdk build && bun run --cwd packages/agentad build && bun run --cwd packages/ans build && bun run --cwd packages/plugin-core build && bun run --cwd packages/agentstack build && bun run --cwd packages/agentswarm build && bun run --cwd packages/account-core build && bun run --cwd plugins/coinpay build && bun run --cwd plugins/ugig build && bun run --cwd plugins/sh1pt build && bun run --cwd plugins/c0mpute build && bun run --cwd plugins/feed-discovery build && bun run --cwd plugins/social-accounts build && bun run --cwd plugins/email-accounts build && bun run --cwd plugins/agentbbs build && bun run --cwd plugins/agentgit build && bun run --cwd plugins/agentmail build && bun run --cwd plugins/credential-sharing build && bun run --cwd packages/openontology build && bun run --cwd packages/openprd build && bun run --cwd packages/opencontext build && bun run --cwd packages/opencreds build && bun run --cwd packages/tui build && bun run --cwd packages/openfleet build && bun run --cwd packages/cli build && bun run --cwd packages/logicsrc-mcp build && bun run --cwd apps/commandboard-api build && bun run --cwd apps/commandboard-web build && bun run --cwd apps/logicsrc-web build",
"start": "npm --workspace @logicsrc/web run start", "start": "bun run --cwd apps/logicsrc-web start",
"test": "npm run test --workspaces --if-present", "test": "bun run --filter '*' test",
"check": "npm run build && npm run test", "check": "bun run build && bun run test",
"schemas:validate": "npm --workspace @logicsrc/validators run validate:fixtures", "schemas:validate": "bun run --cwd packages/validators validate:fixtures",
"test:contract": "npm --workspace @logicsrc/commandboard-api run test:contract && npm --workspace @logicsrc/web run test:contract", "test:contract": "bun run --cwd apps/commandboard-api test:contract && bun run --cwd apps/logicsrc-web test:contract",
"test:e2e": "npm --workspace @logicsrc/commandboard-web run test:e2e && npm --workspace @logicsrc/web run test:e2e", "test:e2e": "bun run --cwd apps/commandboard-web test:e2e && bun run --cwd apps/logicsrc-web test:e2e",
"build:cli": "npm --workspace @logicsrc/schemas run build && npm --workspace @logicsrc/validators run build && npm --workspace @logicsrc/plugin-core run build && npm --workspace @logicsrc/account-core run build && npm --workspace @logicsrc/plugin-coinpay run build && npm --workspace @logicsrc/plugin-ugig run build && npm --workspace @logicsrc/plugin-feed-discovery run build && npm --workspace @logicsrc/plugin-social-accounts run build && npm --workspace @logicsrc/plugin-email-accounts run build && npm --workspace @logicsrc/plugin-agentbbs run build && npm --workspace @logicsrc/plugin-credential-sharing run build && npm --workspace @logicsrc/openontology run build && npm --workspace @logicsrc/openprd run build && npm --workspace @logicsrc/opencontext run build && npm --workspace @logicsrc/opencreds run build && npm --workspace @logicsrc/tui run build && npm --workspace @profullstack/logicsrc-mcp run build && npm --workspace @logicsrc/openfleet run build && npm --workspace @logicsrc/cli run build" "build:cli": "bun run --cwd packages/schemas build && bun run --cwd packages/validators build && bun run --cwd packages/plugin-core build && bun run --cwd packages/account-core build && bun run --cwd plugins/coinpay build && bun run --cwd plugins/ugig build && bun run --cwd plugins/feed-discovery build && bun run --cwd plugins/social-accounts build && bun run --cwd plugins/email-accounts build && bun run --cwd plugins/agentbbs build && bun run --cwd plugins/credential-sharing build && bun run --cwd packages/openontology build && bun run --cwd packages/openprd build && bun run --cwd packages/opencontext build && bun run --cwd packages/opencreds build && bun run --cwd packages/tui build && bun run --cwd packages/logicsrc-mcp build && bun run --cwd packages/openfleet build && bun run --cwd packages/cli build"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^24.10.1", "@types/node": "^24.10.1",