How to become a worker¶
A worker is an essential actor of the infrastructure. It will be in charge of performing the works submitted by the users. It is part of a worker pool. A worker will be rewarded some RLC for every work it performs.
Install and start a worker¶
Contact the worker pool to get all the needed parameters to join its pool.
Pool manager must provide connection location information, authentication login and password.
The following command can be called on the machine where the worker will run:
docker run -d --restart always \ --env SCHEDULER_DOMAIN=pool.example.iex.ec \ --env SCHEDULER_IP=22.214.171.124 \ --env LOGIN=test \ --env PASSWORD=password123 \ --env LOGGERLEVEL=DEBUG \ --env SHAREDAPPS=docker \ --env TMPDIR=/PATH/TO/TEMPDIR \ --env WALLETPASSWORD=walletpassword \ -v /PATH/TO/WORKER/WALLET/wallet.json:/iexec/wallet/wallet_worker.json \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /PATH/TO/TEMPDIR:/PATH/TO/TEMPDIR \ iexechub/worker:X.Y.Z
Please note that all the values shown here are just given as an example, it should be adapted to the worker pool you are trying to join and to the machine on which the worker will run.
Here is the details for the different parameters used in the command:
|SCHEDULER_DOMAIN||URL of the scheduler||YES|
|SCHEDULER_IP||IP adress of the scheduler||NO|
|LOGIN||login of the worker to connect to scheduler||NO||vworker|
|PASSWORD||password of the worker to connect to scheduler||NO||vworkerp|
|SHAREDAPPS||apps already installed in the worker||NO|
|LOGGERLEVEL||logger level used by the worker||NO||INFO|
|TMPDIR||temporary folder used by the worker||NO|
|WALLETPASSWORD||password of the wallet used by the worker||YES|
Regarding the volumes mounted with the -v option in the docker run command, they are mandatory, if not defined the worker may not behave as expected:
- The option -v /PATH/TO/WORKER/WALLET/wallet.json:/iexec/wallet/wallet_worker.json is used for the worker to know which wallet to use.
- The option -v /var/run/docker.sock:/var/run/docker.sock is to allow the worker to start new docker containers when performing tasks.
- The option -v /PATH/TO/TEMPDIR:/PATH/TO/TEMPDIR will be used to store all the results from the worker.
From a script provided by the scheduler
The scheduler you want to connect your worker to may already provide a ready-to-launch script for you to use out-of-the-box. In that case you can simply launch that script. It will start a worker with the correct parameters to connect to that scheduler. The only parameter that should change for you is the path of the worker’s wallet.
An exclusive wallet must be associated to your worker. You should create as many wallet as workers you get per worker pool.
Since a worker is running in a docker container, it can be started in any OS that can support docker, so the following OS are supported: