With systemd, you can run the mabl Link Agent as a system service on a Linux machine. Link Agents that run on systemd automatically start up on boot and restart if the process crashes.
This article explains how to set up the Link Agent with systemd.
Running the Link Agent with systemd requires:
- A "Link Agent" API key. API key access is limited to workspace owners.
- Java version 11 or higher
See Link Agent requirements for additional details.
Step 1: Install the Link Agent
Take the following steps to install the Link Agent:
- Download your preferred distribution - zip or tar.bz2 - from the networking page in the mabl app: Settings > Networking.
- Copy the file archive to the machine where you want to run the Link Agent.
- Extract the file archive to a convenient location.
# Extract bzip2 tar:
tar xjf link-agent.tbz2
# Or extract zip:
unzip link-agent.zip
Step 2: Customize the service file template
The following example is a template for the link-agent.service file. Customize this template before using it. At a minimum, update the ExecStart
parameter with the following values:
- The path where you have installed the Link Agent.
/path/to/your/config.yaml
: path to your Link Agent configuration file that contains the name and API key for your Link Agent.
[Unit]
Description=mabl Link Agent
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1User=mabl
ExecStart=/opt/mabl/link-agent/bin/link-agent -c /path/to/your/config.yaml
[Install]
WantedBy=multi-user.target
We recommend creating a separate user and group called "mabl" or something similar and using chown
to ensure that only this user/group can read/write the directory where the Link Agent is installed. If you would like to use a user other than mabl, please update the User
parameter in the service file.
Specifying JAVA_HOME
If the path to Java is not picked up automatically, or you need to specify a different version of Java than your system default, insert the following line under the [Service]
section of the service file:
Environment="JAVA_HOME=/path/to/java/base/directory"
For example, if the version of Java that you would like to use is installed at /usr/lib/jvm/openjdk-bin-17
, the line would be:
Environment="JAVA_HOME=/usr/lib/jvm/openjdk-bin-17"
Step 3: Save the link-agent.service file
After customizing the service file template to your system and environment, save the file as link-agent.service
in the location on your system where service files are defined, such as /etc/systemd/system
.
Step 4: Start up the Link Agent
Run the following commands to start up the Link Agent:
systemctl enable link-agent
systemctl start link-agent
To verify that the agent has started up properly, use journalctl
journalctl -u link-agent -r
Step 5: Validate the Link connection is live
After starting the Link Agent, return to the networking page in the mabl app: Settings > Networking. The Link Agent appears in the Link Agents section with an "Initializing" status when starting up. Within a couple minutes of starting up, the Link Agent should show a "Connected" status.
A Link Agent with a "Connected" status
Next steps
When the Link Agent is installed and running, configure your tests to run over mabl Link.