🖥️

For system admin's

Installing The DeStor REST API on your infrastructure

Prerequisites

  1. 1.
    Storage Providers to securely store your data on the Filecoin network. Read more here!
  2. 2.
    A Filecoin wallet address. Read more here!
  3. 3.
    Infrastructure
    1. 1.
      Operating System (OS): Linux is a recommended choice due to its flexibility, security, and requirements needed to run the DeStor REST API. You'll need to select a Linux distribution that aligns with your organization's requirements.
    2. 2.
      Containerization with Docker: Docker has revolutionized the deployment of applications. It provides a lightweight, isolated environment for running applications and their dependencies. Docker containers can simplify application management and enhance portability.
    3. 3.
      Orchestration with Docker Compose: Docker Compose is a tool for defining and running multi-container Docker applications. It enables you to define services, networks, and volumes in a single docker-compose.yml file, streamlining the deployment and management of complex applications.
    4. 4.
      Now, Virtualization vs. Bare Metal: The choice between virtualization and bare-metal deployment depends on your environment. Virtualization, using hypervisors like VMware, KVM, or VirtualBox, allows you to run multiple virtual machines on a single physical server. It offers flexibility and resource allocation but may introduce some overhead. On the other hand, bare-metal deployments provide direct access to hardware resources, maximizing performance but reducing flexibility.
  4. 4.
    Hardware requirements
    1. 1.
      We recommend ensuring you have a minimum of 500GB of disk space available for staging data. Keep in mind that the complete Filecoin deal-making process may take up to 3 days, and during this time, you will need to retain all data until the deal-making process is complete. Therefore, it's advisable to have free disk space equivalent to the amount of data you intend to onboard per day, multiplied by 3.
    2. 2.
      In terms of system resources, the DeStor REST API is generally not resource-intensive regarding CPU or memory. However, for optimal performance, a machine with at least 32GB of RAM is recommended.
    3. 3.
      Additionally, ensure that the machine has Git installed to facilitate version control.
    4. 4.
      For network configuration, the server must have a static IP address and/or a domain name that points to it. It should also have an open port to enable data transfer from the DeStor REST API to Filecoin storage providers. This ensures a stable and accessible connection for managing your Filecoin data transfers.
Read more about access control here to secure your DeStor Rest API instance!

Setting up the DeStor REST API

Start by cloning this repository:
git clone https://github.com/filecoin-project/motion.git
Before you can run the DeStor REST API, you must configure it. First, from the the DeStor REST API directory, copy .env.example to .env:
cp .env.example .env
Now open .env and set the required values for your instance of the DeStor REST API. At minimum, you need to set the following values (excerpt from .env.example file):
# A comma seperated list of storage providers the DeStor REST API should make storage deals with
# You must set this value to contain at least one storage provider for the DeStor REST API to work
MOTION_STORAGE_PROVIDERS=
# The private key of the wallet you will use with the DeStor REST API, in hexadecimal format.
# This is the output of `lotus wallet export ~address~` if you are using lotus
# If you are obtaining a wallet through another method follow your wallet providers
# instructions to get your wallet's provider key
MOTION_WALLET_KEY=
# This is the domain/IP you will expose publicly to transfer data to storage providers
# When you initialize the singularity docker setup, it will start a server to deliver
# content to storage providers on localhost:7778. However, you will need to either
# open this specific port on your firewall, and set this value to http://~your-static-ip~:7778
# or you will need to setup reverse proxying from a dedicated web server like NGINX
SINGULARITY_CONTENT_PROVIDER_DOMAIN=
As needed, you can also set additional values in your motion `.env`` file for more custom configurations.

Starting you DeStor REST API instance

Once you've configured your .env, you're ready to start motion. From the local repository, simply run:
docker compose up
(if you don't want to see log messages directly in your terminal, run docker compose up -d)
You'll know your motion is up an running when you see a message like this in the docker logs:
2023-09-07 17:49:57 motion-motion-1 | 2023-09-08T00:49:57.530Z INFO motion/api/server server/server.go:53 HTTP server started successfully. {"address": "[::]:40080"}
Your copy of motion is now running. The Motion HTTP API is now running on port 40080 of your server's localhost.
Go to the For Developers section to test out your DeStor REST for Filecoin API.