diff --git a/README.md b/README.md index 5698a60..20ef6f4 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,12 @@ This repo has the example code to run the php producer and consumer setup with k ## Steps to run in Local -Before start executing the below commands please make sure you have minikube installed and renamed the .env.default to .env and make sure all values are updated as per streamnative cluster. +Before start executing the below commands please make sure you have minikube,kubectl and set kubectl context to minikube and rename the env.default to .env and make sure all values are updated as per streamnative cluster. minikube start - cd k8s - kubectl apply -f ./ - cd ../source setenv.sh - minikube service nginx-service -n default - - Then navigate to http://host/index.php to send messages + source setenv.sh + Then Enter some value the form and submit Then navigate to http://host/consumer.php to see the messages diff --git a/k8s/nginx-configmap.yaml b/k8s/nginx-configmap.yaml index c493293..c2ab8c4 100644 --- a/k8s/nginx-configmap.yaml +++ b/k8s/nginx-configmap.yaml @@ -12,8 +12,9 @@ data: location / { root /var/www/html; - index index.php index.html index.htm; + try_files $uri $uri/ /index.php$is_args$args; } + location ~ consumer\.php$ { root /var/www/html; fastcgi_pass consumer-service:9000; diff --git a/setenv.sh b/setenv.sh index e8854b8..d682efc 100644 --- a/setenv.sh +++ b/setenv.sh @@ -1,5 +1,9 @@ #!/bin/bash + cd k8s + kubectl apply -f ./ + cd .. + # Load the .env file export $(grep -v '^#' .env | xargs) @@ -20,3 +24,5 @@ kubectl set env deployment/producer-deployment SECURITY_PROTOCOL=$SECURITY_PROTO TOPIC_NAME=$TOPIC_NAME \ CONSUMER_GROUP_ID=$CONSUMER_GROUP_ID +minikube service nginx-service -n default +