30 Days DevOps Challenge - Weather Dashboard

30 Days DevOps Challenge - Weather Dashboard

Setting Up Your Weather Dashboard with Azure Blob Storage

Introduction

Hi my Name is Ford and I recently joined a 30daysdevopschallenge. In this article we are Creating a weather dashboard that fetches data from the OpenWeather API and stores it in Azure Blob Storage. This guide will walk you through the steps to set up your environment, create necessary Azure resources, and run the script to save weather data for various cities.

Prerequisites

Before you begin, ensure you have the following:

  • Python 3.6 or higher installed on your machine.

  • An Azure subscription.

  • An OpenWeather API key.

Step-by-Step Instructions

  1. Clone the Repository

    Start by cloning the project repository to your local machine:

     git clone https://github.com/annoyedalien/30daysdevops-week1.git
     cd 30daysdevops-week1
    
  2. Create a Virtual Environment

    Set up a virtual environment to manage your project dependencies:

     python3 -m venv venv
     source venv/bin/activate
    
  3. Install Dependencies

    Install the required libraries using pip:

     pip install -r requirements.txt
    
  4. Create a .env File

    Create a .env file in the project directory to store your credentials:

    💡
    OPENWEATHER_API_KEY you must signup to https://home.openweathermap.org/ to get your own api key
     AZURE_SUBSCRIPTION_ID=your_subscription_id
     AZURE_RESOURCE_GROUP=your_resource_group
     AZURE_STORAGE_ACCOUNT=your_storage_account
     AZURE_CONTAINER_NAME=your_container_name
     OPENWEATHER_API_KEY=your_openweather_api_key
    
  5. Run the Script

    Execute the main script to create Azure resources and fetch weather data:

     python main.py
    

    The script will:

    • Create the Azure Resource Group if it doesn't exist.

    • Create the Azure Storage Account if it doesn't exist.

    • Create the Azure Blob Container if it doesn't exist.

    • Fetch weather data for specified cities.

    • Save the weather data to Azure Blob Storage.

Cleanup

./deleteall.sh

This will:

Delete all resource groups and all resources

Conclusion

By following these steps, you will have a fully functional weather dashboard that stores data in Azure Blob Storage. This project not only helps you understand how to interact with Azure services programmatically but also demonstrates the power of combining APIs and cloud storage for data management.