This repository contains the source code and deployment scripts for the Hailstone Calculator project.
The Hailstone Calculator is a Python application that calculates the Hailstone sequence for a given starting number. It utilizes FastAPI for seamless deployment and is containerized using Docker. It is deployed on Azure Functions and AWS Lambda and Terraform is employed to provision and manage the required infrastructure.
This outlines the requirements for building, testing, and deploying the Hailstone Calculator project. The project utilizes a Makefile for task automation across different platforms.
The project relies on several software dependencies for development, testing, and deployment. Ensure the following tools are installed on your system:
- Python: Version 3.10
- Pip: Python package installer
- Docker: Containerization platform
- AWS CLI: Command-line interface for interacting with AWS services
- Terraform: Infrastructure as Code (IaC) tool for provisioning and managing cloud infrastructure
- Azure Functions Core Tools: Command-line interface for creating Azure Functions
- Make: Build and Automation of Scripts
- Git: For Version Control
To set up the project, follow these steps:
Clone the project repository from the source.
git clone https://github.com/iaanimashaun/hailstone_calculator.git
cd hailstone_calculator
Create a .env file in the project root and define the following environment variables:
# AWS Configuration
AWS_ECR_REPO_NAME = XXXXXXX
AWS_REGION = xx-xxxx-x
AWS_ACCOUNT_ID = XXXXXXXXXXXX
# Azure Configuration
AZURE_ACR_NAME=XXXXX
AZURE_RESOURCE_GROUP=XXXXXXX
AZURE_ACR_SKU=Basic
AZURE_PORT = 7079
AZURE_ACR_NAME = XXXXXXX
It is recommended to create a virtual environment to manage project dependencies. Follow any of these methods to set up a virtual environment:
pip install virtualenv
Navigate to the project directory and create a virtual environment:
cd hailstone_calculator
virtualenv venv
On Windows:
bash
venv\Scripts\activate
On Unix or MacOS:
source venv/bin/activate
Download and install Miniconda or Anaconda from Conda's website.
Navigate to the project directory and create a Conda environment:
cd hailstone_calculator
conda create --name myenv python=3.10
Activate the Conda environment:
conda activate myenv
The following commands can be executed using the Makefile targets:
make install
make run
make run_lambda
make run_azure_function
Initialize Terraform backend:
make terraform_init
Generate and display Terraform execution plan:
make terraform_plan
Apply Terraform infrastructure changes:
make terraform_apply
make build_push
Remove Docker containers and images:
make clean
Generate Markdown documentation for Terraform configurations:
make terraform_docs