Windows server support
This commit is contained in:
@@ -1060,6 +1060,84 @@ or the root domain:
|
||||
}
|
||||
```
|
||||
|
||||
## Windows service
|
||||
ntfy can run as a Windows service, allowing it to start automatically on boot and run in the background.
|
||||
ntfy automatically detects when it is running as a Windows service and adjusts its behavior accordingly.
|
||||
|
||||
### Installing the service
|
||||
To install ntfy as a Windows service, open an **Administrator** command prompt or PowerShell and run:
|
||||
|
||||
```cmd
|
||||
sc create ntfy binPath= "C:\path\to\ntfy.exe serve" start= auto
|
||||
```
|
||||
|
||||
!!! note
|
||||
Make sure to replace `C:\path\to\ntfy.exe` with the actual path to your ntfy executable.
|
||||
The spaces after `binPath=` and `start=` are required.
|
||||
|
||||
You can also specify a config file:
|
||||
|
||||
```cmd
|
||||
sc create ntfy binPath= "C:\path\to\ntfy.exe serve --config C:\ProgramData\ntfy\server.yml" start= auto
|
||||
```
|
||||
|
||||
### Starting and stopping
|
||||
To start the service:
|
||||
|
||||
```cmd
|
||||
sc start ntfy
|
||||
```
|
||||
|
||||
To stop the service:
|
||||
|
||||
```cmd
|
||||
sc stop ntfy
|
||||
```
|
||||
|
||||
To check the service status:
|
||||
|
||||
```cmd
|
||||
sc query ntfy
|
||||
```
|
||||
|
||||
### Configuring the service
|
||||
The default configuration file location on Windows is `%ProgramData%\ntfy\server.yml` (typically `C:\ProgramData\ntfy\server.yml`).
|
||||
Create this directory and file manually if needed.
|
||||
|
||||
Example minimal config:
|
||||
|
||||
```yaml
|
||||
base-url: "https://ntfy.example.com"
|
||||
listen-http: ":80"
|
||||
cache-file: "C:\\ProgramData\\ntfy\\cache.db"
|
||||
auth-file: "C:\\ProgramData\\ntfy\\auth.db"
|
||||
```
|
||||
|
||||
!!! warning
|
||||
Use double backslashes (`\\`) for paths in YAML files on Windows, or use forward slashes (`/`).
|
||||
|
||||
### Viewing logs
|
||||
By default, ntfy logs to stderr. When running as a Windows service, you can configure logging to a file:
|
||||
|
||||
```yaml
|
||||
log-file: "C:\\ProgramData\\ntfy\\ntfy.log"
|
||||
log-level: info
|
||||
```
|
||||
|
||||
### Removing the service
|
||||
To remove the ntfy service:
|
||||
|
||||
```cmd
|
||||
sc stop ntfy
|
||||
sc delete ntfy
|
||||
```
|
||||
|
||||
### Limitations on Windows
|
||||
When running on Windows, the following features are not available:
|
||||
|
||||
- **Unix socket listening**: The `listen-unix` option is not supported on Windows
|
||||
- **Config hot-reload**: The SIGHUP signal for hot-reloading configuration is not available on Windows; restart the service to apply config changes
|
||||
|
||||
## Firebase (FCM)
|
||||
!!! info
|
||||
Using Firebase is **optional** and only works if you modify and [build your own Android .apk](develop.md#android-app).
|
||||
|
||||
@@ -228,20 +228,39 @@ brew install ntfy
|
||||
```
|
||||
|
||||
## Windows
|
||||
The [ntfy CLI](subscribe/cli.md) (`ntfy publish` and `ntfy subscribe` only) is supported on Windows as well.
|
||||
The ntfy server and CLI are fully supported on Windows. You can run the ntfy server directly or as a Windows service.
|
||||
|
||||
To install, please [download the latest ZIP](https://github.com/binwiederhier/ntfy/releases/download/v2.15.0/ntfy_2.15.0_windows_amd64.zip),
|
||||
extract it and place the `ntfy.exe` binary somewhere in your `%Path%`.
|
||||
|
||||
The default path for the client config file is at `%AppData%\ntfy\client.yml` (not created automatically, sample in the ZIP file).
|
||||
|
||||
Also available in [Scoop's](https://scoop.sh) Main repository:
|
||||
|
||||
`scoop install ntfy`
|
||||
|
||||
### Running the server
|
||||
To run the ntfy server directly:
|
||||
```
|
||||
ntfy serve
|
||||
```
|
||||
|
||||
The default configuration file location on Windows is `%ProgramData%\ntfy\server.yml` (e.g., `C:\ProgramData\ntfy\server.yml`).
|
||||
You may need to create the directory and config file manually.
|
||||
|
||||
For information on running ntfy as a Windows service, see the [Windows service](config.md#windows-service) section in the configuration documentation.
|
||||
|
||||
### Client configuration
|
||||
The default path for the client config file is at `%AppData%\ntfy\client.yml` (not created automatically, sample in the ZIP file).
|
||||
|
||||
!!! info
|
||||
There is currently no installer for Windows, and the binary is not signed. If this is desired, please create a
|
||||
[GitHub issue](https://github.com/binwiederhier/ntfy/issues) to let me know.
|
||||
|
||||
!!! note
|
||||
Some features are not available on Windows:
|
||||
|
||||
- Unix socket listening (`listen-unix`) is not supported
|
||||
- Config hot-reload via SIGHUP is not available; restart the service to apply config changes
|
||||
|
||||
## Docker
|
||||
The [ntfy image](https://hub.docker.com/r/binwiederhier/ntfy) is available for amd64, armv6, armv7 and arm64. It should
|
||||
be pretty straight forward to use.
|
||||
|
||||
Reference in New Issue
Block a user