Running Lazybot under systemd is the recommended approach for any Linux production deployment. systemd handles automatic restarts on failure, integrates withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Apeuriox/lazybot-renewal/llms.txt
Use this file to discover all available pages before exploring further.
journalctl for log management, ensures the service starts only after the network and database are ready, and isolates the process under a dedicated non-root user. This page covers the service unit file, the step-by-step setup procedure, log inspection commands, and an overview of the automated CI/CD workflow provided in the repository.
Service Unit File
The repository ships a ready-to-use unit file atscripts/lazybot.service. Copy its content directly or adapt it for your environment:
Directive Reference
| Directive | Value | Purpose |
|---|---|---|
After | network-online.target mysql.service | Ensures the network stack and MySQL are fully up before Lazybot starts. Without this, the database connection pool fails to initialise on boot. |
Wants | network-online.target | Declares a soft dependency on the network target — the unit will start even if network-online.target is unavailable, but it prefers to wait for it. |
User | lazybot | Runs the process as a dedicated non-root system user, limiting the blast radius of any security issue. |
WorkingDirectory | /opt/lazybot | Sets the working directory for the process. Place application.yaml here so Spring Boot discovers it automatically. |
ExecStart | /usr/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -jar /opt/lazybot/lazybot.jar | The exact Java invocation. Both --enable-preview and --enable-native-access=ALL-UNNAMED are required for JNI library loading and Java 21 preview features. |
ExecStop | /bin/kill -SIGTERM $MAINPID | Sends a graceful SIGTERM to allow Spring Boot to complete its shutdown hooks before the process exits. |
Restart | on-failure | Automatically restarts Lazybot if it exits with a non-zero status code or is killed by a signal. |
RestartSec | 10 | Waits 10 seconds between restart attempts to avoid rapid restart loops. |
StandardOutput / StandardError | journal | Pipes both stdout and stderr into the systemd journal, making logs available via journalctl. |
SyslogIdentifier | lazybot | Tags all journal entries with lazybot, enabling filtered log views with -u lazybot or -t lazybot. |
Environment=LAZYBOT_DIR | /home/lazybot/work-dir | Working directory for Lazybot cache files. Avatars, map backgrounds, and extracted static assets are written here. |
Environment=ROSU_LIB_PATH | /home/lazybot/rosu | Directory containing the Rosu native library (.so). Lazybot’s JNI binding reads this path at startup. |
WantedBy | multi-user.target | Enables the service to start automatically in the standard multi-user runlevel. |
Installation Steps
Create the lazybot System User
Create a dedicated non-interactive system account to run the service. Using a locked shell (Also create the working-directory paths referenced in the unit file:
/bin/false) prevents anyone from logging in as this user:Copy the JAR to /opt/lazybot/
Copy the built artifact from your build machine (or CI pipeline) to the deployment directory:
Create the lazybot.jar Symlink
The service unit references
/opt/lazybot/lazybot.jar. Create a symbolic link pointing at the versioned JAR. Using a symlink makes zero-downtime upgrades straightforward — update the symlink, then restart the service.Place application.yaml in the Working Directory
Spring Boot automatically picks up an
application.yaml located in the working directory of the process. Because the unit file sets WorkingDirectory=/opt/lazybot, place your configured file there:chmod 600 restricts read access to the lazybot user only, protecting your embedded secrets.Managing the Service
Check service status:Viewing Logs
All Lazybot output is forwarded to the systemd journal. Usejournalctl to inspect it:
Follow logs in real time (Ctrl+C to exit):
CI/CD Deployment with GitHub Actions
The repository includes a GitHub Actions workflow at.github/workflows/deploy.yml that automates building and deploying Lazybot to your server on every push to the dev branch (or on manual trigger via workflow_dispatch).
The workflow performs the following steps:
- Checkout the repository source.
- Set up Java 21 (Temurin distribution) using
actions/setup-java@v4. - Prepare
application.yamlby copying the template (application.yaml.template) into place. Secrets are expected to already be present on the server’sapplication.yaml— the template is used only to satisfy the build. - Build with Maven (
mvn clean package -DskipTests) to produce the versioned JAR. - Deploy the JAR via SCP using
appleboy/scp-action. The JAR is transferred to/opt/lazybot/on the remote server. The required secrets areSSH_HOST,SSH_USER, andSSH_PRIVATE_KEY, configured in your repository’s GitHub Actions secrets. - Update the symlink and restart via SSH using
appleboy/ssh-action. The remote script:- Finds the most recently built
lazybot-*.jarin/opt/lazybot/. - Updates the
lazybot.jarsymlink to point at the new JAR. - Runs
sudo systemctl restart lazybotand prints the service status.
- Finds the most recently built