Run the service
On application startup, the Ruby agent starts a service in a separate process. This process is responsible for aggregating messages from the agent, sending attack information to Contrast and receiving updates to settings from Contrast.
The agent is packaged with 64-bit Mac and Linux services. Because the service is launched by the agent, it has access to the same configuration file that the agent used. If the service process is stopped, the agent will attempt to restart it.
In the unlikely event that the restart process fails, the agent will cease trying to restart the service after five attempts, and won't send findings to Contrast. However, the agent will continue to protect the application using the last settings it received.
You can access the service status using rake tasks:
rake contrast:service:status
: Returnsonline
oroffline
.rake contrast:service:start
: Attempts to start the service using the configuration for the local Ruby agent.rake contrast:service:stop
: Attempts to stop the service. If the agent receives additional requests, it will attempt to restart the service on its own.
Tip
Ensure that the service host and port values are consistent.
If there are multiple applications protected by the Ruby agent, the first one to start will launch the service. This is not a problem since the service is designed to handle communication with multiple agents.
But, if the agent.service.host
and agent.service.port
configuration values don't match, the additional agent won't be able to communicate with the previously started service.