Web Services Deployment with Arnica Autopilot

March 2, 2024 by Igor Lozhkin
Arnica Autopilot is a web services management and monitoring component, which is usually installed on each computing node. 

Autopilot continuously checks operating system and specified web services runtime metrics and performs various configured actions when certain events happen. Examples are:
  • monitoring system CPU and memory utilization
  • monitoring specified processes CPU and memory utilization
  • monitoring free disk space on each disk
  • checking runtime state of specified services
  • automatically starting or restarting specified services
  • sending email notification to recipients, configurable per service
  • checking if a new version of web service is available and deploys it  
This article describes how Autopilot deploys new versions of web services.

In the previous blog article "Arnica Performance Platform Web Services Deployment Structure," we described folder structures of Arnica web services. In this structure, the following folders are relevant to the deployment of a new web service version - backup and staging folders.

c:\
Arnica
WebServices
Web Service 1
......
backup - backups of previous versions of web service executable file
staging - current version of the web service executable file which will be deployed in the root folder
......

Autopilot scans staging folder every N number of seconds specified by configuration key:

[auto_pilot]
scan_interval = 5

When a web service executable is found in staging folder, its version and last update date are compared against the currently running  web service executable file. If the version is newer or if the date is newer when version is 0.0.0.0, then Autopilot performs the following actions:

1. run shutdown web service or executable, for example to flush data changes to disk. The following key defines service/executable to run:

[service=web service1]
shutdown_uri=http://127.0.0.1:9999/app/shutdown/
shutdown_cmd=c:\arnica\webservices\service1\file.exe param1 param2

2. identify running executable process using the following keys in order to shut it down:

[service=web service1]
match_file_name=c:\arnica\webservices\webservice1\file1.exe
match_process_name=file1

3. shut down running process

4. deploy current version of executable file from the root folder to the backup folder

5. deploy new version of the executable file from the staging folder to the root folder

6. validate deployment and repeat it N times when needed, as defined by keys with specified interval in milliseconds:

[auto_pilot]
[[deployment]]
retry_count = 5
retry_interval = 100

7. start process by running executable identified by the key:

[service=web service1]
start_file_name=c:\arnica\webservices\webservice1\file1.exe

8. send notification, if specified in configuration file


After deployment, the process is continuously monitored and can be automatically restarted if Autopilot detects that the service is down.