Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection to proxy on a different host fails at Hearbeat #32

Open
kridgo opened this issue Jun 30, 2024 · 3 comments
Open

Connection to proxy on a different host fails at Hearbeat #32

kridgo opened this issue Jun 30, 2024 · 3 comments
Labels
question Further information is requested

Comments

@kridgo
Copy link

kridgo commented Jun 30, 2024

I cannot connect to the docker-socket-proxy when it is running on another host. I am using this docker-compose setup to run the proxy on the remote host:

version: "3"
services:
  nextcloud-appapi-dsp:
    environment:
      - NC_HAPROXY_PASSWORD=some_secure_password
      - BIND_ADDRESS=192.168.178.5
      - [email protected]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    container_name: nextcloud-appapi-dsp
    hostname: nextcloud-appapi-dsp
    restart: unless-stopped
    privileged: true
    image: ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release
    network_mode: host

It does start as expected when running sudo docker-compose up and I can register it as a deploy daemon in my Nextcloud server. However, when I run the Test deploy for the daemon it fails at stage Heartbeat. It does install the test deploy container on the remote host and is able to start it:

CONTAINER ID   IMAGE                                               COMMAND                CREATED          STATUS                    PORTS     NAMES
299ce125b19f   ghcr.io/cloud-py-api/test-deploy-cpu:release        "python3 main.py"      10 minutes ago   Up 10 minutes (healthy)             nc_app_test-deploy
1464ca39de38   ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release   "/bin/bash start.sh"   6 days ago       Up 11 minutes (healthy)             nextcloud-appapi-dsp

Still, Nextcloud server cannot connect to it. If I check the open ports on the remote host running the proxy with sudo netstat -tulpn | grep LISTEN, I get this:

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1779/cupsd
tcp        0      0 127.0.0.1:46689         0.0.0.0:*               LISTEN      697/containerd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      716/sshd: /usr/sbin
tcp        0      0 127.0.0.1:23000         0.0.0.0:*               LISTEN      3165/python3
tcp        0      0 192.168.178.5:2375      0.0.0.0:*               LISTEN      2452/haproxy
tcp6       0      0 :::22                   :::*                    LISTEN      716/sshd: /usr/sbin
tcp6       0      0 ::1:631                 :::*                    LISTEN      1779/cupsd

I guess the open port in the fourth line should be 192.168.178.23000 for the Heartbeat to work properly?

The Nextcloud server and the remote host are on the same network 192.168.178.0/24 and there is no firewall that could prevent any traffic. The remote host is a Raspberry Pi3 running Raspbian (it is setup for testing purpose only, I realize it is not a suitable platform to run the ExApps in a productive manner). It also does not help if I change the env variable for the sub containers according to the readme: - EX_APPS_NET="[email protected]"

If the failing Heartbeat is not an issue of the docker-socket-proxy but my setup is messed up, any hint will be highly appreciated.

@bigcat88
Copy link
Member

bigcat88 commented Jul 4, 2024

Sorry for the delay.

EX_APPS_NET should be "[email protected]" for the remote installs.

HaProxy should listen on 2375 AND ON "BIND_ADDRESS":23000 port in case of remote installations.

Can I see output of cat haproxy_ex_apps.cfg ?

There should be some such line:

frontend ex_apps
    mode http
    bind 192.168.178.5:23000-23030 v4v6 ssl crt /certs/cert.pem

@alonsobasauri
Copy link

Hello, I have this:

nextcloud-appapi-dsp:/# cat haproxy_ex_apps.cfg
frontend ex_apps
mode http
BIND_ADDRESS_PLACEHOLDER

My docker command:

sudo docker run -e NC_HAPROXY_PASSWORD="some_secure_password" -e BIND_ADDRESS=192.168.1.97 -e [email protected] -v /var/run/docker.sock:/var/run/docker.sock -v pwd/certs/cert.pem:/certs/cert.pem --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp --net host --restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release

Hope you can help us, I'm like 50 hours into this :/

@andrey18106
Copy link
Contributor

Hello, I have this:

nextcloud-appapi-dsp:/# cat haproxy_ex_apps.cfg frontend ex_apps mode http BIND_ADDRESS_PLACEHOLDER

My docker command:

sudo docker run -e NC_HAPROXY_PASSWORD="some_secure_password" -e BIND_ADDRESS=192.168.1.97 -e [email protected] -v /var/run/docker.sock:/var/run/docker.sock -v pwd/certs/cert.pem:/certs/cert.pem --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp --net host --restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release

Hope you can help us, I'm like 50 hours into this :/

Hello, this might be related and useful for you: nextcloud/app_api#413, https://nextcloud.github.io/app_api/CreationOfDeployDaemon.html#additional-options

@bigcat88 bigcat88 added the question Further information is requested label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants