To ensure that incoming Helix Server 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.
You must install either curl or wget to run the recurring task that spawns the Swarm workers:
https://curl.haxx.se/download.html
For Windows, curl.exe
depends on MSVCR100.dll
. You can get a copy by installing the Microsoft Visual C++ Redistributable Package, available for:
If you install Swarm with HTTPS, curl.exe
requires recent CA certificates (or HTTPS connections silently fail). You can get a copy of the cacert.pem
from:
https://curl.haxx.se/docs/caextract.html
Once downloaded, copy cacert.pem
to the same folder where you installed curl.exe
, and rename it to curl-ca-bundle.crt
.
If curl
(or curl.exe
on Windows) cannot execute as expected, trigger execution may block or fail. For example, if MSVCR100.dll
is missing from a Windows system, invoking curl.exe
causes a dialog to appear.
Prior to configuring the triggers, verify that curl
executes. On Linux systems, run:
$ curl -h
On Windows systems, run:
C:\> curl.exe -h
The start of the output should be similar to:
Usage: curl [options...] <url> Options: (H) means HTTP/HTTPS only, (F) means FTP only --anyauth Pick "any" authentication method (H) -a, --append Append to target file when uploading (F/SFTP) --cacert FILE CA certificate to verify peer against (SSL) --capath DIR CA directory to verify peer against (SSL) ...[truncated for brevity]...
For a more thorough test that actually fetches content over a network, try the following test:
For Linux systems, run:
$ curl https://www.perforce.com/
For Windows systems, run:
C:\> curl.exe https://www.perforce.com/
The output should look like HTML.
http://gnuwin32.sourceforge.net/packages/wget.htm (for Windows)
If you are using Powershell on Windows systems, be aware that Powershell includes aliases for curl
and wget
that call the Powershell command Invoke-WebRequest
instead of curl.exe
or wget.exe
. Invoke-WebRequest
has different command-line options than either curl
or wget
, which can be confusing.
If you want to remove the built-in aliases for curl
and wget
from Powershell, follow these steps:
Create a Powershell profile (only if you have not already done so):
PS C:\> New-Item $profile -force -itemtype file
Edit your profile:
PS C:\> notepad $profile
Add the following line to your profile:
remove-item alias:curl
remove-item alias:wget
notepad
.Reload your profile:
PS C:\> . $profile
curl
or wget
must be installed or workers do not spawn and Swarm cannot process any events.
Verify that curl or wget is installed:
which
command. For example to verify that curl is installed:
$ which curl
If you see any output, the referenced command is installed.
Swarm package installation and Swarm OVA installation:
swarm-cron-hosts.conf
, and swarm-cron.sh files are automatically created with the correct content including the correct URL for Swarm. They do not need to be edited. The swarm-cron.sh file in /opt/perforce/swarm/p4-bin/scripts ensures that a worker is fired up every minute.
By default, the DEFAULT_CONFIG_FILE= configuration line is set to /opt/perforce/etc/swarm-cron-hosts.conf. The swarm-cron.sh script takes the Swarm hostname from the swarm-cron-hosts.conf file.
The swarm-cron.sh script contains the correct content for Swarm installations using wget, or curl.
You must leave the wget, and curl configuration lines in the script. The script is written so that it can be used with Swarm installations that use wget, and Swarm installations that use curl. The wget configuration line is tried first, if that fails the curl configuration line is tried.
wget
configuration line for HTTP, and HTTPS:
wget --quiet --no-check-certificate --output-document /dev/null --timeout 5 "${SWARM_HOST}/queue/worker"
curl
configuration line for HTTP, and HTTPS:
curl --silent --insecure --output /dev/null --max-time 5 "${SWARM_HOST}/queue/worker"
In the wget and curl configuration lines above, where you see --timeout 5
or --max-time 5
, 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
second (e.g. --timeout 1
or --max-time 1
).
If you configure Swarm to use HTTPS, and you install a self-signed certificate, the cron jobs avoid the certificate validity test which could cause silent failures to process events. The command to avoid the certificate validity test is included by default for wget, and curl:
If you have configured an HTTP connection to Swarm, the avoid validity check command is ignored.
The swarm-cron-hosts.conf file in /opt/perforce/etc
specifies the connection type (HTTP or HTTPS), hostname, and port number for Swarm cron jobs.
swarm-cron-hosts.conf
file so that is contains the actual Swarm hostname, and port you have configured for Swarm (which may include a sub-folder or a custom port). The following format is used: [http[s]://]<swarm-host>[:<port>]
Default if value not specified:
To check or modify Swarm worker configuration, see Workers.
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: