Page:
Daemonizing The Server
1
Daemonizing The Server
Skylar Grant edited this page 2025-01-06 18:35:10 -05:00
Table of Contents
Daemonizing The Server
This page will walk you through the general steps of setting up the server as a daemon/service in Windows (Linux coming later).
Windows
Currently the server does not support running as a service in Windows. However, you can use a third-party tool like NSSM (Non-Sucking Service Manager) to instantiate a service. Here are the steps to do so:
- Download the latest version of NSSM from here
- Extract the downloaded zip file and navigate to the extracted folder (herein
.\nssm
) - Open a command prompt with administrative privileges and navigate to
.\nssm\win64
- Run the following command to open the NSSM service installation GUI:
nssm install
- On the Application tab, set the following options:
- Path:
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe
- Startup directory:
C:\path\to\nsfw_ai_model_server
- Arguments:
-ExecutionPolicy ByPass -NoExit -Command "& '<MINICONDA3_DIR>\shell\condabin\conda-hook.ps1'; conda activate '<MINICONDA3_DIR>'; start.ps1"
- Change
<MINICONDA3_DIR>
to the path of your Miniconda3 installation directory (e.g.C:\Users\username\miniconda3
)
- Service name:
AI Tagger Server
(or any other name you prefer)
- Path:
- Optionally set the following options under the I/O Tab for logging:
- Output file:
C:\path\to\nsfw_ai_model_server\logs\stdout.log
- Error file:
C:\path\to\nsfw_ai_model_server\logs\stderr.log
- Output file:
- Click on the Install service button
- A diaglog box will confirm that the service has been installed. Click OK
- Open the Services application by pressing
Win + R
and typingservices.msc
- Locate the service named
AI Tagger Server
(or the name you specified) and start it - The AI Tagger server should now be running as a service
Uninstalling the service
To uninstall the service, follow these steps:
- Open a command prompt with administrative privileges and navigate to
.\nssm\win64
- Run the following command:
nssm remove "AI Tagger Server"
- The service should now be uninstalled