I created this to test out the usage of Nginx, for staged rollouts and A/B testing
- Install NPM and Docker
- Clone this project
- Run
npm run dev:start
to start the service - The service is now available on
localhost:8080
- Test out
/assigned
route to see the assignment methodology (cookies are eithera
,b
orc
) - Test out
/bucket/rollout-1
route to see the bucket methodology (cookie values range from 0 to 99). For this iteration,0-9
falls undera
instance,10-24
underb
, and25-99
underc
. - Test out
/bucket/rollout-2
route to see the bucket methodology for a second iteration (cookie values range from 0 to 99). For this iteration,0-24
falls undera
instance, and25-99
underc
. - Try using
/bucket/rollout-1?_segment_bucket_key=20
to see yourself at theb
instance for the first iteration. Then visit/bucket/rollout-2
to see yourself being transferred to thea
instance.
- Test out
- Run
npm run dev:stop
to stop the service.
I've added this to Google Cloud Platform (GCP), to make sure this idea works beyond running it locally.
- Run
./init-project %1% %2% %3%
to create your GCP Project for hosting this application:%1%
refers to your desired name for your project%2%
refers to your billingId. Tip: rungcloud beta billing accounts list
to see all your billing accounts.%3%
refers to your cloudRunRegion. I have chosen Cloud Run as a way to test this on a remote server instance, as Cloud Run is able to deploy an instance very quickly and simply, with a Dockerfile. See here: https://cloud.google.com/run/docs/locations , for all possible values of the region types.
- Run
npm run deploy %1%
to deploy this application%1%
refers to your previously chosen name for your GCP project.