How to debug your miner stack (docker)

After completing whole tutorial here:
https://wiki.phala.network/en-us/docs/poc3/
You should got stack working. But sometimes it may happend it didn’t went well.
Here I would like to describe for all of you not familiar with linux / docker how to get informations why it is not working.

Check does your controller account submit phalamodule(sync_worker_message)

If it does produce such extrinsic (in last few hour - it may vary) it means your miner works well.
Otherwise you need to check stack.

First of all check docker stats


All containers should be running. Also note if phala-node is highly uses CPU it means sync is in progress.
Also check telemetry to know what is node sync progress.
https://telemetry.polkadot.io/#/Phala%20PoC-3

If one of your docker containers doesn’t work you need to check why.
Run container without --rm flag which “Automatically remove the container when it exits”.
Next check logs with:
docker logs <container-name> | tail -n 100 for example docker logs phala-node | tail -n 100

If your container is down (logs will not be available) and after starting it breaks immediately you can enter docker and verify it manually:

  1. run container with modified entrypoint
    Example for phala-phost container
docker run -d -ti --rm \
                --name phala-phost \
                -e PRUNTIME_ENDPOINT="http://phala-pruntime:8000" \
                -e PHALA_NODE_WS_ENDPOINT="ws://phala-node:9944" \
                -e MNEMONIC="your-mnemonic" \
                -e EXTRA_OPTS="-r" \
                --link phala-node \
                --link phala-pruntime \
                --entrypoint /bin/bash
                phalanetwork/phala-poc3-phost

Note this line:
--entrypoint /bin/bash

  1. attach to container
docker attach phala-phost
  1. run main script inside container
./start_phost.sh

And you should get output. Now you can verify what is wrong

2 Likes