Skip to content
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

core: Windows service integration #4790

Merged
merged 7 commits into from
Jul 29, 2022

Conversation

WingLim
Copy link
Contributor

@WingLim WingLim commented May 17, 2022

Implement a svc.Handler and run it in init function, so that caddy can use sc.exe to manage a windows service.

With this PR, we can add service like this:

  1. create
sc.exe create caddy start= auto binPath= "YOURPATH\caddy.exe run"
  1. start
sc.exe start caddy
  1. stop
sc.exe stop caddy

TODO:

Resolve #4670

@CLAassistant
Copy link

CLAassistant commented May 17, 2022

CLA assistant check
All committers have signed the CLA.

@mholt
Copy link
Member

mholt commented May 25, 2022

Interesting, will take a look at this. Thanks!

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this took me so long to get to. This actually looks really good. But do you think we could move service_windows.go into notify_windows.go? Maybe I'm missing something but since it runs from init(), it doesn't seem super relevant to have it in a separate package and file.

@mholt
Copy link
Member

mholt commented Jul 6, 2022

@WingLim Are you still interested in finishing this PR?

@mholt mholt added this to the v2.6.0 milestone Jul 25, 2022
We haven't supported Go 1.16- for a long time now, so remove
old-style `// +build` tags.

Also remove unnecessary pragmas that are already specified in filenames.
@mholt
Copy link
Member

mholt commented Jul 25, 2022

@WingLim Oh, I see the difficulty of moving the files like I asked. I just went ahead and cleaned up the build tags/pragmas instead and I think we'll merge this. Thanks!

@mholt mholt changed the title Add windows service core: Windows service integration Jul 29, 2022
@mholt mholt merged commit 1e0cdc5 into caddyserver:master Jul 29, 2022
@francislavoie francislavoie modified the milestones: v2.6.0, v2.6.0-beta.1 Aug 21, 2022
@mholt mholt modified the milestones: v2.6.0-beta.1, v2.6.0 Sep 13, 2022
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.

Minimal windows service stub
4 participants