Backend and device management service for Apollo systems. In production this repo is installed on the device at /opt/apolloapi, runs the API directly with Node.js, builds the UI on-device, and manages miner/node/solo services through systemd.
- Node.js
21.x - Yarn
yarnyarn devOn first start the app will:
- Create
.envin the repo root if it does not exist. - Set
DATABASE_URLtofuturebit.sqlite. - Generate
APP_SECRET. - Run pending SQLite migrations.
- Start the API from
src/init.js.
The development entrypoint is the API only. The production UI lives in the separate apolloui-v2 repo and is installed on devices under /opt/apolloapi/apolloui-v2.
The old cross-build / tarball workflow is obsolete. Current devices have enough RAM to install dependencies and build the UI directly on the device.
For a standard device image install from a checked out repo, use:
sudo bash backend/utils/image_installFor a one-command install directly from the main branch, use:
curl -fsSL https://raw.githubusercontent.com/jstefanop/apolloapi-v2/main/backend/utils/image_install | sudo bashThese installers perform the full device setup:
- Install required Debian packages.
- Create the
futurebituser. - Clone
apolloapi-v2into/opt/apolloapi. - Clone
apolloui-v2into/opt/apolloapi/apolloui-v2. - Install NVM, Node
21.6.2, and Yarn. - Create
.envfiles for the API and UI. - Run
yarnfor the API. - Run
yarn installandyarn buildfor the UI on-device. - Install bundled miner, node, and ckpool binaries for the device architecture.
- Copy
systemdunit files into/etc/systemd/system.
There is also a repo installer at:
sudo bash backend/install-v2It follows the same general flow and supports:
sudo bash backend/install-v2 dev
sudo bash backend/install-v2 dev <branch>Use the backend/utils/ installers for current image/device setup unless you specifically need the older install-v2 path.
For image/device installs that were originally set up with image_install, use:
sudo bash backend/utils/image_updateFor repo-managed updates, use:
sudo bash backend/updateNotes:
- These update scripts assume the production install lives at
/opt/apolloapi. - They stop production services, refresh code, reinstall dependencies, rebuild the UI on-device, refresh bundled binaries, and reload
systemd. - They are not safe for preserving local uncommitted changes inside
/opt/apolloapi; some paths usegit reset --hard.
The production install copies the following units into /etc/systemd/system:
apollo-api.serviceapollo-ui-v2.serviceapollo-miner.servicenode.serviceckpool.servicerc-local.serviceswap.serviceon image installs that enable swap
Check status:
sudo systemctl status apollo-api apollo-ui-v2 apollo-miner node ckpoolRestart the API and UI:
sudo systemctl restart apollo-api apollo-ui-v2Control miner, node, or solo pool individually:
sudo systemctl start apollo-miner
sudo systemctl stop node
sudo systemctl restart ckpoolEnable a service at boot:
sudo systemctl enable apollo-apiReload unit files after changing service definitions:
sudo systemctl daemon-reloadThe shipped units currently start in this order:
rc-local.serviceapollo-api.serviceapollo-ui-v2.servicenode.serviceckpool.service
apollo-miner.service also starts after the network and rc-local.service.
Use journalctl for service logs:
sudo journalctl -u apollo-api -f
sudo journalctl -u apollo-ui-v2 -f
sudo journalctl -u node -f
sudo journalctl -u apollo-miner -f
sudo journalctl -u ckpool -fProduction installs expect these paths:
- API repo:
/opt/apolloapi - UI repo:
/opt/apolloapi/apolloui-v2 - SQLite DB:
/opt/apolloapi/futurebit.sqlite - API env file:
/opt/apolloapi/.env - Node config:
/opt/apolloapi/backend/node/ - ckpool config/logs:
/opt/apolloapi/backend/ckpool/
- NetworkManager CLI is available via
nmcli. - Firewall setup is handled by
backend/firewalland is wired into boot viarc.local. - Tor is installed by the production installers and kept disabled until enabled by the system/app flow.
To remove the production install:
sudo bash backend/uninstall-v2