-
Notifications
You must be signed in to change notification settings - Fork 28
Home

This tutorial will show you how to turn the Status-go server into a DAppNode package (DNP)
If you don’t have it installed yet, you need to install Node.js in your laptop.
Last stable version of Node.js (or 8.12.0) works just fine.
You will also need docker and docker-compose.
Repo: DAppNode SDK
npm install -g @dappnode/dappnodesdk
- Introduction to SDK
DAppNodeSDK is a tool to make as simple as possible the creation of new dappnode packages. It helps to initialize and publish an Aragon Package Manager Repo in the ethereum mainnet.
We have deployed a public APM (Aragon Package Manager) registry in which anyone can create their own APM repository: public.dappnode.eth
- Manifest
- Command line
$ dappnodesdk --help
Usage: dappnodesdk [options]
Options:
init Initialize a new DAppNodePackage Repository
build build a new version (only generates the ipfs hash)
publish <type> Publish a new version of the package in an Aragon Package Manager Repository. Type: [ major | minor | patch ]
gen_manifest Generate a new manifest based on a existing docker-compose.yml
gen_compose Generate a new docker-compose.yml based on a existing dappnode_package.json
-h, --help output usage information
- Workflow
- init, create folder, manifest and docker-compose
- develop + test locally
- build and upload + test with IPFS
- publish to APM
- A DNP is a docker container. It needs a docker-compose and a Dockerfile.
- Let's start from the status-go Dockerfile
First, we need to have access to the project files. To do so, add a git clone command after the first run
RUN mkdir -p /go/src/github.com/status-im/status-go && \
git clone -b $TAG https://github.com/status-im/status-go.git /go/src/github.com/status-im/status-goIn order to be able to access the RPC we will grant access to any domain. The internal DAppNode bind will link my.status.dnp.dappnode.eth to the package.
RUN cd /go/src/github.com/status-im/status-go && \
# Hack to allow terminal request to my.status.public.dappnode.eth
sed -i 's/localhost/*/g' node/node.go && \
make statusgo \
BUILD_TAGS="$build_tags" \
BUILD_FLAGS="$build_flags"Then, add specific config files. These configs will not be modifiable once the DNP is build and deployed. If a parameter has to be modified by the user, it should be an enviroment variable.
COPY config.json /data/config.json
COPY configMailServer.json /data/configMailServer.json
COPY entrypoint.sh entrypoint.sh
ENV STATUSD_MODE RELAYThe entrypoint is a switch between configs depending on the ENV STATUSD_MODE. If the user changes an env after installation, the package will restart and this script will be rerun
/entrypoint.sh
#!/bin/sh
# Default config file
CONFIG_FILE=/data/config.json;
# Check type
if [ "$STATUSD_MODE" = "MAILSERVER" ];then
CONFIG_FILE=/data/configMailServer.json
fi
/usr/local/bin/statusd -register -log DEBUG -c $CONFIG_FILE -metricsDockerfile
ENTRYPOINT ["/entrypoint.sh"]Once you have tackled all the issues try building the package. This command only generates the IPFS Hash to be able to install it without needing to create the APM Repo. It will allow you to test the package in any DAppNode before publishing the package.
$ dappnodesdk build
Once you have successfully tested the package using its IPFS hash, it's time to publish it.
In DAppNode we favour the use of Aragon Package Manager (APM) smart contract. To publish a DNP means sending transaction to the a registry contract and link a semver version to the IPFS hash of the manifest of the package.
The publish command does the build of the image and shows a transaction data to be able to publish the package. The first time it will create the repository. Otherwise, it will update of it.
To be able to update a repository you must be the authorized dev.
The script increases the current version of the repository based on the specified type (patch, minor, major), unless a version hasn't yet been published
$ dappnodesdk publish < patch | minor | mayor >
for more information about versioning check semver