Setting up RADKit Service as a Windows service
Read this first !
RADKit Service can be set up as a Windows service regardless of the installation method, i.e.
even if you have performed a pip
installation. The steps to do so are described on this page.
Also, since RADKit 1.7.0, the Windows installer offers the option to set up RADKit Service as a Windows service during installation. No extra manual steps are involved, as long as it is a fresh installation (i.e. either RADKit Service is currently not installed on the host, or it is neither bootstrapped nor configured). This is because the data files for the Windows service are stored in a different, non-user-specific location.
If you want to turn a previously bootstrapped and/or configured RADKit Service into a
Windows service, please do NOT do so using the installer; instead, perform the manual procedure
described on this page and point the --radkit-directory
option to the appropriate path.
Manual setup
Warning
Make sure to use “Run as Administrator” while opening the terminal in the steps below. Registration of new services and writing to the Windows Registry requires elevated privileges.
If you used pip
, just open a terminal (e.g. PowerShell) and activate the appropriate Python
environment. If you used the Windows installer, open a terminal (and possibly cd
into the
bin
directory for your RADKit installation; see Directory layout for details).
Then, run the command:
radkit-service.exe windows-service install
This command will create a Windows service entry for RADKit Service with default options and
store a few essential parameters inside the Windows Registry. If any additional settings are
provided through the CLI, those will be stored in settings.toml
under the RADKit (data)
directory, as explained in the next sections. Read on if you want to learn more about customization.
RADKit directory
The RADKit directory is where all the data files are stored, separate from the program
files. By default, during installation as a Windows service it is created in the “All Users”
profile, which will usually resolve to C:\ProgramData\Cisco\RADKit
.
This directory can be changed during installation by passing the --radkit-directory
option. If you wish to determine the location of the “All Users” profile on your machine
before the installation, open a PowerShell window and run:
C:\> $env:ALLUSERSPROFILE
Warning
You must use the --radkit-directory
option if you want to turn a previously
bootstrapped and/or configured RADKit Service into a Windows service while keeping your
existing data or configuration files.
Supposing we have a bootstrapped RADKit service under C:\Users\YOURUSER\.radkit
, one can
set up the Windows service by executing:
radkit-service.exe --radkit-directory "C:\Users\YOURUSER\.radkit" windows-service install
At this point the user will either be prompted for the superadmin
password, or they can provide
the credentials by any means described in Storing the superadmin password.
Installation options
The radkit-service.exe windows-service install
CLI command allows the user to define the
startup mode of the service via the --startup-mode
option (default: AUTO
, other
allowed values: MANUAL
, DELAYED
, DISABLED
).
Furthermore, it supports some of the options available to radkit-service.exe
, namely:
--domain
--radkit-directory
--settings-file
--setting
Note that --startup-mode
has to be added after the install
keyword, but the other
options listed above have to be added before the windows-service
keyword as those are
general options of the radkit-service
command. If this is confusing, please refer to
radkit-service.exe --help
and radkit-service.exe windows-service install --help
for
usage details.
When installed as a Windows service, the configuration settings for RADKit Service should
be stored in a settings TOML file. The user can provide the absolute path to a pre-existing TOML
file via the --settings-file
option, else the default is service\settings.toml
in the
RADKit Directory. All configuration options added through --setting
during installation
will be persisted in the settings file, for example:
- Setting a custom port for the the WebUI:
radkit-service.exe --setting service.ui.port_https 8888 windows-service install
- Setting a different RADKit directory:
radkit-service.exe --radkit-directory "C:\Users\YOURUSER\.radkit" windows-service install
- Using a custom settings TOML file:
radkit-service.exe --settings-file "C:\Users\YOURUSER\my-settings.toml" windows-service install
Warning
Even when running as a Windows service, RADKit Service will still consider settings
found in environment variables (see Settings management), which have precedence
over TOML settings. When running RADKit as a Windows service, it is highly recommended
to clear any RADKIT_...
variables from the system environment.
Starting the service
After installation, the service can be started in a number of different ways:
through the CLI by executing
radkit-service.exe windows-service start
;through the
services.msc
graphical interface by pressing “Win+R” and typingservices.msc
, then locating “Cisco RADKit Service” and starting it;by rebooting the machine, if the default
AUTO
startup mode was selected during the installation;by any other Windows-specific means (eg. through Task Manager or using the
Start-Service
PowerShell command).
Stopping the service
The service can be stopped by any methods that apply to a Windows service, as well as a dedicated CLI command:
through the CLI by executing
radkit-service.exe windows-service stop
;through the
services.msc
graphical interface by pressing “Win+R” and typingservices.msc
, then locating “Cisco RADKit Service” and stopping it;by any other Windows-specific means (eg. through Task Manager or using the
Stop-Service
PowerShell command).
Removing the service
The service should first be stopped (see above), then it can be removed by executing
radkit-service.exe windows-service remove
. This will unregister the service, as well as
remove corresponding entries inside the Windows Registry. However, this will leave the data
written to the disk intact so any information stored by RADKit Service can be retrieved.
To completely remove the data written by RADKit Service, remove the RADKit directory manually.
Danger
Please be advised that removal of the RADKit directory may lead to irreversible data loss, so proceed with caution, as this will erase all the information stored by RADKit Service.