Configuring Resilient Circuits for restart

For normal operation, Resilient Circuits must run continuously. The recommend way to do this is to configure it to automatically run at startup. On a RHEL system, this is done using a systemd unit files to define services. The configuration file defines the following properties:
  • OS user account to use.
  • Directory from where it should run.
  • Any required environment variables.
  • Command to run the integrations, such as resilient-circuits run.
  • Dependencies.
You may need to change the paths to your working directory and app.config.
  1. The unit file must be named resilient_circuits.service. To create the file, enter the following command:
    sudo vi /etc/systemd/system/resilient_circuits.service
  2. Add the following contents to the file and change as necessary:
    [Unit]
    Description=Resilient-Circuits Service
    
    [Service]
    Type=simple
    User=integration
    WorkingDirectory=/home/integration
    ExecStart=/usr/local/bin/resilient-circuits run
    Restart=always
    TimeoutSec=10
    Environment=APP_CONFIG_FILE=/home/integration/.resilient/app.config
    Environment=APP_LOCK_FILE=/home/integration/.resilient/resilient_circuits.lock
    
    [Install]
    WantedBy=multi-user.target
    NOTE: If you are installing Resilient Circuits on the same system as the Resilient platform (not recommended), you need to add the following lines in the [Unit] section after Description:
    [Unit]
    Description=Resilient-Circuits Service
    After=resilient.service
    Requires=resilient.service
  3. Ensure that the service unit file is correctly permissioned, as follows:
    sudo chmod 664 /etc/systemd/system/resilient_circuits.service
  4. Reload and enable the new service:
    sudo systemctl daemon-reload 
    sudo systemctl enable resilient_circuits.service
You can use the systemctl command to manually start, stop, restart and return status on the service:
sudo systemctl [start|stop|restart|status] resilient_circuits
You can view log files for systemd and the resilient-circuits service using the journalctl command, as follows:
sudo journalctl -u resilient_circuits --since "2 hours ago"