rhastie / easy-nmos

Easy NMOS setup an testing using Docker compose/available containers
Apache License 2.0
56 stars 9 forks source link

nmos-testing not starting? #18

Open roddypratt opened 2 years ago

roddypratt commented 2 years ago

I get this error when running docker-compose up

nmos-testing     |   cmdline: git clone -v https://github.com/AMWA-TV/nmos-discovery-registration.git cache/is-04
nmos-testing     |   stderr: 'Cloning into 'cache/is-04'...
nmos-testing     | fatal: unable to access 'https://github.com/AMWA-TV/nmos-discovery-registration.git/': Failed to connect to github.com port 443: No route to host

virtnode and registry seem to be working fine. My suspicion is it's to do with IP gateway setups on macvlan but it's not clear how to resolve that. This is running on Ubuntu 20.04 on Rasp. Pi 4. Can reach github.com without issue from console.

rhastie commented 2 years ago

Roddy... Thanks for the query.

The nmos-testing container needs to have access to the Internet in order to be able to download the very latest NMOS schemas. The error tells me it is failing to connect to relevant repository on the Internet. Unfortunately, without the schemas the nmos-testing container won't function.

Does the machine you are running Easy-NMOS on have access to the Internet? Are you mounting the containers on to the host network correctly so they can pull the schemas? Did you manually stage the container images or just let Docker Compose retrieve them?

You will need Internet access in order to successfully run the nmos-testing tool.

If you want to disable the testing tool and just have the registry, controller and virtual node running you can comment out the relevant section of the docker-compose.yml file. If you do this you won't need access to the Internet to run the rest of it.

roddypratt commented 2 years ago

Thanks Richard - Understood re Schemas and net access: Yes, the machine does have access to the internet. I cloned the repo directly onto it, edited the IP addresses to be on our LAN and just did sudo docker compose up.

I assume the containers should inherit the gateway IP from the host system, which is getting it via DHCP at present?

rhastie commented 2 years ago

Did you correctly adjust the "parent" parameter in the docker-compose.yml file to reference your external NIC on the RasPi? IIRC for Raspberry PI you need "eth0" rather than the default one provided.

I've just quickly re-tested on my RasPi and it seems to be still working. Albeit it takes a little while to start the nmos-testing tool after you execute the docker-compose up

rhastie commented 2 years ago

Roddy...

Did it work?

As a FYI - ARM32 support has recently been dropped by the nmos-cpp container. You can still use the container on RasPi but you'll need the new 64-bit Raspberry Pi OS... All the details are here: https://github.com/rhastie/build-nmos-cpp#raspberry-pi-models-3b-3b-3a-4-400-cm3-cm3-cm4-and-zero-2-w

roddypratt commented 2 years ago

Thanks for the Pi info. (I'd actually just upgraded to a Pi4 because nmos-testing doesn't support ARM32.)

However, still a little stuck with nmos-testing via easy-nmos.

Yup, parent set to eth0 - the containers appear on the LAN correctly.

My PI has internet access, and I can successfully run nmos-testing in a docker container using:- sudo docker run --network host amwa/testing

However, I'm still getting "no route to host" with easy-nmos. My best guess is that the macvlan isn't getting a gateway IP. Not sure how to prove that, as the containers that do start are missing the net-tools package.

Apparently you can specify a gateway when using macvlan directly from docker see here but it seems you can't use those with docker-compose.

I'll try giving the Pi a static IP and gateway rather than using DHCP, see if that changes anything.

roddypratt commented 2 years ago

Well, I have it working: docker-compose macvlan networks seem to always get a gateway IP with last octet = 1, so when you set subnet: 192.168.0.0/24 the gateway MUST be 192.168.0.1. Nothing I've found in the config file seems to alter that. (docker inspect nmos-virtnode shows the allocated gateway)

For historical reasons, our LAN gateway was at 192.168.0.251. I've had to reconfigure our LAN with the gateway router at 192.168.0.1 instead, and it now works fine!

garethsb commented 2 years ago

I thought you could do this with IPAM config but I've noticed that the docker compose documentation says the ipam config gateway is only honoured for version 2 not version 3 compose files...

https://docs.docker.com/compose/compose-file/compose-file-v2/#ipam

vs.

https://docs.docker.com/compose/compose-file/compose-file-v3/#ipam

garethsb commented 2 years ago

I'm left confused by the comments on https://github.com/docker/compose/issues/6569 though, which imply it should work since docker compose v1.27. Do we have to remove the version from the compose file?

roddypratt commented 2 years ago

I tried both removing version and changing it to 2.x - no difference. This is with docker-compose 2.3.3, docker 20.10.13

rhastie commented 2 years ago

Roddy,

Did you try version: '2'? Without the .x version... After going back over all the documentation I found one line referencing deprecated support for gateway here: https://docs.docker.com/compose/compose-file/compose-file-v3/#ipam

I don't think we did anything that specifically required v3 compose support but I may be wrong here...

I'm disappointed to see this deprecated... Not really sure why.

garethsb commented 2 years ago

@rhastie Deprecated in v3 but then v2 and v3 have been combined, so as far a I can tell it's now supposed to work. See the links I posted above.

The combined "Compose Specification" is here: https://github.com/compose-spec/compose-spec/blob/master/spec.md#ipam

The Docker Compose test suite doesn't test ipam config gateway (not used in the fixture athttps://github.com/docker/compose/blob/v2.3.3/pkg/e2e/fixtures/ipam/compose.yaml). But the code looks like it's supposed to work (see https://github.com/docker/compose/blob/v2.3.3/pkg/compose/create.go#L1032).

garethsb commented 2 years ago

@roddypratt can you share the syntax you used in the docker-compose.yml ? ipam config is a list of dictionaries so getting the - in the right place under config may be one trivial thing to check.

roddypratt commented 2 years ago

@roddypratt can you share the syntax you used in the docker-compose.yml ?

I tried many permutations, but I think this should have worked?

networks:
    external:
        # Create external macvlan subnet using host physical interface allowing containers to have their own IP addresses
        driver: macvlan
        driver_opts:
            parent: eth0
        ipam:
            config:
            - subnet: 192.168.0.0/24
              gateway: 192.168.0.251