This is Dropbox like service where users can upload, retrieve, and manage their files
The filehub
directory holds the application logic
api/__init__.py
initializes the application, configures CORS, and includes a health check route.api/db.py
manages database CRUD operations for file metadata using MongoDB.api/files.py
implements a web API for file management, integrating with GCS and MongoDB.api/gcs.py
interacts with GCS for file upload, download, SignedURL generation, and deletion.api/logger.py
configures a basic logging system for the application.configs/config.py
loads configuration settings based on the application environment (FLASK_ENV)requirments.txt
Lists the dependencies required for running the project.docker-compose.yml
contains configuration that defines two services, 'mongo' and 'app', to facilitate the deployment of the application.Dockerfile
creates a lightweight image of application.requirments.txt
Lists the dependencies required for running the project.
The static
directory contains HTML, CSS and JS files responsible for the UI of the application.
Find detailed information about the FileHub APIs in API Documentation.
You can setup and run this application using docker or python virtual environment.
Clone the repository.
git clone git@github.com:RaviTejaKomma/filehub.git
Run Docker Compose
# navigate to the filehub directory
cd filehub
# run this command which starts the containers defined in the docker-compose.yml (i.e filehub flask app & mongo)
docker-compose up
Start a python virtual env:
# navigate to the filehub directory
cd filehub
# create the virtual environment for filehub
python3 -m venv filehub-venv
# activate the virtual environment
source filehub-venv/bin/activate
Install dependencies
python3 -m pip install -r requirements.txt
Start the application
flask --app api/ run
# comment 'app' service in the docker-compose.yml file and run docker compose in another terminal to start only the mongo service
docker-compose up
The FileHub application is accessible at localhost:5000
To verify its status, you can use the following curl
command to hit the health check API:
curl -X GET 'localhost:5000'
Application Status: A successful response indicates that the FileHub Flask application is up and running.
MongoDB Status: MongoDB is configured to run on port 27017.
Note: Ensure that no other services are currently using ports 5000 and 27017 before running the application.
- Navigate to the static directory:
cd static
- Open the
index.html
file in your preferred web browser. This will launch the FileHub UI