Set up a recurring task to spawn workers

To ensure that incoming Perforce events are automatically processed by Swarm, it is important to set up a cron job to do this. The cron job can be installed on any host, although you may want to place this on the Swarm host.

Warning

curl or wget must be installed or workers do not spawn and Swarm cannot process any events. See below for verification steps.

  1. Create a file named helix-swarm in /etc/cron.d.

  2. Edit /etc/cron.d/helix-swarm to contain one of the following blocks; select a block depending on whether your system has curl or wget installed.

    • If you have curl installed:

      # This ensures that a worker is fired up every minute
      * * * * * nobody curl -so /dev/null -m5 https://myswarm.url/queue/worker
      
    • If you have wget installed:

      # This ensures that a worker is fired up every minute
      * * * * * nobody wget -q -O /dev/null -T5 https://myswarm.url/queue/worker
      
  3. Replace myswarm.url above with the actual hostname you have configured for Swarm.

    If this is running on the Swarm host, and you have specified the correct hostname item in the Environment configuration, this can be set to localhost.

    In the example configuration lines above, where you see -m5 or -T5, the 5 is the number of seconds that the cron task will wait for a response from the Swarm host. When the cron task is installed on the Swarm host, such as in the Swarm OVA, that value could be reduced to 1 seconds (e.g. -m1 or -T1).

    Note

    If you configure Swarm to use HTTPS, and you install a self-signed certificate, the cron jobs need to be adjusted to avoid certificate validity test which could cause silent failures to process events.

    • If you have curl installed:

      # This ensures that a worker is fired up every minute
      * * * * * nobody curl -so /dev/null --insecure -m5 https://myswarm.url/queue/worker
      
    • If you have wget installed:

      # This ensures that a worker is fired up every minute
      * * * * * nobody wget -q -O /dev/null --no-check-certificate -T5 https://myswarm.url/queue/worker
      
  4. Save the edited file.

You are now all set to start using Swarm. Enjoy!

Note

If the recurring task is disabled, or stops functioning for any reason, logged-in users see the following error message when Swarm detects that no workers are running:

The error message that appears when there are no running workers.

curl/wget verification

The cron job depends on having curl or wget installed, as indicated in Runtime dependencies.

To verify that curl or wget is installed, use the which command. For example:

$ which curl

If you see any output, the referenced command is installed.