Failed to run edge router

Hi I’m following the instruction (Local - With Docker | OpenZiti) to run edge router

But failed with the following error.

----------  Creating edge-router ziti-edge-router-1....
----------  Found existing edge-router ziti-edge-router-1....
[   0.908]   ERROR ziti/ziti/router.run: {error=[open /persistent/ziti-edge-router-1.yaml: no such file or directory] revision=[d9282a0b4e84] configFile=[/persistent/ziti-edge-router-1.yaml] go-version=[go1.19.4] os=[linux] arch=[amd64] build-date=[2022-12-20T20:53:53Z] version=[v0.27.1]} error loading ziti-router config
panic: open /persistent/ziti-edge-router-1.yaml: no such file or directory

goroutine 1 [running]:
github.com/openziti/ziti/ziti/router.run(0xc0000c0300?, {0xc0000c2250, 0x1, 0x1?})
	github.com/openziti/ziti/ziti/router/run.go:68 +0x13ac
github.com/spf13/cobra.(*Command).execute(0xc0000c0300, {0xc0000c2220, 0x1, 0x1})
	github.com/spf13/cobra@v1.6.1/command.go:920 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000c0000)
	github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.6.1/command.go:968
github.com/openziti/ziti/ziti/router.Execute()
	github.com/openziti/ziti/ziti/router/root.go:72 +0x1e
main.main()
	github.com/openziti/ziti/ziti-router/main.go:51 +0x17

Hi @Joe, welcome to the community! That’s one I haven’t seen before. Thanks for reporting it. I ran the non docker quickstart just today and that worked fine. I am also sure the docker compose one would work too.

I’ll take a look at it (later tonight or tomorrow) and get back to you. We did recently change this, so its feeling like it’s a bug but I’ll check it out and follow up.

Hi @Joe, welcome. I’m sorry to hear you’re having this issue but thank you for letting us know. Can you provide a detailed description of the steps you followed to encounter this issue?

I’ve run the quickstart myself and wasn’t able to see the same issue. It appears that you possibly stopped the container and restarted it (or maybe it failed, and you tried running it again).

I’m basing this information off of seeing this in your output, which indicates it was run previously
---------- Found existing edge-router ziti-edge-router-1....

In any case, I tried stopping the container and starting it back up, but I’m still not seeing this issue, so I’d like to try and reproduce it by following your steps exactly.

Thanks again.

Hi @gberl002 thanks for looking at this issue. I’m simply follow the instruction described in the link (Local - With Docker | OpenZiti).

I created the docker network and created the ziti.env and directories as instructed.

Although I’m running on MAC M2 so I started the controller with:

docker run \
  --platform linux/amd64 \
  --network ziti \
  --network-alias ziti-controller \
  --network-alias ziti-edge-controller \
  -p 1280:1280 \
  --rm \
  -d \
  -v $PWD/docker-volume/pki:/persistent/pki \
  -v $PWD/docker-volume/ziti.env:/persistent/ziti.env \
  openziti/quickstart \
  /var/openziti/scripts/run-controller.sh

It ran with no problem. But when I started the edge router with:

docker run \
  --platform linux/amd64 \
  -e ZITI_EDGE_ROUTER_RAWNAME=ziti-edge-router-1 \
  --network ziti \
  --network-alias ziti-edge-router-1 \
  -p 3022:3022 \
  --rm \
  -d \
  -v $PWD/docker-volume/pki:/persistent/pki \
  -v $PWD/docker-volume/ziti.env:/persistent/ziti.env \
  openziti/quickstart \
  /var/openziti/scripts/run-router.sh

The docker started but existed with error message about missing ziti-edge-router-1.yml. I wonder if this file needs to be there before it starts? The pki and the ziti.env seem to contain proper content after the controller is started.

You didn’t happen to be in different directories when you started the controller vs when you started the router did you? If so, the $PWD would be different, and that would throw off the volume mounts where the shared config files are persisted, which would make sense why ziti-edge-router-1.yml wasn’t found.

Could that possibly be the case?

No, I think I started them in the same directory. When would the file ziti-edge-router-1.yml get created? When I start the controller or when the router is started?

I am free again to look at things like this and have my pc setup. I just started docker up, ran the steps exactly as on the docker (no compose) page and it started up for me, which is a bummer. I hoped to be able to recreate the same problem! I don’t have an M2 and my Mac doesn’t have docker yet but I can try to get docker installed on it and try things out but I don’t think it would matter. That is definitely “a difference” though.

The ${ZITI_EDGE_ROUTER_RAWNAME}.yml file (ziti-edge-router-1.yml) is generated when the container starts up.

You should see this:

CREATING EDGE ROUTER CONFIG
edge router configuration file written to: /persistent/ziti-edge-router-1.yaml
----------  Creating edge-router ziti-edge-router-1....
New edge router ziti-edge-router-1 created with id: XDUskkYh4y
Enrollment expires at 2022-12-27T04:32:22.377Z

It’s about 10 lines after the docker command to startup. My guess is that the login command is failing, and that means the command to create the router is not succeeding for some reason.