Can't change lighttpd's port for HaProxy reverse proxy Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
Joulinar
Posts: 2037
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Joulinar »

yes that would be possible to create a wildcard certificate using cerbot. However you need to be able to mange your DynDNS record and add a TXT record under the name _acme-challenge. There are a couple of guides on the web how this could be archived.

https://community.letsencrypt.org/t/wil ... ep/58250/4

I guess renewing the certificate might be a challenge as well as you would need to update DynDNS record again.

It might be easier to have a look into capabilities to use lighttpd as reverse-proxy
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Rilic
Posts: 42
Joined: Thu May 07, 2020 4:14 pm

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Rilic »

OK, so after learning a few things I realised that HaProxy isn't launching because it doesn't see the binary??

Code: Select all

root@Ouroboros:~# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/etc/systemd/system/haproxy.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-06-09 09:07:28 BST; 15s ago
  Process: 1175 ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=203/EXEC)

Jun 09 09:07:27 Ouroboros systemd[1175]: haproxy.service: Failed at step EXEC spawning /usr/local/sbin/haproxy: No such file or directory
Jun 09 09:07:27 Ouroboros systemd[1]: haproxy.service: Control process exited, code=exited, status=203/EXEC
Jun 09 09:07:27 Ouroboros systemd[1]: haproxy.service: Failed with result 'exit-code'.
Jun 09 09:07:27 Ouroboros systemd[1]: Failed to start HAProxy Load Balancer.
Jun 09 09:07:28 Ouroboros systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Jun 09 09:07:28 Ouroboros systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Jun 09 09:07:28 Ouroboros systemd[1]: Stopped HAProxy Load Balancer.
Jun 09 09:07:28 Ouroboros systemd[1]: haproxy.service: Start request repeated too quickly.
Jun 09 09:07:28 Ouroboros systemd[1]: haproxy.service: Failed with result 'exit-code'.
Jun 09 09:07:28 Ouroboros systemd[1]: Failed to start HAProxy Load Balancer.
I'm sure this isn't meant to happen, right?
User avatar
Joulinar
Posts: 2037
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Joulinar »

did you reinstall HaProxy using dietpi-software after you deleted it?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Rilic
Posts: 42
Joined: Thu May 07, 2020 4:14 pm

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Rilic »

Yeah, I did. Would the binary be in a different place, or?
User avatar
Joulinar
Posts: 2037
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Joulinar »

can you run dietpi-software reinstall 98
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Rilic
Posts: 42
Joined: Thu May 07, 2020 4:14 pm

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Rilic »

Reinstalling it returns the same problem:

Code: Select all

root@Ouroboros:~# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/etc/systemd/system/haproxy.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-06-09 12:39:07 BST; 3min 37s ago
  Process: 5039 ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=203/EXEC)

Jun 09 12:39:07 Ouroboros systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Jun 09 12:39:07 Ouroboros systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Jun 09 12:39:07 Ouroboros systemd[1]: Stopped HAProxy Load Balancer.
Jun 09 12:39:07 Ouroboros systemd[1]: haproxy.service: Start request repeated too quickly.
Jun 09 12:39:07 Ouroboros systemd[1]: haproxy.service: Failed with result 'exit-code'.
Jun 09 12:39:07 Ouroboros systemd[1]: Failed to start HAProxy Load Balancer.
User avatar
Joulinar
Posts: 2037
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Joulinar »

well the error messag changed. You did not get the following anymore

Code: Select all

haproxy.service: Failed at step EXEC spawning /usr/local/sbin/haproxy: No such file or directory
probably you have an incorrect or not consistent config file that prevent HaProxy to start
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Rilic
Posts: 42
Joined: Thu May 07, 2020 4:14 pm

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Rilic »

Found this page to help validate haproxy.cfg: https://stackoverflow.com/questions/396 ... aproxy-cfg

I followed the instructions but the commands couldn't find the haproxy binary. I tried restarting the service again but it gave me the file not found error:

Code: Select all

● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/etc/systemd/system/haproxy.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-06-09 12:58:26 BST; 5s ago
  Process: 1009 ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=203/EXEC)

Jun 09 12:58:25 Ouroboros systemd[1009]: haproxy.service: Failed at step EXEC spawning /usr/local/sbin/haproxy: No such file or directory
Jun 09 12:58:25 Ouroboros systemd[1]: haproxy.service: Control process exited, code=exited, status=203/EXEC
Jun 09 12:58:25 Ouroboros systemd[1]: haproxy.service: Failed with result 'exit-code'.
Jun 09 12:58:25 Ouroboros systemd[1]: Failed to start HAProxy Load Balancer.
Jun 09 12:58:26 Ouroboros systemd[1]: haproxy.service: Service RestartSec=100ms expired, scheduling restart.
Jun 09 12:58:26 Ouroboros systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Jun 09 12:58:26 Ouroboros systemd[1]: Stopped HAProxy Load Balancer.
Jun 09 12:58:26 Ouroboros systemd[1]: haproxy.service: Start request repeated too quickly.
Jun 09 12:58:26 Ouroboros systemd[1]: haproxy.service: Failed with result 'exit-code'.
Jun 09 12:58:26 Ouroboros systemd[1]: Failed to start HAProxy Load Balancer.
Is something deleting it?
User avatar
Joulinar
Posts: 2037
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Joulinar »

ok I had a look to the installation process and it seems some issues with the current one. At least for me it's giving the following error

Code: Select all

make: *** [Makefile:857: haproxy] Error 1
strip: 'haproxy': No such file
Please run 'make' before 'make install'.
make: *** [Makefile:899: install-bin] Error 1
the software is compiled during installation and this did not finished. Therefore haproxy is not created and missing. Anyway I found that there is a newer version of haproxy availably than installed by DietPi. To get this version you would need to update one of the DietPi scripts. As this is a huge script, I recommend to use the search function inside the code.

Code: Select all

nano /boot/dietpi/dietpi-software
Go-to line 4276 and adjust version='2.1.7'. Once done, safe the file and reinstall haproxy

Code: Select all

dietpi-software reinstall 98
On my system, installation finished without error now
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
Rilic
Posts: 42
Joined: Thu May 07, 2020 4:14 pm

Re: Can't change lighttpd's port for HaProxy reverse proxy

Post by Rilic »

It's using the new file now:

Code: Select all

[  OK  ] DietPi-Software | Checking URL: https://www.haproxy.org/download/2.1/src/haproxy-2.1.7.tar.gz
Upon installing, it seems like it removes a lot of files:

Code: Select all

  CC      ebtree/ebmbtree.o
  CC      ebtree/ebsttree.o
  CC      ebtree/ebimtree.o
  CC      ebtree/ebistree.o
  LD      haproxy
removed '/usr/local/sbin/haproxy'
'haproxy' -> '/usr/local/sbin/haproxy'
removed '/usr/local/share/man/man1/haproxy.1'
'doc/haproxy.1' -> '/usr/local/share/man/man1/haproxy.1'
removed '/usr/local/doc/haproxy/configuration.txt'
'doc/configuration.txt' -> '/usr/local/doc/haproxy/configuration.txt'
removed '/usr/local/doc/haproxy/management.txt'
'doc/management.txt' -> '/usr/local/doc/haproxy/management.txt'
removed '/usr/local/doc/haproxy/proxy-protocol.txt'
'doc/proxy-protocol.txt' -> '/usr/local/doc/haproxy/proxy-protocol.txt'
removed '/usr/local/doc/haproxy/seamless_reload.txt'
'doc/seamless_reload.txt' -> '/usr/local/doc/haproxy/seamless_reload.txt'
removed '/usr/local/doc/haproxy/architecture.txt'
'doc/architecture.txt' -> '/usr/local/doc/haproxy/architecture.txt'
removed '/usr/local/doc/haproxy/peers-v2.0.txt'
'doc/peers-v2.0.txt' -> '/usr/local/doc/haproxy/peers-v2.0.txt'
removed '/usr/local/doc/haproxy/regression-testing.txt'
'doc/regression-testing.txt' -> '/usr/local/doc/haproxy/regression-testing.txt'
removed '/usr/local/doc/haproxy/cookie-options.txt'
'doc/cookie-options.txt' -> '/usr/local/doc/haproxy/cookie-options.txt'
removed '/usr/local/doc/haproxy/lua.txt'
'doc/lua.txt' -> '/usr/local/doc/haproxy/lua.txt'
removed '/usr/local/doc/haproxy/WURFL-device-detection.txt'
'doc/WURFL-device-detection.txt' -> '/usr/local/doc/haproxy/WURFL-device-detection.txt'
removed '/usr/local/doc/haproxy/linux-syn-cookies.txt'
'doc/linux-syn-cookies.txt' -> '/usr/local/doc/haproxy/linux-syn-cookies.txt'
removed '/usr/local/doc/haproxy/SOCKS4.protocol.txt'
'doc/SOCKS4.protocol.txt' -> '/usr/local/doc/haproxy/SOCKS4.protocol.txt'
removed '/usr/local/doc/haproxy/network-namespaces.txt'
'doc/network-namespaces.txt' -> '/usr/local/doc/haproxy/network-namespaces.txt'
removed '/usr/local/doc/haproxy/DeviceAtlas-device-detection.txt'
'doc/DeviceAtlas-device-detection.txt' -> '/usr/local/doc/haproxy/DeviceAtlas-device-detection.txt'
removed '/usr/local/doc/haproxy/51Degrees-device-detection.txt'
'doc/51Degrees-device-detection.txt' -> '/usr/local/doc/haproxy/51Degrees-device-detection.txt'
removed '/usr/local/doc/haproxy/netscaler-client-ip-insertion-protocol.txt'
'doc/netscaler-client-ip-insertion-protocol.txt' -> '/usr/local/doc/haproxy/netscaler-client-ip-insertion-protocol.txt'
removed '/usr/local/doc/haproxy/peers.txt'
'doc/peers.txt' -> '/usr/local/doc/haproxy/peers.txt'
removed '/usr/local/doc/haproxy/close-options.txt'
'doc/close-options.txt' -> '/usr/local/doc/haproxy/close-options.txt'
removed '/usr/local/doc/haproxy/SPOE.txt'
'doc/SPOE.txt' -> '/usr/local/doc/haproxy/SPOE.txt'
removed '/usr/local/doc/haproxy/intro.txt'
'doc/intro.txt' -> '/usr/local/doc/haproxy/intro.txt'
sed -e 's:@SBINDIR@:'/usr/local/sbin':' haproxy.service.in > haproxy.service
As you can see from the top-most lines, this includes the binary. Why is being deleted, or is that the old one?

EDIT: It still isn't working. I should have been clearer, sorry
Last edited by Rilic on Tue Jun 09, 2020 3:43 pm, edited 1 time in total.
Post Reply