https://github.com/willie-conway/deploying-microservices
A simple microservice 🎶 that allows you to interact with a collection of songs 🎧. Built using Flask 🐍 and integrated with MongoDB 🗃️ for storing song information. The service is deployed on RedHat OpenShift ☁️ and IBM Code Engine 🚀 for scalability and management.
https://github.com/willie-conway/deploying-microservices
api backend code-engine devops flask microservices mongodb openshift python
Last synced: 9 months ago
JSON representation
A simple microservice 🎶 that allows you to interact with a collection of songs 🎧. Built using Flask 🐍 and integrated with MongoDB 🗃️ for storing song information. The service is deployed on RedHat OpenShift ☁️ and IBM Code Engine 🚀 for scalability and management.
- Host: GitHub
- URL: https://github.com/willie-conway/deploying-microservices
- Owner: Willie-Conway
- License: apache-2.0
- Created: 2025-03-14T03:56:42.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-03-14T04:59:52.000Z (12 months ago)
- Last Synced: 2025-06-01T12:59:32.835Z (9 months ago)
- Topics: api, backend, code-engine, devops, flask, microservices, mongodb, openshift, python
- Language: Python
- Homepage:
- Size: 13.1 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🎶 Deploying Songs Microservices 🎵
Welcome to the **Songs Microservice**! This is a simple microservice that provides access to a collection of songs. It's built using **Flask** and connects to a **MongoDB** database to store song information. 🚀

## 💡 Features
- 🎤 **Add songs** to the database.
- 🎧 **Retrieve all songs** from the database.
- 🎶 **Health Check** endpoint to verify the service is up and running.
## 🛠️ Technologies Used
- **Python** 🐍
- **Flask** 🐚
- **MongoDB** 🗃️
- **OpenShift** ☁️
- **GitHub** 💻
## 🎯 Learning Objectives
After completing this lab, you will be able to:
- Start **Code Engine** service in the lab environment.
- Deploy a **Flask service** to **Code Engine**.
- Access the **RedHat OpenShift** platform in the lab environment.
- Deploy a **Flask service** to **RedHat OpenShift**.
## 📦 Setup Instructions
### 1️⃣ Clone the Repository
Clone the repository to your local machine:
```bash
git clone https://github.com/Willie-Conway/Deploying-Microservices.git
```
### 2️⃣ Install Dependencies
Navigate to the project directory and set up a virtual environment:
```bash
cd Back-End-Development-Songs
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
```
### 3️⃣ Configure MongoDB
Ensure that the MongoDB service is up and running. Use the internal MongoDB URL for OpenShift or any other connection string.
Example MongoDB URL:
```
mongo.sn-labs-hirewillieco.svc.cluster.local
```
### 4️⃣ Running the Service Locally
To run the microservice locally:
```bash
python app.py
```
Visit `http://localhost:5000` to see the service in action! 🎉
### 5️⃣ Deploy to OpenShift
To deploy the microservice to OpenShift, use the following command:
```bash
oc new-app https://github.com/${GITHUB_ACCOUNT}/Back-End-Development-Songs --strategy=source --name=songs --env MONGODB_SERVICE=mongo.${OPENSHIFT_PROJECT}.svc.cluster.local --name songs
```
## 🌐 Accessing the Service
Once deployed, you can access the Songs microservice via the following URL:
```text
http://songs-sn-labs-hirewillieco.labs-prod-openshift-san-a45631dc5778dc6371c67d206ba9ae5c-0000.us-east.containers.appdomain.cloud
```
Use the `/health` endpoint to check if the service is running smoothly:
```text
http://songs-sn-labs-hirewillieco.labs-prod-openshift-san-a45631dc5778dc6371c67d206ba9ae5c-0000.us-east.containers.appdomain.cloud/health
```
It will return a response like:
```json
{
"status": "OK"
}
```
## 📸 Screenshots
### 1️⃣ Deploying the Songs microservice on RedHat OpenShift

### 2️⃣ Exposing the Service

### 3️⃣ Health Check Endpoint Response

## 🚧 Contributing
If you'd like to contribute, feel free to open an issue or pull request. 😊
1. Fork the repo 🍴
2. Create your feature branch 🧑💻
3. Commit your changes ✍️
4. Push to the branch 🚀
5. Open a pull request 👥
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 📝
## 💬 Contact
For any questions or suggestions, feel free to reach out to me via:
- Email: hire.willie.conway@gmail.com 📧
- GitHub: [Willie-Conway](https://github.com/Willie-Conway) 👨💻
Happy coding! 🎉