Issue running Phoenix as a windows service: :server was not enabled for MyApp.Endpoint, http/https services won't start

I’ve followed the Introduction to Deployment — Phoenix v1.7.14 guide but I’ve run into an issue on windows.

When I run the service calling the ‘server’ overlay via cmd, the endpoint runs up fine.

However when I run it as a service, after running my_app install I get the following

Configuration :server was not enabled for MyApp.Endpoint, http/https services won't start

How can I make the service created with my_app install point to my overlay?

Thanks in advance!

In prod.exs, I set the server: true option on the endpoint. e.g.

config :myapp, MyappWeb.Endpoint,
  cache_static_manifest: "priv/static/cache_manifest.json",
  server: true

Note, you’re going to need to change the service to Delayed, using sc.exe or PowerShell, after you’ve added it. Otherwise it won’t start on reboot. There’s an open issue on OTP repo and someone posted their workaround script on the forum a little while ago.

2 Likes