This Flask web application interacts with CloudStack to fetch and display usage records based on user inputs such as domainID
, start date
, and end date
.
- User-friendly input form for
domainID
,start date
, andend date
- Fetches usage records from CloudStack API
- Displays formatted usage records in the browser
- Caches results using Redis for improved performance
- Filters usage records by type
- Aggregates usage data for better readability
- Docker
- Docker Compose
- CloudStack API credentials
-
Clone this repository:
git clone https://github.com/vaheed/cloudstack-usage-webapp.git cd cloudstack-usage-webapp
-
Create a
.env
file in the project root and add your CloudStack API credentials:CLOUDSTACK_API_URL=http://your-cloudstack-api-url CLOUDSTACK_ACCESS_KEY=your-access-key CLOUDSTACK_SECRET_KEY=your-secret-key
-
Build and run the Docker containers:
docker-compose up --build
-
Open your browser and navigate to
http://localhost:5000
to view the web app.
- Enter the Domain ID in the provided field.
- Select the start and end dates for the usage period.
- Optionally, select specific usage types to filter the results.
- Click "Submit" to fetch and display the usage records.
app.py
: Main Flask application fileDockerfile
: Instructions for building the Docker imagedocker-compose.yml
: Defines and runs the multi-container Docker applicationrequirements.txt
: Lists Python dependenciestemplates/
: Contains HTML templates for the web interface.env
: Stores environment variables (not tracked in git).gitignore
: Specifies intentionally untracked files to ignore
To run the application in development mode:
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
- If you encounter connection issues with CloudStack, ensure your API credentials and URL are correct in the
.env
file. - For Redis connection errors, make sure the Redis container is running (
docker-compose ps
).
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is open-source and free to use. See the LICENSE file for details.