Installation & running
Docker compose (bare metal)
TL;DR
git clone git@github.com:warp-contracts/warp-dre-node.git
cp .env.defaults .env
- Edit .env file and set all required variables.
- docker compose up -d
Pre requirements
- You need to have docker installed on your local machine with docker compose. You can use docker-desktop.
- You need to have Arweave wallet. You can generate it using:
- arweave wallet. You can download the wallet using the download button in the wallet setting.
- Generate a new wallet using script:
mkdir .secrets && yarn generate-arweave-wallet
- Script will generate arweave keys, you should past JSON string in
NODE_JWK_KEY
env variable in.env
file⚠️ Don't use wallets with real funds for test/development proposes.
- (Optional) NodeJS
- (Optional) Yarn
Running
To run docker compose you need to set up correct environment variables. You can do it using .env file:
cp .env.defaults .env
The file .env.example contains variables you can configure) or any other way supported by docker compose.
When you set up all required environment variables, just run:
docker compose up -d
Hosting specific setup
AWS (EC2)
Create EC2 instance
- Go to EC2 instace creation page (services -> compute -> ec2 -> launch instance)
- Choose Debian 11 AMI (you can choose any system you prefer)
- Instance type
- t3.micro for test proposes
- t3.medium or bigger for production
- Key pair (login)
- Create new key pair
- Download key pair and save it in safe place. You will need it to login to the instance after creation
- Network settings:
- Set flag: "Allow HTTP traffic from the internet"
- Storage: 60Gb, gp2
- Advanced details -> User data -> Paste content to install docker and D.R.E.:
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo BEGIN
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
wget \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo useradd -g docker -s /bin/bash -m dre
cd /home/dre
mkdir warp-dre-node
export DRE_RELEASE=$(curl -sL https://api.github.com/repos/warp-contracts/warp-dre-node/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "export DRE_IMAGE_TAG=$DRE_RELEASE" >> .bashrc
wget -O- https://github.com/warp-contracts/warp-dre-node/releases/download/$DRE_RELEASE/docker-compose.yml > warp-dre-node/docker-compose.yml
echo $'env=prod\nNODE_JWK_KEY=' > warp-dre-node/.env
sudo chown -R dre warp-dre-node
echo END
Configure the instance and run D.R.E. node
- Wait until instance is created and initialized. You can check status in EC2 console in the "Status Checks" section
- Login to the instance using SSH
- Open terminal
- Run
chmod 400 <path_to_key_pair_file>
to set correct permissions to the key pair file - Run
ssh -i <path_to_key_pair_file> admin@<instance_public_ip>
- Login as dre user:
sudo su dre
- Check if you have access to docker:
docker ps
. Check /var/log/user-data.log in case it's not accessible - Go to warp-dre-node directory:
cd ~/warp-dre-node
- Set all required variables:
nano .env
- ENV - change to prod, if you run D.R.E. node in production mode
- NODE_JWK_KEY - paste your arweave wallet JSON string. Creation of the wallet is described in the pre requirements section
- Run
docker compose up -d
to start D.R.E. node - Check if containers started successfully:
docker ps
- Check if D.R.E. node is running: go to
http://<instance ip>/status
GCP
- Go to VM instance create page (compute engine -> VM instances)
- Choose Debian 11 AMI (you can choose any system you prefer)
- Instance type
- e2-small for test proposes
- e2-standard-2 or bigger for production
- Firewall:
- Set flag: "Allow HTTP traffic"
- Storage: 60Gb, gp2
- Advanced options
- Disk - add additional disk - 60Gb
- Managenent -> Automation -> Paste content to install docker and D.R.E.:
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo BEGIN
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
wget \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo useradd -g docker -s /bin/bash -m dre
cd /home/dre
mkdir warp-dre-node
export DRE_RELEASE=$(curl -sL https://api.github.com/repos/warp-contracts/warp-dre-node/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "export DRE_IMAGE_TAG=$DRE_RELEASE" >> .bashrc
wget -O- https://github.com/warp-contracts/warp-dre-node/releases/download/$DRE_RELEASE/docker-compose.yml > warp-dre-node/docker-compose.yml
echo $'env=prod\nNODE_JWK_KEY=' > warp-dre-node/.env
sudo chown -R dre warp-dre-node
echo END
Configure the instance and run D.R.E. node
- Wait until instance will be in the running state
- Login to the instance using SSH (you can do it in the GCP console)
- Login as dre user:
sudo su dre
- Check if you have access to docker:
docker ps
. Check /var/log/user-data.log in case it's not accessible - Go to warp-dre-node directory:
cd ~/warp-dre-node
- Set all required variables:
nano .env
- ENV - change to prod, if you run D.R.E. node in production mode
- NODE_JWK_KEY - paste your arweave wallet JSON string. Creation of the wallet is described in the pre requirements section
- Run
docker compose up -d
to start D.R.E. node - Check if containers started successfully:
docker ps
- Check if D.R.E. node is running: go to
http://<instance ip>/status
DigitalOcean
Create droplet
- Go to droplet creation page (create -> droplets)
- Choose Debian 11 as OS
- Instance type
- Basic -> Regular -> 1Gb/1CPU instance - for test proposes
- General propose -> 8 GB/2 CPUs or bigger for production
- Enable backups (optional)
- Advanced options -> Add Initialization scripts -> Paste content to install docker and D.R.E.:
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo BEGIN
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
wget \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo useradd -g docker -s /bin/bash -m dre
cd /home/dre
mkdir warp-dre-node
export DRE_RELEASE=$(curl -sL https://api.github.com/repos/warp-contracts/warp-dre-node/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "export DRE_IMAGE_TAG=$DRE_RELEASE" >> .bashrc
wget -O- https://github.com/warp-contracts/warp-dre-node/releases/download/$DRE_RELEASE/docker-compose.yml > warp-dre-node/docker-compose.yml
echo $'env=prod\nNODE_JWK_KEY=' > warp-dre-node/.env
sudo chown -R dre warp-dre-node
echo END
Configure the instance and run D.R.E. node
- Login to the instance
- Login as dre user:
sudo su dre
- Check if you have access to docker:
docker ps
. Check /var/log/user-data.log in case it's not accessible - Go to warp-dre-node directory:
cd ~/warp-dre-node
- Set all required variables:
nano .env
- ENV - change to prod, if you run D.R.E. node in production mode
- NODE_JWK_KEY - paste your arweave wallet JSON string. Creation of the wallet is described in the pre requirements section
- Run
docker compose up -d
to start D.R.E. node - Check if containers started successfully:
docker ps
- Check if D.R.E. node is running: go to
http://<instance ip>/status
Kubernetes (Helm)
Create secret:
kubectl create secret generic dre --from-env-file=.env
Install/update helm chart:
helm upgrade --install warp-dre-node ./helm
Environment variables
We configure D.R.E. using dotenv. It means we can modify the configuration using environment variables or .env file.
You can check out the default values in the .env.defaults file.
Variable | Required | Description |
---|---|---|
APPSYNC_PUBLISH_STATE | true | Publish state into the appsync. Requires non-empty APPSYNC_KEY. |
APPSYNC_KEY | true/false | AWS AppSync key. |
NODE_JWK_KEY | true | JWK key of Arweave wallet. See more in Pre requirements section. |
PUBSUB_TYPE | true | Transport for node pub/sub. The node gets information about new blocks with it. Can be streamr or redis . |
STREAMR_STREAM_ID | if PUBSUB_TYPE=streamr | Required when PUBSUB_TYPE is streamr. Streamr stream id |
GW_PORT | if PUBSUB_TYPE='redis' | Port to Redis pubsub instance |
GW_HOST | if PUBSUB_TYPE='redis' | Host to Redis pubsub instance |
GW_USERNAME | if PUBSUB_TYPE='redis' | Username for authenticating to Redis pubsub instance |
GW_PASSWORD | if PUBSUB_TYPE='redis' | Password for authenticating to Redis pubsub instance |
GW_TLS | if PUBSUB_TYPE='redis' | TLS enabled/disabled for Redis pubsub instance |
GW_ENABLE_OFFLINE_QUEUE | if PUBSUB_TYPE='redis' | https://luin.github.io/ioredis/interfaces/CommonRedisOptions.html#enableOfflineQueue |
GW_LAZY_CONNECT | if PUBSUB_TYPE='redis' | https://luin.github.io/ioredis/interfaces/CommonRedisOptions.html#lazyConnect |
Build docker image
Dev image (default platform)
Build dev tag image
docker buildx bake
Build image with custom tag:
TAG=myCustomTag docker buildx bake
If you want to build multiplatform images:
docker buildx create --name multibuilder
docker buildx use multibuilder