openship icon indicating copy to clipboard operation
openship copied to clipboard

npm package missing packages/adapters/src/infra/lua/*.lua files (OpenResty install fails)

Open inoguerols opened this issue 4 months ago • 2 comments

Bug

Installing OpenResty on a server via openship server install -c openresty <id> fails at the last step ("Deploying analytics scripts...") with:

OpenResty installation failed: ENOENT: no such file or directory, open
'<npm-global>/lib/node_modules/openship/dist/server/lua/site_logger.lua'

Root cause

The published npm package (0.1.11) does not include the .lua files that dist/server/index.js expects to find under dist/server/lua/. The source files exist in the repo at packages/adapters/src/infra/lua/ (site_logger.lua, pipe_log.lua, pipe_stream.lua, geo_country.lua, mgmt_api.lua) but are not copied into dist/server/lua/ during the npm build/publish step — looks like a missing build/copy step or a files/ .npmignore exclusion in the package.json used for the CLI's bundled server.

Repro

npm i -g openship
openship up
openship server add --host <ip> --port <port> --user root --auth-method password --password <pw> --name test
openship server install -c openresty <serverId>

Fails with the ENOENT above.

Workaround (used to unblock myself)

Manually fetched the 5 missing .lua files from packages/adapters/src/infra/lua/ in this repo and placed them under <npm-global>/lib/node_modules/openship/dist/server/lua/ in the installed package — install then completes successfully and the server passes openship server check as healthy.

Suggested fix

Add a build step (or files/copy-assets entry) that ships packages/adapters/src/infra/lua/*.lua into dist/server/lua/ when building the npm-published CLI/server bundle, so a plain npm i -g openship has everything it needs without manual patching.

Env: macOS host (Apple Silicon) driving a fresh Ubuntu 24.04 arm64 target over SSH, openship 0.1.11 (latest on npm).

inoguerols avatar Jul 20 '26 08:07 inoguerols

on it, thank you

Hydralerne avatar Jul 20 '26 09:07 Hydralerne

Opened a fix: #47 — copies packages/adapters/src/infra/lua/*.lua into dist/server/lua during stage-server.ts's build step (same pattern already used for pglite/migrations). Verified with a real bun run --cwd apps/cli build that the 5 expected .lua files land in dist/server/lua/.

inoguerols avatar Jul 20 '26 10:07 inoguerols