Example with Polkadot Node Package
What is DAppNode ?
DAppNode mission is to facilitate the setup of decentralized infrastructures.
It allows you to :
- Join your favorites p2p networks and p2p economies
- Increase the global censorship resistant of the network by running a peer
- Serve yourself without going to third-party providers
- Serve your friends and your nomadism with VPN access.
DAppNode is composed of hardware and a software part.
The software part is composed of system packages that allow you to install, run and manager blockchain nodes or others software.
What is Polkadot ?
The possibility to interconnect multiple blockchains together is crucial for blockchain ecosystem.
Polkadot : a chain of chains.
As DAppNode is here to facilitate running blockchain nodes, let’s try with Polkadot node and see, step-by-step, how to create a DAppNode package for Polkadot Node.
What is DAppNode Package ?
To run your software on DAppNode, the prerequisite is to create a docker image of it. Then, the DAppNode Package is a bunch a metadata wrapping this docker image.
Those metadata allow you to
- access and manage your package from a Dashboard
- Reference it in a decentralized way with IPFS
- Manage versioning thanks to ArgonPM, ENS, Ethereum (soon off-chain using swarm)
You can use the dappnode SDK cli to create metadata, build and publish easily.
Create a new DAppNode Package
First, you need to download the dappnode SDK cli that will help you to create the package template.
npm install -g @dappnode/dappnodesdk
Then, create a new directory for your package and launch
After answering basics questions, you have 3 files that you need to modify :
- dappnode_package.json : contains all metadata used by DAppNode System to manager your new package.
- docker-compose.yml : basic docker-compose file that will be used to launch your docker image.
- build/Dockerfile : you must your configure docker image for the software or node you want to create.
For Polkadot, we inherit from the official docker image and add a parameter EXTRA_OPTS in the command. This parameter will be then valorize and can be changed in the web interface of the DAppNode.
To have a nice logo in the interface you need to set a logo in the directory. This logo will be added to IPFS when you will launch the sdk build command. After that, the IPFS link will be set in avatar parameter in dappnode_package.json file.
You can now try to build.
Be Careful, you must be connected to some IPFS provider to be able to generate the IPFS link for the package et the logo. If you are connected to a DAppNode Wifi your have nothing to do, the config is good by default. Otherwise, you can overwrite the IPFS provider to target.
The build command upload the logo to IPFS and create docker image thanks to your Dockerfile.
When all is ok, it loads the package metadata to IPFS and give you a direct link to install it on your DAppNode.
Configure the EXTRA_OPTS parameter and after clicking on Install, you node will start automatically.
In the installer Menu, everybody that have the IPFS link will now be able to install the package you have just created !
But how to install with just the DAppNode Package Name ?
You need to do the sdk publish step
It uses Ethereum for the versioning and ENS to resolve the name : polkadot.public.dappnode.eth
You need also to prepare a developer Ethereum wallet that will be responsible to publish the package and publish new versions of the package.
When publish command is successful, it gives you a direct link to a form filled out. Connect you wallet and propagate the transaction. The new repo is then created with version 1.0.0. Now, you can direct install your package with his name.
Release a new version of your DAppNode Package
Edit the Dockerfile of your project to target your new version and increase version in metadata files with :
dappnodesdk increase minor
Then launch :
Go to the form link and propagate the transaction to update the package version.
Now, when you go to the installer menu and click to update you will see that your Node will switch to the new version you just published !
Activate auto-update for a DAppNode Package
Recently DAppNode team add auto-update feature for packages. You can choose to auto-update for system package and or your installed packages too.
When a new release is triggered and after a delay, you will be automatically updated according to your choice.
Activate the auto-update for Polkadot package
Wait to the schedule for auto-update.
At auto-update time, the node is automatically upgraded !
Here the DAppNodePackage result for Polkadot https://github.com/branciard/DAppNodePackage-polkadot
Now, you have learn how to deploy a new Package on DAppNode ! It is your turn to choose your favorite p2p softwares or nodes and increase the number of DAppNode packages available and promote decentralized and resilient networks !