fszontagh 339c993d66 fix: the runner no longer refuses to start without a local webserver 3 tuần trước cách đây
..
user 339c993d66 fix: the runner no longer refuses to start without a local webserver 3 tuần trước cách đây
README.md e29357347d docs: describe the database as an external service 1 tháng trước cách đây

README.md

SmartBotic Systemd Services

This directory contains systemd user service files for managing SmartBotic processes.

Installation

  1. Link or copy the service files to your user systemd directory:

    mkdir -p ~/.config/systemd/user
    ln -sf /data/smartbotic/systemd/user/*.service ~/.config/systemd/user/
    ln -sf /data/smartbotic/systemd/user/*.target ~/.config/systemd/user/
    
  2. Reload systemd to pick up the new services:

    systemctl --user daemon-reload
    

Usage

Start all services

systemctl --user start smartbotic.target

Start individual services

systemctl --user start smartbotic-webserver
systemctl --user start smartbotic-runner

Stop all services

systemctl --user stop smartbotic.target

Stop individual services

systemctl --user stop smartbotic-runner
systemctl --user stop smartbotic-webserver

Restart services

systemctl --user restart smartbotic-webserver
systemctl --user restart smartbotic-runner

Check status

systemctl --user status smartbotic-webserver
systemctl --user status smartbotic-runner

View logs

# Follow logs for a specific service
journalctl --user -u smartbotic-webserver -f

# View last 100 lines
journalctl --user -u smartbotic-runner -n 100

# View all SmartBotic logs
journalctl --user -u 'smartbotic-*' -f

Enable auto-start on login

systemctl --user enable smartbotic.target

Disable auto-start

systemctl --user disable smartbotic.target

Service Dependencies

smartbotic-database   (system service, external package)
       ↓
smartbotic-webserver  (--user)
       ↓
smartbotic-runner     (--user)

The services have proper dependency ordering:

  • smartbotic-database must be running first. It is not a user unit from this repo - it ships with the upstream smartbotic-database package as a system service: sudo systemctl start smartbotic-database
  • smartbotic-webserver depends on the database and starts after it
  • smartbotic-runner depends on webserver and starts after it

Environment Variables

You can override environment variables in the service files or create an override:

systemctl --user edit smartbotic-runner

Add your overrides:

[Service]
Environment=LOG_LEVEL=debug
Environment=RUNNER_ID=my-runner

Troubleshooting

If services fail to start, check the logs:

sudo journalctl -u smartbotic-database -e
journalctl --user -u smartbotic-webserver -e
journalctl --user -u smartbotic-runner -e

Common issues:

  • Port already in use: Check if another instance is running
  • Database connection failed: Ensure database service is running
  • Runner registration failed: Ensure webserver is accessible