Help setting up HaProxy in container station.

dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Help setting up HaProxy in container station.

Post by dayfly »

i am trying to install HaProxy in container station but cant get it to work

When i install it in containerstation the service wil not start and i get this error
[ALERT] 121/094749 (1) : Cannot open configuration file/directory /usr/local/etc/haproxy/haproxy.cfg : No such file or directory


Then i tried to follow this manual but i get stuck on the first part, where am i supposed to use that ?
FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
https://hub.docker.com/_/haproxy

i have been looking for hours trying to set this up, but cant find a clear setup with containerstation anywhere
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

Did you check that the file /usr/local/etc/haproxy/haproxy.cfg actually exist?
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

oyvindo wrote: Fri May 01, 2020 8:32 pm Did you check that the file /usr/local/etc/haproxy/haproxy.cfg actually exist?
I dont think so, i cant find it when i browse threw the files in explorer or file station and i dont know how to reach it with ssh because i dont know the docker path.


[~] # /usr/local/etc/haproxy/haproxy.cf
-sh: /usr/local/etc/haproxy/haproxy.cf: No such file or directory

images of the container setup
https://imgshare.io/image/zixG5
https://imgshare.io/image/zimPP
https://imgshare.io/image/zi9bQ
https://imgshare.io/image/zijDO
https://imgshare.io/image/ziYru

it must be something really easy but i can't see it, at the moment i have it running in a VM with centos that works good but i want to migrate it to a docker to have everyting together, now i have virutal machines all over the place
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

No, no this path is inside the container - unless you've specifically defined a shared folder path to point out of the container during, creation.
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

I created a share appdata/haproxy with the file haproxy.cfg, but i still get the same error

In the container GUI under,
Command : haproxy -f /share/appdata/haproxy/haproxy.cfg

result
[ALERT] 122/053053 (1) : Cannot open configuration file/directory /share/appdata/haproxy/haproxy.cfg : No such file or directory
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

Are you creating the container using the Container Station GUI, or are you just using Docker CLI's ?
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

oyvindo wrote: Sat May 02, 2020 2:25 pm Are you creating the container using the Container Station GUI, or are you just using Docker CLI's ?
Only with with GUI, see the screenshots, if i knew the command's for docker CLI i would use that, but from what i was reading you can do the same with the GUI from conainterstation, i tested other apps they all work and are easy to setup, only haproxy fails on that haproxy.cfg file.

i also looked at the haproxy.qpkg app that works, but i want to run it in docker because of security reasons.

Would be nice if someone would share their install with docker so i can copy that
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

What did you enter in the two "Shared Folder" fields under "Advanced Settings" during creation?
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

Under shared folders I tried to enter a share that i made,
Volume from host

Code: Select all

/appdata/haproxy

But i also tried with
New Volume

Code: Select all

/usr/local/etc/haproxy/
Strange is that once i created the container and look under container settings again, i dont see the shared folders it says,

Code: Select all

No Data
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

Volume from host is correct, but /appdata/haproxy does not strike me as a valid path. Are you sure you can browse to this folder using File Station prior to creating the container?
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

Yes i can access it, i created it to store the haproxy.cfg file so it doenst get overwritten by updates, i have tried all combinations that i could find on the internet but nothing i try works.

The manual looks very simple.
https://hub.docker.com/_/haproxy

Code: Select all

[~] # docker pull haproxy
Using default tag: latest
latest: Pulling from library/haproxy
Digest: sha256:e6f9faf0c2a0cf2d2d5a53307351fa896d90ca9ccd62817c24026460d97dde92
Status: Image is up to date for haproxy:latest
But then it says Create a Dockerfile, so with I enter the command,
FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

And i get this back

Code: Select all

[~] # FROM haproxy:1.7
-sh: FROM: command not found
Are there other ''easier'' alternatives to run a reverse proxy on a QNAP docker environment ?
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

Post a screen capture of your Advanced Settings --> Shared Folders during installation.
ImageImageImage
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: Help setting up HaProxy in container station.

Post by oyvindo »

Well, you posted a lot except the one that I was interested in; The Shared Folder setting.
ImageImageImage
dayfly
Starting out
Posts: 14
Joined: Thu Apr 30, 2020 2:47 pm

Re: Help setting up HaProxy in container station.

Post by dayfly »

ik got it working now with these settings

Shared Folders

Code: Select all

[b]/usr/local/etc/haproxy/haproxy.cfg[/b]	/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/volumes/Config/_data	
Read/Write
then i created a haproxy.cfg and pasted my current haproxy.cfg file, but it gives fatal errors

Code: Select all

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
        stats timeout 30s
        user haproxy
        group haproxy
        daemon

        ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA$
        ssl-default-bind-options no-sslv3

defaults
        log     global
        mode    tcp
        option  tcplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000

frontend http
 mode http
 bind :80
 stats hide-version
 stats refresh 30s
 stats show-node
 stats auth admin:password
 stats uri  /proxy?stats


 redirect scheme https if { hdr(Host) -i remote.mydomain.com }
 use_backend cloud_http if { hdr(Host) -i cloud.mydomain.com }
 redirect scheme https if { hdr(Host) -i  autodiscover.mydomain.com }

backend remote_http
 mode http
 server remote 192.168.1.10:80

backend cloud_http
 mode http
 server cloud 192.168.1.253:80

backend autodiscover_http
 mode http
 server autodiscover 192.168.1.10:80

frontend https
 mode tcp
 bind :443 name https
 tcp-request inspect-delay 5s
 tcp-request content accept if { req_ssl_hello_type 1 }
 use_backend remote_https if { req_ssl_sni -i  remote.mydomain.com }
 use_backend cloud_https if { req_ssl_sni -i  cloud.mydomain.com }
 use_backend autodiscover_https if { req_ssl_sni -i  autodiscover.mydomain.com }

backend remote_https
 mode tcp
 server remote 192.168.1.10:443

backend cloud_https
 mode tcp
 server cloud 192.168.1.253:443

backend autodiscover_https
 mode tcp
 server autodiscover 192.168.1.10:443

Code: Select all

[NOTICE] 131/172005 (1) : New worker #1 (7) forked                                                                                                                                                                                                                                                                                              
[WARNING] 131/173542 (1) : Exiting Master process...                                                                                                                                                                                                                                                                                            
[WARNING] 131/173542 (7) : Stopping frontend GLOBAL in 0 ms.                                                                                                                                                                                                                                                                                    
[WARNING] 131/173542 (7) : Proxy GLOBAL stopped (FE: 0 conns, BE: 0 conns).                                                                                                                                                                                                                                                                     
[ALERT] 131/173543 (1) : Current worker #1 (7) exited with code 0 (Exit)                                                                                                                                                                                                                                                                        
[WARNING] 131/173543 (1) : All workers exited. Exiting... (0)                                                                                                                                                                                                                                                                                   
[ALERT] 131/173545 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg/haproxy.cfg:7] : cannot find user id for 'haproxy' (0:Success)                                                                                                                                                                                                             
[ALERT] 131/173545 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg/haproxy.cfg:8] : cannot find group id for 'haproxy' (0:Success)                                                                                                                                                                                                            
[WARNING] 131/173545 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg/haproxy.cfg:35] : a 'redirect' rule placed after a 'use_backend' rule will still be processed before.                                                                                                                                                                    
[ALERT] 131/173545 (1) : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg/haproxy.cfg                                                                                                                                                                                                                                  
[ALERT] 131/173545 (1) : Fatal errors found in configuration.



Getting a bit closer but stil not there yet
Post Reply

Return to “Container Station”