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.
- Python 3.x installed on your system.
- Ensure pip is installed (Python's package installer).
- Clone the repository to your local machine:
git clone https://github.com/jananga99/node-server.git- Navigate to the project directory:
cd node-server- Create the .env
cp .env.example .env- Create a virtual environment:
python3 -m venv .venv- Activate the virtual environment. This step may vary depending on your operating system:
.venv\Scripts\activatesource .venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txtAlternatively, pre.sh can be used to automate steps 4 and 5
chmod +x ./pre.sh
./pre.shTo start the server, run the following command:
python3 index.pyAlternatively, start.sh can be used.
chmod +x ./start.sh
./start.shOnce 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.
The server stores files locally on the node. Ensure that sufficient storage space is available on the node for storing files.