haproxy fails for an unknown reason at deployment but then the service gets restarted too quickly (without pause) and so it can't bind to port 80 so quickly again, because it's probably still bound from the previous process. At some point it exhausts the max number of attempts and the haproxy service remains in `failed` state.
haproxy.log:
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[5970]: [WARNING] 322/103900 (5970) : Exiting Master process...
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[5970]: [ALERT] 322/103900 (5970) : Current worker #1 (5971) exited with code 143 (Terminated)
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[5970]: [WARNING] 322/103900 (5970) : All workers exited. Exiting... (0)
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: Proxy stats started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: [ALERT] 322/103900 (7971) : Starting frontend tcp-in_cephradosgw-server: cannot bind socket [0.0.0.0:80]
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: [ALERT] 322/103900 (7971) : Starting frontend tcp-in_cephradosgw-server: cannot bind socket [:::80]
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: Proxy stats started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: Proxy cephradosgw-server_10.5.0.8 started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[7971]: Proxy cephradosgw-server_10.5.0.8 started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: Proxy stats started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: [ALERT] 322/103900 (8031) : Starting frontend tcp-in_cephradosgw-server: cannot bind socket [0.0.0.0:80]
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: [ALERT] 322/103900 (8031) : Starting frontend tcp-in_cephradosgw-server: cannot bind socket [:::80]
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: Proxy stats started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: Proxy cephradosgw-server_10.5.0.8 started.
Nov 18 10:39:00 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8031]: Proxy cephradosgw-server_10.5.0.8 started.
Nov 18 10:39:01 juju-4d3c7a-zaza-8607d9720117-3 haproxy[8081]: Proxy stats started.
...
Manually doing `sudo service haproxy restart` later works fine.
haproxy fails for an unknown reason at deployment but then the service gets restarted too quickly (without pause) and so it can't bind to port 80 so quickly again, because it's probably still bound from the previous process. At some point it exhausts the max number of attempts and the haproxy service remains in `failed` state.
haproxy.log:
Nov 18 10:39:00 juju-4d3c7a- zaza-8607d97201 17-3 haproxy[5970]: [WARNING] 322/103900 (5970) : Exiting Master process... zaza-8607d97201 17-3 haproxy[5970]: [ALERT] 322/103900 (5970) : Current worker #1 (5971) exited with code 143 (Terminated) zaza-8607d97201 17-3 haproxy[5970]: [WARNING] 322/103900 (5970) : All workers exited. Exiting... (0) zaza-8607d97201 17-3 haproxy[7971]: Proxy stats started. zaza-8607d97201 17-3 haproxy[7971]: [ALERT] 322/103900 (7971) : Starting frontend tcp-in_ cephradosgw- server: cannot bind socket [0.0.0.0:80] zaza-8607d97201 17-3 haproxy[7971]: [ALERT] 322/103900 (7971) : Starting frontend tcp-in_ cephradosgw- server: cannot bind socket [:::80] zaza-8607d97201 17-3 haproxy[7971]: Proxy stats started. zaza-8607d97201 17-3 haproxy[7971]: Proxy cephradosgw- server_ 10.5.0. 8 started. zaza-8607d97201 17-3 haproxy[7971]: Proxy cephradosgw- server_ 10.5.0. 8 started. zaza-8607d97201 17-3 haproxy[8031]: Proxy stats started. zaza-8607d97201 17-3 haproxy[8031]: [ALERT] 322/103900 (8031) : Starting frontend tcp-in_ cephradosgw- server: cannot bind socket [0.0.0.0:80] zaza-8607d97201 17-3 haproxy[8031]: [ALERT] 322/103900 (8031) : Starting frontend tcp-in_ cephradosgw- server: cannot bind socket [:::80] zaza-8607d97201 17-3 haproxy[8031]: Proxy stats started. zaza-8607d97201 17-3 haproxy[8031]: Proxy cephradosgw- server_ 10.5.0. 8 started. zaza-8607d97201 17-3 haproxy[8031]: Proxy cephradosgw- server_ 10.5.0. 8 started. zaza-8607d97201 17-3 haproxy[8081]: Proxy stats started.
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:00 juju-4d3c7a-
Nov 18 10:39:01 juju-4d3c7a-
...
Manually doing `sudo service haproxy restart` later works fine.