Skip to content

Add ability to build the server for Windows and run it as a service #1328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wtf911
Copy link

@wtf911 wtf911 commented May 5, 2025

No description provided.

@wtf911
Copy link
Author

wtf911 commented May 5, 2025

Closes #1104

Example service creation command:

sc.exe create ntfy start= auto binPath= "YOURPATH\ntfy.exe serve"

To use a server.yml file you would create the service like this:

sc.exe create ntfy start= auto binPath= "YOURPATH\ntfy.exe serve --config YOURPATH\server.yml"
@wtf911 wtf911 changed the title Added the ability to build the server for Windows Add ability to build the server for Windows and run it as a service May 7, 2025
@wtf911
Copy link
Author

wtf911 commented May 7, 2025

Example service creation command:

sc.exe create ntfy start= auto binPath= "YOURPATH\ntfy.exe serve"

To use a server.yml file you would create the service like this:

sc.exe create ntfy start= auto binPath= "YOURPATH\ntfy.exe serve --config YOURPATH\server.yml"

@binwiederhier
Copy link
Owner

I really don't want to support ntfy server on Windows. It may build, but it will likely not work for all the things. And I have no time to test it. So while this is pretty cool that it works, I must respectfully decline the PR.

@wtf911
Copy link
Author

wtf911 commented May 22, 2025

Does it make a difference that I've been successfully running it 24/7 as a Windows service using a lot of the features without any issue? I'm using a reverse-proxy so it has HTTPS and I have webpush working great to the PWA on Android. Here's my active server.yml so we know that at least these settings are functional:

base-url: "https://ntfy.xxx.ddnsfree.com"
cache-file: "C:/Users/user/Downloads/ntfy/cache.db"
attachment-cache-dir: "C:/Users/user/Downloads/ntfy/attachments"
behind-proxy: true
listen-http: :82
attachment-expiry-duration: 24h
auth-file: "C:/Users/user/Downloads/ntfy/user.db"
auth-default-access: "deny-all"
web-push-public-key: BL4ZP2O2P7aYvwGODu8Hxxxxxxxxx1PpuDdvqYxtuW0vOw_NBPGdz-6qqTG1kpwNhnQkcJxxxxxxxxDKDB9oNeASezkWN0
web-push-private-key: w7_W1r2-DQOmmxxxxxxxx3MmNWl3HDs1_Ve7lq2E
web-push-file: "C:/Users/user/Downloads/ntfy/webpush.db"
web-push-email-address: user@gmail.com
visitor-attachment-total-size-limit: 500M
visitor-attachment-daily-bandwidth-limit: 1000M

It created all the needed files no problem and runs no problem. I point to the server.yml file by using the --config option. I made the pull request so that the build code mirrors your current code and just the resulting ntfy.exe would include the added server functionality so it wouldn't be any additional work on your end to include it in releases.

@binwiederhier binwiederhier reopened this May 24, 2025
@binwiederhier
Copy link
Owner

I think that does make a difference;-)

I'll just add a disclaimer saying that idk if it's gonna work, and redirect all issues to you hehe

@binwiederhier
Copy link
Owner

Can you try to add the Windows CI pipelines, and add it to the docs? That'd help

@wtf911
Copy link
Author

wtf911 commented May 27, 2025

Can you try to add the Windows CI pipelines, and add it to the docs? That'd help

I'm sorry, my coding isn't at the level of even knowing where to begin to add that I don't think, but if there's anything else I can do to help this get approved and open up people on Windows being able to run the server please let me know. :)

From a build perspective, the only other thing that needs to be installed on Linux for compiling it is: apt install gcc-mingw-w64-x86-64

That's the only difference. I compiled it from Linux using your standard Linux build environment that you build all of the other versions from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants