worph / OrbitDB-DockerNode

2 stars 0 forks source link

OrbitDB Node in Docker

This repository contains a Docker setup for running an OrbitDB node using Node.js. OrbitDB is a serverless, distributed, peer-to-peer database. It uses IPFS as its data storage and libp2p for the network layer.

Overview

The project is structured to build and run in a Docker environment, ensuring a seamless setup and deployment process. It utilizes a two-stage Docker build process to create a lightweight, production-ready image.

Features

Prerequisites

Getting Started

  1. Clone the Repository
git clone <repository-url>
cd <repository-directory>
  1. Build the Docker Image
docker build -t orbitdb-node .
  1. Run the Container Using Docker Compose

    Below is an example docker-compose.yml file to run the OrbitDB node:

    version: '3.8'
    services:
     orbit-db:
       image: rg.fr-par.scw.cloud/aptero/orbit-db:latest
       ports:
         - "4001:4001"
       environment:
         DB_NAME: "test123"
         DB_TYPE: "keyvalue"
         PORT: "4001"
         HOST: "51.159.100.53"
         BOOTSTRAP: "/ip4/51.159.100.53/tcp/4001/p2p/QmYourPeerId" # Use when connecting nodes together
       volumes:
         - "./data:/app/data" # the orbitdb data (keystore, data, etc.)
         - "./peer-id.json:/app/peer-id.json" # the peer id of the node (public and private key) secret
       restart: unless-stopped

Adjust the BOOTSTRAP environment variable as necessary to include the multi-address of your bootstrap node(s) for connecting multiple nodes together.

  1. Start the Service

    docker-compose up -d

Configuration

The application can be configured via environment variables. Here are some of the key environment variables:

Development

For local development, you can follow the Docker build steps or set up your environment to run the Node.js application directly. Ensure you have all dependencies installed:

yarn install

And then build and start the application:

yarn run build
node dist/

Testing

(Optional) To run tests, ensure you have the testing environment set up and execute:

yarn test

Contributing

Contributions are welcome! Please read the contributing guidelines before starting any work.

License

This project is licensed under the MIT License - see the LICENSE file for details.