Sample node app for trying various openshift deployment strategies.
oc new-app --name nodeapp https://github.com/gunjangarge/sample-node-app --context-dir source
oc new-app --name nodeapp https://github.com/gunjangarge/sample-node-app
oc new-app --name nodeapp quay.io/gunjangarge/sample-node-app:v1
$ oc new-project blue-green-deploy
$ oc new-app --name appv1 quay.io/gunjangarge/sample-node-app -e COLOR=skyblue
$ oc expose svc/appv1 --name=app-route
Wait till pod is in "Running" state
$ curl $(oc get route app-route -o jsonpath='{.spec.host}')/deploy
Deploy new version,
$ oc new-app --name appv2 quay.io/gunjangarge/sample-node-app -e COLOR=darkcyan
For A/B deployment,
$ oc set route-backends app-route appv1=50 appv2=50
For Blue-Green deployment,
$ oc patch route app-route -p '{"spec":{"to":{"name":"appv2"}}}'
Check result,
$ while true; do curl $(oc get route app-route -o jsonpath='{.spec.host}')/deploy; sleep 3; done
You can also check route on browser to verify application is serving requests.