Run openBalena simultaneously with Apache

Hi, I am currently testing out openBalena for our project and was wondering if it can be run with an apache installation on the same host. When I start the docker container I get the following error message for ha_proxy:

ERROR: for openbalena_haproxy_1  Cannot start service haproxy: driver failed programming external connectivity on endpoint openbalena_haproxy_1 (2466a1839d2dcc7d4a851c4a6afc8694e8601d174a0a3e28c9f621c5f5c80c55): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use

ERROR: for haproxy  Cannot start service haproxy: driver failed programming external connectivity on endpoint openbalena_haproxy_1 (2466a1839d2dcc7d4a851c4a6afc8694e8601d174a0a3e28c9f621c5f5c80c55): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use
ERROR: Encountered errors while bringing up the project.

Which is obvious, as the apache service is already bound to port 80 and 443.
Probably, I need to bring my websites into docker containers to run them with openBalena. I’ve seen that there is a possibility with nginx-proxy or something like that. However, I am completely new to the docker and openBalena world and would be pleased, if somebody could provide me with some straight-forward information before I end up off the track. ;))

Many thanks in advance!
Pievee

Hi there, openBalena assumes ports 80 and 443 are free to be used to route requests. We run haproxy inside the stack to listen on these ports and route requests to other sub-services.

You could put nginx on top of all of this and use higher level hostheader/sni routing to direct some traffic to OB and some to Apache, but you are going to have to reimplement the same routing logic we use to differentiate between HTTPS on port 443 and OpenVPN on the same.

I would suggest keeping Apache and OB on either separate hosts or at least on the same host, but bound to two separate public/private IPs.

Hi ab77, thank you for your inputs!
I also thought about creating some Apache containers and adding them to the openBalena haproxy configuration. However, I assume this is not recommended as it will break on each update and is, in fact, not really a service, part of the openBalena project. For now, I will stick to the solution with 2 IPs. I haven’t implemented this yet, but it shouldn’t be much of a problem.