This repository is for IPFS Worker Node.
-
Build the image
docker build . -t ipfs_worker --no-cache
if we want to build the image for specific platform (ex:
--platform linux/arm64/v8
). -
Run the container
docker run --name <name> -e MANAGER_IPFS_ID=<manager_ipfs_id> -e MANAGER_IP_ADDRESS=<manager_ip_address> -d ipfs_worker
we can get the
MANAGER_IPFS_ID
andMANAGER_IP_ADDRESS
from the manager node:<!-- go to the manager node terminal --> docker exec -it <name> /bin/sh <!-- below command will show detail in json structure, just copy the `ID` --> ipfs id <!-- below command will show interface config, copy the ip from eth0 (or other interface) --> ifconfig
if we want to expose the port, we can add for example
-p 4001:4001 -p 5001:5001 -p 8080:8080
to the command, but on ipfs config we are not exposed the API server (:5001
) to the public.
This project is running well with alphine linux with arm base (linux/arm64/v8
), if you run this project using different distribution, maybe you should adjust some scripts or service config (ex: services/ipfs
, etc).
If the ipfs daemon is not running, we can start it manually for each node with rc-service ipfs start
command. First, we should exec into the container
docker exec -it <name> /bin/sh
then start the ipfs daemon.
rc-status -a
rc-service ipfs start
touch /run/openrc/softlevel
rc-service ipfs restart
rc-update add ipfs default
sleep 1
rc-status -a
- In previous, manager and worker project is in one code base, we run with docker compose to simplify the automation, since currently the worker project is not on one code base anymore, we should run it in some steps (ex: running worker node manually, then run worker nodes and pointing it to the worker manually), see Run section above.
- The
swarm.key
is should be confidential (generated once from manager). - do step 2 on Run section above for running other worker nodes.