Discourse not starting up: nginx: unable to open supervise/ok: file does not exist

AI-generated summary

The discussion revolves around a Discourse self-hosting issue where the application fails to start on Ubuntu 16.04, specifically due to an error: nginx: unable to open supervise/ok: file does not exist. The user, Pingless, is running Discourse with Let’s Encrypt behind an Apache proxy, which seems to trigger the reload error during the startup process. They initially sought help after trying ./launcher rebuild app and following the standard Let’s Encrypt setup guide without success.

In response, Falco suggests that the standard Let’s Encrypt template may not function correctly when Discourse is placed behind a proxy, noting that SSL termination is typically handled by the outer web server. Following this advice, Pingless resolved the issue by shifting the Let’s Encrypt logic to run directly on Apache, bypassing the internal Discourse Let’s Encrypt script. Finally, gingerman asks for clarification on how to configure Apache Let’s Encrypt within a Docker container while ensuring SSL configurations persist through rebuilds.

I’m trying to run Discourse with Let’s Encrypt behind an Apache Proxy on Ubuntu 16.04.
When I start up the application, nobody is listening on the correct port (I’ve mapped it to 12080/12443 in the app.yml), and the logs show the following error:

Cleaning stale PID files
run-parts: executing /etc/runit/1.d/copy-env
run-parts: executing /etc/runit/1.d/enable-brotli
run-parts: executing /etc/runit/1.d/letsencrypt
[Fri Dec  2 17:57:12 UTC 2016] Skip, Next renewal time is: Mon Feb 20 16:36:38 UTC 2017
[Fri Dec  2 17:57:12 UTC 2016] Add '--force' to force to renew.
[Fri Dec  2 17:57:12 UTC 2016] Installing key to:/shared/ssl/discourse.mydomain.com.key
[Fri Dec  2 17:57:12 UTC 2016] Installing full chain to:/shared/ssl/discourse.mydomain.com.cer
[Fri Dec  2 17:57:12 UTC 2016] Run Le_ReloadCmd: sv reload nginx
warning: nginx: unable to open supervise/ok: file does not exist
[Fri Dec  2 17:57:12 UTC 2016] Reload error for :discourse.mydomain.com
Started runsvdir, PID is 135
ok: run: redis: (pid 143) 0s
ok: run: postgres: (pid 145) 0s
sh: echo: I/O error

(To clarify: I’ve replaced my FQDN with “discourse.mydomain.com” in these logs.)

This Reload Error appears to be preventing discourse from starting up properly. I’ve had a look but all references to “unable to open supervise/ok” appear to be a fixed bug in runit.

Things I’ve tried:

Has anyone encountered this error, and/or does anyone know how to resolve it?

Thanks,
Pingless

I don’t think our Let’s Encrypt template works when behind a proxy.

Usually the last web server handles SSL termination / certificates / etc.

All right, I’ve resolved it by not doing that. Instead Apache now handles the LetsEncrypt logic.
Maybe the LetsEncrypt guide could mention this?

@Pingless Can you explain how you accomplished apache letencrypt configuration within docker container ? How do you ensure the ssl config remains during the rebuild ?