Skip to content

Repository files navigation

Node Server

Overview

The Node Server represents a server running on a node of a distributed file storage system. This repository provides functionalities for accepting files and storing them. Additionally, it offers functionalities to retrieve file chunks. In practical distributed storage systems, there would typically be a server like this running on every node.

Setup

Prerequisites

  • Python 3.x installed on your system.
  • Ensure pip is installed (Python's package installer).

Installation

  1. Clone the repository to your local machine:
git clone https://github.com/jananga99/node-server.git
  1. Navigate to the project directory:
cd node-server
  1. Create the .env
cp .env.example .env
  1. Create a virtual environment:
python3 -m venv .venv
  1. Activate the virtual environment. This step may vary depending on your operating system:

For Windows:

.venv\Scripts\activate

For MacOS and Linux:

source .venv/bin/activate
  1. Install the required dependencies:
pip install -r requirements.txt

Alternatively, pre.sh can be used to automate steps 4 and 5

chmod +x ./pre.sh
./pre.sh

Usage

Running the Server

To start the server, run the following command:

python3 index.py

Alternatively, start.sh can be used.

chmod +x ./start.sh
./start.sh

Interacting with the Server

Once the server is running, you can interact with it through HTTP requests. Here are some of the available endpoints:

  • Upload File Chunk: POST request to /chunks with the file chunk data to be uploaded.
  • Retrieve File Chunk: GET request to /chunk/<file_id> to retrieve a specific chunk of a file by its ID.

File Storage

The server stores files locally on the node. Ensure that sufficient storage space is available on the node for storing files.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages