Refactor #11323
closedRefactor PID writing, interrupt trap and daemon logging
Description
Currently, our deamonizing works as follows:
- initialize configuration, logger and plugins
- create http/https rack servers
- daemonize the main process
- start rack servers in own threads (each writes own pid file into same file)
- wait five seconds
- override interrupt signal trap
- wait for both threads to finish
Problems:
- Rack writes main process pid twice (the main process should do this on its own)
- pid file is written AFTER the main process exited (this is causing irregular warnings with systemd "not readable (yet?) after start")
- we should get rid of the 5 seconds sleep (what is this needed for)?
- when logging is setup to STDOUT it does not work (we need to error out when STDOUT is set and provide a way to configure foreman-proxy with syslog properly)