The Order Management System is a Django-based web application that allows users to create, view, and delete orders. It also includes functionality to send SMS notifications to customers when an order is created, using the AfricasTalking API. The application is designed to be containerized with Docker and can be deployed using Kubernetes.
- Containerized using Docker and orchestrated using Kubernetes
- Deployed to Aptible (IAAS) at app-73154.on-aptible.com
- Used Django Test Framework for testing
- Implemented Auth0 via OpenID Connect
- Integrated AfricasTalking API for sending SMS notifications
- Created a CI/CD pipeline using GitHub Actions -Docker image is available on Docker Hub at franc254/order-mgt-system:latest
- User authentication and authorization using Auth0 via OPENID Connect
- Create new orders with customer details, item, and amount
- View order details
- Delete existing orders
- Send SMS notifications to customers upon order creation using the AfricasTalking API.
Before running the project, ensure that you have the following installed:
- Python 3.x
- Django (version compatible with your Python version)
- An Auth0 account and API credentials
- An AfricasTalking account and API credentials
- Docker (if running with Docker or Kubernetes)
- Kubernetes cluster (if running with Kubernetes)
- Clone the repository:
git clone [email protected]:Francis-Mwaniki/order-management-system.git
- Navigate to the project directory:
cd order-management-system
- Install the required Python packages:
pip install -r requirements.txt
- Create a
.env
file in the project root directory and add the following environment variables:
AUTH0_CLIENT_ID=your_auth0_client_id
AUTH0_CLIENT_SECRET=your_auth0_client_secret
AUTH0_DOMAIN=your_auth0_domain
AFRICAS_TALKING_USERNAME=your_africastalking_username
AFRICAS_TALKING_API_KEY=your_africastalking_api_key
Replace the placeholders with your actual Auth0 and AfricasTalking credentials.
- Run the Django migrations:
python manage.py migrate
- Start the development server:
python manage.py runserver 3000
The application should now be running at http://localhost:3000
.
docker pull franc254/order-mgt-system:latest
To run the application using Docker, follow these steps:
- Build the Docker image:
docker build -t order-management-system .
- Run the Docker container:
docker run -p 3000:8000 order-management-system
The application should now be running at http://localhost:3000
.
- Build the Docker image:
docker build -t order-management-system .
-
Push the Docker image to a container registry (e.g., Docker Hub, Google Container Registry, etc.).
-
Create a Kubernetes deployment and service using the provided Kubernetes manifests (e.g.,
deployment.yaml
andservice.yaml
). -
Apply the manifests to your Kubernetes cluster:
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
- Access the application using the assigned Kubernetes service URL or IP address.
- Navigate to the application URL in your web browser.
- Click the "Login" button to authenticate with Auth0.
- After successful authentication, you'll be redirected to the home page.
- Click the "Create Order" button to create a new order.
- Fill in the required details (customer, item, amount, and phone number), and click "Create Order".
- Upon successful order creation, an SMS notification will be sent to the provided phone number using the AfricasTalking API.
- You can view the order details on the home page.
- To delete an order, click the "Delete" button next to the order you wish to remove.
The project includes automated tests for the order management functionality. To run the tests, execute the following command:
python manage.py test myapp
Replace myapp
with the name of your Django app.
To deploy the application using Docker, follow these steps:
- Build the Docker image:
docker build -t order-management-system .
- Run the Docker container:
docker run -p 3000:8000 order-management-system
The application should now be accessible at http://localhost:3000
.
To deploy the application using Kubernetes, follow these steps:
- Build the Docker image:
docker build -t order-management-system .
-
Push the Docker image to a container registry (e.g., Docker Hub, Google Container Registry, etc.).
-
Create a Kubernetes deployment and service using the provided Kubernetes manifests (e.g.,
deployment.yaml
andservice.yaml
). -
Apply the manifests to your Kubernetes cluster:
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
- Access the application using the assigned Kubernetes service URL or IP address.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
The project is available as open source under the terms of the MIT License.