Skip to content

Storage Service Guide

Mohammad edited this page Nov 29, 2024 · 4 revisions

This guide provides information on choosing between different storage services to manage and store your simulation data in Drone World.

Storage Options Available

  • Google Cloud Storage:
    • Great for large-scale storage and high-speed access.
    • Ideal for projects that require scalability and cloud integration.
  • Google Drive Storage:
    • User-friendly and easy to share files.
    • Good for smaller projects or collaborative sharing.
    • Note: Currently very slow when viewing reports.

Switching Storage Services

You can easily switch between different storage services by simply commenting or uncommenting the relevant lines in storage_config.py.

File Location:
DroneWorld\backend\PythonClient\multirotor\storage\storage_config.py

Setting Up Your Own Storage

Option 1: Using Google Drive

1. Create a Service Account

  1. Go to the Google Cloud Console.
  2. Navigate to IAM & Admin > Service Accounts.
  3. Click Create Service Account, provide a name, and proceed.

2. Assign Permissions

  • Assign the Editor role to the service account for full file management.
  • Alternatively, for more restrictive access, assign:
    • Storage Object Viewer
    • Storage Object Creator

3. Generate and Download the Key

  1. After creating the service account, go to the Keys tab.
  2. Click Add Key > Create New Key and select JSON.
  3. Download the key.json file and store it securely.

4. Create a reports Folder

  1. In Google Drive, create a folder named reports in the root of your Drive.
  2. Right-click the folder, select Share, and add the service account’s email (found in the key.json file) with Editor access.

5. Configure the Application

  1. Place the downloaded key.json file in DroneWorld\backend.
  2. Update the folder_id in storage_configuration.py with the ID of your shared Google Drive folder:
    • Right-click the folder in Google Drive, select Get Link, and copy the folder ID from the URL (e.g., https://drive.google.com/drive/folders/<folder_id>).

Option 2: Using Google Cloud Storage (GCS)

1. Create a Storage Bucket

  1. In the Google Cloud Console, go to Storage > Buckets.
  2. Click Create Bucket, provide a unique name, and complete the setup.

2. Create a Service Account

  1. Navigate to IAM & Admin > Service Accounts.
  2. Click Create Service Account, provide a name, and proceed.

3. Assign Permissions

  • Assign the following roles to the service account:
    • Storage Object Viewer
    • Storage Object Creator

4. Generate and Download the Key

  1. After creating the service account, go to the Keys tab.
  2. Click Add Key > Create New Key and select JSON.
  3. Download the key.json file and store it securely.

5. Create a reports Folder in Your Bucket

  1. Navigate to your GCS bucket in the Google Cloud Console.
  2. Create a folder named reports in the root of your bucket.

6. Update Bucket Permissions

  1. Go to your GCS bucket in the Google Cloud Console.
  2. Navigate to the Permissions tab.
  3. Click Grant Access and add the service account’s email (from key.json).
  4. Assign the roles:
    • Storage Object Viewer
    • Storage Object Creator

7. Configure the Application

  1. Place the downloaded key.json file in DroneWorld\backend.
  2. Update the bucket_name in storage_configuration.py with the name of your GCS bucket.

General Tips

  • Secure Your Credentials: Keep the key.json file safe and do not share it publicly or commit it to version control.
  • Adjust Permissions as Needed: You can modify IAM roles if you require different access levels.
  • Restart the Application: Restart the application after making configuration changes to apply the new settings.
  • Test the Setup: Upload a test file to ensure the application interacts with your chosen storage service correctly.