Add single-binary build and --port flag
bun build --compile bundles the app and Bun runtime into bin/job-board (plus linux-x64/arm64 targets). New src/main.ts entry: serve (default) or 'scrape' once, with --port/-p overriding PORT. A compiled binary stores its database in data/ next to the executable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+42
-2
@@ -18,13 +18,53 @@ No runtime dependencies. It uses Bun's built-in SQLite, HTTP server and HTMLRewr
|
||||
|
||||
```sh
|
||||
bun install
|
||||
bun start # http://localhost:3000
|
||||
bun start # http://localhost:3000
|
||||
bun start --port 8080 # or -p 8080
|
||||
```
|
||||
|
||||
The server scrapes every 24h. On startup it waits out the rest of the 24h since the last scrape (or scrapes right away if none happened in the last 24h).
|
||||
You can also click **Scrape now** in the UI, or run `bun run scrape` once (e.g. from cron).
|
||||
|
||||
Env vars: `PORT` (3000), `SCRAPE_INTERVAL_HOURS` (24), `DB_PATH` (`data/jobs.sqlite`).
|
||||
Env vars: `PORT` (3000; `--port` overrides it), `SCRAPE_INTERVAL_HOURS` (24), `DB_PATH` (`data/jobs.sqlite`).
|
||||
|
||||
## Build a binary for a server
|
||||
|
||||
`bun build --compile` bundles the app and the Bun runtime into one executable (~90 MB), so the
|
||||
server doesn't need Bun or `node_modules`:
|
||||
|
||||
```sh
|
||||
bun run build # bin/job-board for this machine
|
||||
bun run build:linux-x64 # bin/job-board-linux-x64
|
||||
bun run build:linux-arm64 # bin/job-board-linux-arm64 (e.g. Raspberry Pi, ARM VPS)
|
||||
```
|
||||
|
||||
On the server:
|
||||
|
||||
```sh
|
||||
./job-board # web server on :3000, scrapes every 24h
|
||||
./job-board --port 8080
|
||||
./job-board scrape # scrape once and exit (exit code 1 if a scraper failed)
|
||||
```
|
||||
|
||||
The database goes to `data/jobs.sqlite` next to the binary (override with `DB_PATH`).
|
||||
The binaries target glibc Linux; for Alpine use `--target=bun-linux-x64-musl`, and for old CPUs
|
||||
without AVX2 use `--target=bun-linux-x64-baseline`.
|
||||
|
||||
Example systemd unit (`/etc/systemd/system/job-board.service`):
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Job board
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/job-board/job-board --port 3000
|
||||
Restart=on-failure
|
||||
User=jobboard
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
## UI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user