The Portworx Delivery App is useful for demonstrating Portworc Data Services where you need many different data services for your application to run correctly.
This application consists of a web application running golang. The Authentication system for the food ordering site, uses a MongoDB database. The ordering system submits orders to a Kafka queue where presumably many consumers would be reading this data. One of the consumers also written in golang will pull this data from kafka and push it into a mysql database. The golang web application performs reads from the mysql database. This pattern makes writes eventually consistent.
This application requires data services to be deployed prior to deploying the application. Before deploying this application, deploy a MongoDB Database, a Kafka Queue, and a Mysql Database. These databases can all be deployed by Portworx Data Services or manually.
Once the data services have been deployed, you can use the Kubernetes manifetsts in the Kubernetes folder to deploy the applications.
Update the Kubernetes manifests with connection information for the Kafka
instance, MongoDB
database, and MySQL
database. Specifically these environment variables:
MONGO_HOST
MONGO_USER
MONGO_PASS
KAFKA_HOST
KAFKA_PORT
MYSQL_HOST
MYSQL_USER
MYSQL_PASS
MYSQL_PORT
Then run the manifests in numbered order.
This will deploy:
- A namespace
- Portworx Delivery App (From Dockerhub) which uses MongoDB for auth and pushes to Kafka for Orders.
- Kafka Consumer that pulls from Kafka and pushes to MySQL
To run the Portworx Delivery App in docker run:
docker run -e "KAFKA_HOST=172.19.0.3" -e "KAFKA_PORT=9092" -e "MYSQL_HOST=127.0.0.1" -e "MYSQL_USER=root", -e "MYSQL_PASS=porxie", -e "MYSQL_PORT=3306" eshanks16/pxdelivery:v1
- Clone the repository
cd
to the px-delivery directory- Run
go mod tidy go run server.go