Some checks reported errors
farmcontrol/farmcontrol-server/pipeline/head Something is wrong with the build of this commit
- Updated electrobun.config.ts to conditionally enable code signing and notarization based on developer ID presence. - Refactored Jenkinsfile to support separate macOS builds for x64 and arm64 architectures. - Added new scripts for ensuring core dependencies and patching Electrobun source for cross-architecture compatibility. - Enhanced build-macos.mjs to improve architecture detection and build order, ensuring robust handling of macOS builds. - Updated package.json to include a post-install script for patching Electrobun source files.
71 lines
2.3 KiB
Markdown
71 lines
2.3 KiB
Markdown
# Farm Control Server
|
|
|
|
[](https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-server/job/main/)
|
|
|
|
A Bun application that bridges communication between Farm Control cloud services, local websocket clients, and connected printers.
|
|
|
|
## Features
|
|
|
|
- Connects to the Farm Control websocket API
|
|
- Provides a local HTTP server for CLI and integrations
|
|
- Desktop UI built with React, Ant Design, and Electrobun
|
|
- Headless Linux service packaging for servers and Raspberry Pi hosts
|
|
- Relays printer and document printer state to the desktop UI
|
|
|
|
## Requirements
|
|
|
|
- [Bun](https://bun.sh) 1.1 or newer
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository
|
|
2. Install dependencies:
|
|
```
|
|
bun install
|
|
```
|
|
3. Edit `config.json` for your environment
|
|
4. Start the server:
|
|
```
|
|
bun run dev
|
|
```
|
|
|
|
## Development
|
|
|
|
- Headless server: `bun run dev`
|
|
- Desktop app with hot reload: `bun run dev:app`
|
|
- Renderer only: `bun run dev:renderer`
|
|
|
|
## Building
|
|
|
|
Build configuration lives in `electrobun.config.ts` and follows the [Electrobun build configuration](https://framework.blackboard.sh/electrobun/apis/cli/build-configuration/) model:
|
|
|
|
- **preBuild** — validates sources, writes build metadata, and runs the Vite renderer build
|
|
- **postPackage** — normalizes release artifacts (DMG/PKG on macOS, MSI on Windows)
|
|
|
|
Commands:
|
|
|
|
- Desktop app (current platform): `bun run build:app`
|
|
- macOS universal (arm64 + x64): `bun run build:app:mac`
|
|
- macOS single arch: `ELECTROBUN_TARGET_ARCH=arm64 bun run build:app:mac`
|
|
- macOS arm64 on Intel: cross-builds via patched Electrobun CLI (`ELECTROBUN_TARGET_ARCH=arm64`)
|
|
|
|
Universal macOS builds use split CI agents (`macos` for x64, `macos-arm64` for arm64). Locally on Intel, arm64 builds work via `ELECTROBUN_TARGET_ARCH=arm64`. On Apple Silicon, x64 uses Rosetta (`arch -x86_64`).
|
|
- Linux headless packages: `bun run build:linux`
|
|
- Clean build outputs: `bun run clean`
|
|
|
|
Desktop artifacts are written to `app_dist/`. Linux headless builds produce `.deb` and `.rpm` packages in the same folder.
|
|
|
|
## Configuration
|
|
|
|
`config.json` contains `development` and `production` sections. Each section supports:
|
|
|
|
- `logLevel`
|
|
- `url` (websocket server)
|
|
- `apiUrl`
|
|
- `host.id` and `host.authCode`
|
|
- `dataDir`
|
|
|
|
## License
|
|
|
|
MIT
|