crowdrender / cr-docker

The official repository for the CrowdRender docker image
59 stars 8 forks source link

Users cannot connect to more than one docker container #2

Closed Jeducious closed 3 years ago

Jeducious commented 3 years ago

According to issues on the crowdrender forum, some people are having trouble with connecting to more than one container.

As a result, I took a look at how the container is started start_cr_server.sh, the command to start a server is:

# start the CR server echo "starting crowdrender server....................." /usr/local/blender/blender -b -noaudio --python /root/.config/blender/2.83/scripts/addons/crowdrender/src/py_3_7/serv_int_start.py -- -ct "$token" -t "server_int_proc" }

This does not account for the option to set an 'access key' which in fact is a misnomer, sorry everyone :S, the access key is an internal name we cooked up for the ability to set a different hardware uuid for the machine, allowing you to use a secret so only you can connect to the node.

It serves a dual purpose though, and also allows you to set unique hardware uuids for containers. Virtual machines will all have the same hardware uuid if you check them. This is because the hardware is virtual I guess :) but anyway, using the usual methods for introspection (such as look at /etc/machine-id on linux) will just give you the same hardware uuid for each instance of the container.

The implication of this is that crowdrender will only ever report one render node, no matter how many containers you start. Since the start_cr_server.sh script and the gpu equivalent don't set the -ak option, then unfortunately all users are bound to just one container.

We can fix this though, here's how to use the -ak option to automagically generate a unique uuid which will be propagated to the users crowdrender account, and cause each container to show up as a unique node.

/usr/local/blender/blender -b -noaudio --python /root/.config/blender/2.83/scripts/addons/crowdrender/src/py_3_7/serv_int_start.py -- -ct "$token" -t "server_int_proc" -ak $(cat /proc/sys/kernel/random/uuid)

This will generate a random unique id and cause the crowdrender server to set it as its hardware uuid, meaning it will be unique amounts all the render nodes started using containers this way.

One other consideration might be to allow users to set the -ak option directly if they want to set something else should they find the above method doesn't work on their platform (no idea why it wouldn't but taking control away from the user by setting the -ak option for them seems like a plausible way to invite the kraken to strike).

So, in summary, lets create a way to set the -ak option when starting the cr-docker container so as to allow more than one container to be used by a single CR account. I am pretty sure this will make the container many times more useful!

zocker-160 commented 3 years ago

Issue confirmed and reproduced, thank you for reporting!

I added a new ENV variable, which allows the user to set its own UUID if that is not set, it will use a random one from /proc/sys/kernel/random/uuid

I think this is the best solution and I have tested multiple containers on the same machine and it did work with this fix.

Jeducious commented 3 years ago

Nice! Thanks for the quick turn around!