-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First official release on pypi! hip hip hooray! Resourcefit is now in…
… its alpha stages
- Loading branch information
Showing
16 changed files
with
357 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
|
||
# ResourceFit | ||
|
||
**ResourceFit** is a command-line tool designed to analyze Docker container resource usage and recommend the most cost-effective Amazon Web Services (AWS) EC2 instances based on the container's memory, CPU, and disk space requirements. It fetches real-time container stats, normalizes the data, and compares them against available EC2 instance options, taking AWS EBS storage and pricing into account. | ||
|
||
## Features | ||
|
||
- **Host Machine Stats:** Collects and displays CPU, memory, disk, and network information from the host machine. | ||
- **Docker Container Stats:** Analyzes running Docker containers, showing stats like CPU usage, memory consumption, and network I/O. | ||
- **EC2 Recommendations:** Recommends AWS EC2 instances based on the resource needs of the selected Docker container. | ||
- **AWS Pricing Data:** Fetches EC2 and EBS pricing data to make cost-efficient recommendations. | ||
- **Memory and Disk Space Buffers:** Includes customizable memory buffers (50-100%) to ensure recommended instances meet peak resource demands. | ||
|
||
## Installation | ||
|
||
To install ResourceFit, follow the steps below: | ||
|
||
1. Have python (version 3.9 and above) installed on your device, follow the link below to do this: | ||
|
||
```bash | ||
https://www.python.org/downloads/ | ||
``` | ||
|
||
2. Install ResourceFit: | ||
|
||
```bash | ||
pip install resourcefit | ||
``` | ||
|
||
## Usage | ||
|
||
Once installed, you can use `resourcefit` from the command line: | ||
|
||
```bash | ||
resourcefit | ||
``` | ||
|
||
The tool will: | ||
|
||
1. Display a list of running Docker containers. | ||
2. Allow you to select a container to analyze. | ||
3. Show real-time stats for the selected container (CPU, memory, I/O). | ||
4. Fetch and display AWS EC2 and EBS pricing data. | ||
5. Recommend the top three EC2 instances based on the selected container's resource usage and disk space requirements. | ||
## Example Output | ||
```bash | ||
Select a container to analyze: | ||
1. webapp (ID: 123abc456def) - Image: webapp:latest | ||
2. nginx (ID: 789ghi012jkl) - Image: nginx:latest | ||
Enter the number of the container (default 1) [1]: | ||
Selected Container ID: 123abc456def | ||
Docker Container Stats: | ||
container_id: 123abc456def | ||
name: webapp | ||
cpu_usage: 0.24% | ||
mem_usage: 256.00 MiB / 1.00 GiB | ||
mem_percentage: 25.00% | ||
net_io_rx: 10.00 kB | ||
net_io_tx: 5.00 kB | ||
block_io_read: 0.00 MB | ||
block_io_write: 0.05 MB | ||
pids: 5 | ||
Fetching AWS EC2 pricing data... | ||
Top 3 EC2 Instance Recommendations: | ||
Instance Type Memory vCPU Storage priceMonthly | ||
191 t4g.nano 0.5 2 EBS only (5.00 GB) 3.466 | ||
277 t3a.nano 0.5 2 EBS only (5.00 GB) 3.831 | ||
648 t3.nano 0.5 2 EBS only (5.00 GB) 4.196 | ||
``` | ||
## Dependencies | ||
ResourceFit requires the following Python libraries: | ||
- `psutil`: For host machine stats. | ||
- `docker`: For Docker container stats. | ||
- `pandas`: For data handling. | ||
- `requests`: To fetch AWS pricing data. | ||
- `click`: For the command-line interface. | ||
## How It Works | ||
### Step 1: Host Machine Stats | ||
The tool collects basic host machine stats, including CPU count, memory size, disk I/O, and network I/O. | ||
### Step 2: Docker Container Stats | ||
It lists running Docker containers and provides real-time statistics (CPU, memory, and I/O usage) for the selected container. | ||
### Step 3: AWS Pricing Data | ||
ResourceFit fetches EC2 and EBS pricing data from AWS for both Linux and Windows instances in the specified region. | ||
### Step 4: EC2 Instance Recommendations | ||
Based on the Docker container stats, ResourceFit recommends the top EC2 instances, applying a 50% memory buffer for peak loads. It also factors in disk space requirements for instances with EBS storage. | ||
## Customization | ||
### Memory Buffer Factor | ||
The default memory buffer factor is set to 1.5 (50% more memory). This can be adjusted in the source code based on your needs. | ||
### AWS Region | ||
By default, the AWS region is set to 'US East (N. Virginia)', but this can be modified in the code to support different regions. | ||
## License | ||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. | ||
## Contributing | ||
Contributions are welcome! Please feel free to submit pull requests or open issues if you encounter any bugs or have feature requests. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[build-system] | ||
requires = ["setuptools>=64.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "resourcefit" | ||
version = "0.1.0" | ||
description = "CLI tool for analyzing Docker containers and recommending EC2 instances." | ||
authors = [ | ||
{name = "Olayinka Jimba Jr.", email = "[email protected]"} | ||
] | ||
requires-python = ">=3.9" | ||
dependencies = [ | ||
"psutil", | ||
"pandas", | ||
"requests", | ||
"click", | ||
"docker", | ||
] | ||
readme = "README.md" | ||
license = { text = "MIT" } | ||
keywords = ["docker", "EC2", "AWS", "cloud"] | ||
|
||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Topic :: Software Development :: Build Tools", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Operating System :: OS Independent" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/ojimba01/resourcefit" | ||
Repository = "https://github.com/ojimba01/resourcefit" | ||
"Bug Tracker" = "https://github.com/ojimba01/resourcefit/issues" | ||
|
||
[project.scripts] | ||
resourcefit = "resourcefit.main:analyze_and_recommend" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
Metadata-Version: 2.1 | ||
Name: resourcefit | ||
Version: 0.1.0 | ||
Summary: CLI tool for analyzing Docker containers and recommending EC2 instances. | ||
Home-page: https://github.com/ojimba01/resourcefit | ||
Author: Olayinka Jimba | ||
Author-email: "Olayinka Jimba Jr." <[email protected]> | ||
License: MIT | ||
Project-URL: Homepage, https://github.com/ojimba01/resourcefit | ||
Project-URL: Repository, https://github.com/ojimba01/resourcefit | ||
Project-URL: Bug Tracker, https://github.com/ojimba01/resourcefit/issues | ||
Keywords: docker,EC2,AWS,cloud | ||
Classifier: Development Status :: 3 - Alpha | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Topic :: Software Development :: Build Tools | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Programming Language :: Python :: 3.9 | ||
Classifier: Programming Language :: Python :: 3.10 | ||
Classifier: Programming Language :: Python :: 3.11 | ||
Classifier: Programming Language :: Python :: 3.12 | ||
Classifier: Operating System :: OS Independent | ||
Requires-Python: >=3.12.4 | ||
Description-Content-Type: text/markdown | ||
Requires-Dist: psutil | ||
Requires-Dist: pandas | ||
Requires-Dist: requests | ||
Requires-Dist: click | ||
Requires-Dist: docker | ||
|
||
|
||
# ResourceFit | ||
|
||
**ResourceFit** is a command-line tool designed to analyze Docker container resource usage and recommend the most cost-effective Amazon Web Services (AWS) EC2 instances based on the container's memory, CPU, and disk space requirements. It fetches real-time container stats, normalizes the data, and compares them against available EC2 instance options, taking AWS EBS storage and pricing into account. | ||
|
||
## Features | ||
|
||
- **Host Machine Stats:** Collects and displays CPU, memory, disk, and network information from the host machine. | ||
- **Docker Container Stats:** Analyzes running Docker containers, showing stats like CPU usage, memory consumption, and network I/O. | ||
- **EC2 Recommendations:** Recommends AWS EC2 instances based on the resource needs of the selected Docker container. | ||
- **AWS Pricing Data:** Fetches EC2 and EBS pricing data to make cost-efficient recommendations. | ||
- **Memory and Disk Space Buffers:** Includes customizable memory buffers (50-100%) to ensure recommended instances meet peak resource demands. | ||
|
||
## Installation | ||
|
||
To install ResourceFit, follow the steps below: | ||
|
||
1. Clone the repository: | ||
|
||
```bash | ||
git clone https://github.com/yourusername/ResourceFit.git | ||
cd ResourceFit | ||
``` | ||
|
||
2. Install ResourceFit in editable mode: | ||
|
||
```bash | ||
pip install -e . | ||
``` | ||
|
||
## Usage | ||
|
||
Once installed, you can use `resourcefit` from the command line: | ||
|
||
```bash | ||
resourcefit | ||
``` | ||
|
||
The tool will: | ||
|
||
1. Display a list of running Docker containers. | ||
2. Allow you to select a container to analyze. | ||
3. Show real-time stats for the selected container (CPU, memory, I/O). | ||
4. Fetch and display AWS EC2 and EBS pricing data. | ||
5. Recommend the top three EC2 instances based on the selected container's resource usage and disk space requirements. | ||
|
||
## Example Output | ||
|
||
```bash | ||
Select a container to analyze: | ||
1. webapp (ID: 123abc456def) - Image: webapp:latest | ||
2. nginx (ID: 789ghi012jkl) - Image: nginx:latest | ||
|
||
Enter the number of the container (default 1) [1]: | ||
|
||
Selected Container ID: 123abc456def | ||
|
||
Docker Container Stats: | ||
container_id: 123abc456def | ||
name: webapp | ||
cpu_usage: 0.24% | ||
mem_usage: 256.00 MiB / 1.00 GiB | ||
mem_percentage: 25.00% | ||
net_io_rx: 10.00 kB | ||
net_io_tx: 5.00 kB | ||
block_io_read: 0.00 MB | ||
block_io_write: 0.05 MB | ||
pids: 5 | ||
|
||
Fetching AWS EC2 pricing data... | ||
|
||
Top 3 EC2 Instance Recommendations: | ||
Instance Type Memory vCPU Storage priceMonthly | ||
191 t4g.nano 0.5 2 EBS only (5.00 GB) 3.466 | ||
277 t3a.nano 0.5 2 EBS only (5.00 GB) 3.831 | ||
648 t3.nano 0.5 2 EBS only (5.00 GB) 4.196 | ||
``` | ||
|
||
## Dependencies | ||
|
||
ResourceFit requires the following Python libraries: | ||
|
||
- `psutil`: For host machine stats. | ||
- `docker`: For Docker container stats. | ||
- `pandas`: For data handling. | ||
- `requests`: To fetch AWS pricing data. | ||
- `click`: For the command-line interface. | ||
|
||
## How It Works | ||
|
||
### Step 1: Host Machine Stats | ||
The tool collects basic host machine stats, including CPU count, memory size, disk I/O, and network I/O. | ||
|
||
### Step 2: Docker Container Stats | ||
It lists running Docker containers and provides real-time statistics (CPU, memory, and I/O usage) for the selected container. | ||
|
||
### Step 3: AWS Pricing Data | ||
ResourceFit fetches EC2 and EBS pricing data from AWS for both Linux and Windows instances in the specified region. | ||
|
||
### Step 4: EC2 Instance Recommendations | ||
Based on the Docker container stats, ResourceFit recommends the top EC2 instances, applying a 50% memory buffer for peak loads. It also factors in disk space requirements for instances with EBS storage. | ||
|
||
## Customization | ||
|
||
### Memory Buffer Factor | ||
The default memory buffer factor is set to 1.5 (50% more memory). This can be adjusted in the source code based on your needs. | ||
|
||
### AWS Region | ||
By default, the AWS region is set to 'US East (N. Virginia)', but this can be modified in the code to support different regions. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please feel free to submit pull requests or open issues if you encounter any bugs or have feature requests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
README.md | ||
pyproject.toml | ||
setup.py | ||
resourcefit/__init__.py | ||
resourcefit/main.py | ||
resourcefit.egg-info/PKG-INFO | ||
resourcefit.egg-info/SOURCES.txt | ||
resourcefit.egg-info/dependency_links.txt | ||
resourcefit.egg-info/entry_points.txt | ||
resourcefit.egg-info/requires.txt | ||
resourcefit.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[console_scripts] | ||
resourcefit = resourcefit.main:analyze_and_recommend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
psutil | ||
pandas | ||
requests | ||
click | ||
docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
resourcefit |
Empty file.
Binary file not shown.
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name="resourcefit", | ||
version="0.1.0", | ||
packages=find_packages(), | ||
install_requires=[ | ||
'psutil>=5.9.5', | ||
'pandas>=2.0.0', | ||
'requests>=2.31.0', | ||
'click>=8.0.0', | ||
'docker>=6.0.0', | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'resourcefit=resourcefit.main:analyze_and_recommend', | ||
], | ||
}, | ||
author="Olayinka Jimba", | ||
author_email="[email protected]", | ||
description="A CLI tool to analyze Docker containers and recommend AWS EC2 instances.", | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
url="https://github.com/ojimba01/resourcefit", | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires='>=3.12.4', | ||
) |
Oops, something went wrong.