diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-19 00:38:46 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-19 00:38:46 -0700 |
| commit | dcb417cbf251a427861b2cbeb50e7f6a9f06f212 (patch) | |
| tree | b86d188f9f2860f186bf4e84b4b757ad5ac2219b /README.md | |
| parent | 0c557f44b59d90900d6a2052a9d97c0266d8feb1 (diff) | |
unified start/stop script and included systemd files
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 47 |
1 files changed, 39 insertions, 8 deletions
@@ -24,6 +24,8 @@ The implementation copies and adapts finance logic from Prism v1 into `backend/` - `components/PriceChart.tsx` Plotly price chart - `lib/api.ts` typed REST client - `types/api.ts` shared frontend response types +- `scripts/stack.sh` unified start/stop/restart/status script +- `systemd/` systemd unit files for running as a system service - `.env.example` optional environment variables - `pytest.ini` backend pytest import path config @@ -95,23 +97,52 @@ The UI stores the selected ticker in the URL, for example `/?ticker=AAPL`. ## Quick Start -Start the whole local stack: +`scripts/stack.sh` manages both services as a local development stack: ```bash -./scripts/start-stack.sh +./scripts/stack.sh start # start backend + frontend in background +./scripts/stack.sh stop # stop both +./scripts/stack.sh restart # stop then start +./scripts/stack.sh status # show running PIDs and URLs ``` -Stop both services: +Notes: + +- expects `backend/.venv` and `frontend/node_modules` to already exist +- default ports are backend `8001` and frontend `3001` +- logs are written to `.run/logs/` +- override hosts/ports via env vars: `BACKEND_HOST`, `BACKEND_PORT`, `FRONTEND_HOST`, `FRONTEND_PORT` + +## Running as a systemd Service + +Unit files live in `systemd/`. Install them for the current user: ```bash -./scripts/stop-stack.sh +# Copy units +cp systemd/prismv2-backend.service ~/.config/systemd/user/ +cp systemd/prismv2-frontend.service ~/.config/systemd/user/ +cp systemd/prismv2.target ~/.config/systemd/user/ + +systemctl --user daemon-reload + +# Start both services via the target +systemctl --user enable --now prismv2.target + +# Control individual services +systemctl --user status prismv2-backend.service +systemctl --user restart prismv2-frontend.service +systemctl --user stop prismv2.target + +# View logs +journalctl --user -u prismv2-backend.service -f +journalctl --user -u prismv2-frontend.service -f ``` -Notes: +To start automatically on login, enable lingering once: -- the scripts expect `backend/.venv` and `frontend/node_modules` to already exist -- default ports are backend `8001` and frontend `3001` -- logs are written to `.run/logs/` +```bash +loginctl enable-linger $USER +``` ## Verification |
