Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/actions/setup.node/action.yml

This file was deleted.

30 changes: 12 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,27 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup.node
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: Lint
run: pnpm lint
run: bun lint
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup.node
- name: Env info
run: |
echo "Node $(node -v)"
echo "pnpm v$(pnpm -v)"
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: Test
run: pnpm test
run: bun test:spec
e2e:
runs-on: ubuntu-latest
needs: test
if: false # Disabled until morale improves
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup.node
- name: Environment
run: echo $CI && env
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: End to end tests
run: pnpm test:e2e
run: bun test:e2e
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/pnpm/pnpm:11
FROM oven/bun:1

# UDP host for remote address registration
EXPOSE 8809/udp
Expand All @@ -7,8 +7,11 @@ EXPOSE 8890/tcp
# HTTP host for Prometheus metrics
EXPOSE 8891/tcp

COPY . /foxssake/noray
WORKDIR /foxssake/noray
RUN pnpm install --frozen-lockfile
COPY bin bin
COPY src src
COPY package.json bun.lock ./

CMD ["pnpm", "start:prod"]
RUN bun install --frozen-lockfile --production

CMD ["bun", "start:prod"]
18 changes: 16 additions & 2 deletions bin/noray.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { Noray } from "../src/noray.ts";

let isShuttingDown = false;
const noray = new Noray();
noray.start();

process.on("exit", () => noray.shutdown());
process.on("SIGINT", () => noray.shutdown());
function shutdown() {
if (isShuttingDown) return;

isShuttingDown = true;
noray.shutdown();

// HACK: noray keeps running after shutdown, maybe a shutdown hook runs
// something async that doesn't finish?
// TODO: Refactor similarly to nohub, expose a shutdown listener that can be
// async, and await each individually with a timeout
process.exit(1);
}

process.on("exit", shutdown);
process.on("SIGINT", shutdown);
574 changes: 574 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@foxssake/noray",
"version": "1.5.3",
"description": "Online multiplayer orchestrator and potential game platform",
"version": "1.5.4",
"description": "Network connection orchestrator",
"main": "src/noray.ts",
"type": "module",
"bin": {
"noray": "bin/noray.ts"
},
"scripts": {
"lint": "eslint src bin",
"test": "node --test test/spec/**/*.test.ts",
"test:e2e": "node --test test/e2e/**/*.test.ts | node scripts/taplog.ts utap \"pino-pretty -c\"",
"start": "node bin/noray.ts | pino-pretty",
"start:prod": "NODE_ENV=production node bin/noray.ts"
"test:spec": "bun test test/spec",
"test:e2e": "bun test test/e2e | bun scripts/taplog.ts utap \"pino-pretty -c\"",
"start": "bun bin/noray.ts | pino-pretty",
"start:prod": "NODE_ENV=production bun bin/noray.ts"
},
"keywords": [
"online",
Expand All @@ -21,7 +21,7 @@
"relay",
"nat"
],
"author": "Tamas Galffy",
"author": "Tamás Gálffy",
"license": "MIT",
"repository": "github:foxssake/noray",
"homepage": "https://github.com/foxssake/noray",
Expand All @@ -43,18 +43,13 @@
},
"dependencies": {
"@foxssake/trimsock-js": "^0.17.0",
"@foxssake/trimsock-node": "^0.17.0",
"dotenv": "^16.0.3",
"@foxssake/trimsock-bun": "^0.17.0",
"nanoid": "^4.0.1",
"pino": "^8.11.0",
"prom-client": "^14.2.0"
},
"devEngines": {
"runtime": {
"name": "node",
"version": "24.x",
"onFail": "download"
}
"engines": {
"bun": ">=1.3.0"
},
"files": [
"src/*",
Expand Down
Loading
Loading