diff --git a/README.md b/README.md index b6c6a58..bd4a549 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,17 @@ Test http://myendpoint.com. For more information on setting up backplane see `backplane help`. +### Multiple web server process types + +In order to route traffic to the correct dynos you can apply unique labels to a process type +by using the `BACKPLANE_LABELS_` environment variable. Only the backplane agents running +on dynos for the `` process type will apply these labels. Note: the labels from +`BACKPLANE_LABELS` will also be applied universally across all whitelisted process types. + +Example: + + $ heroku config:set BACKPLANE_LABELS_externalweb="endpoint=external.myendpoint.com" + ## Known Issues ### Fetch Error diff --git a/bin/compile b/bin/compile index 2d49b7a..327dd1b 100755 --- a/bin/compile +++ b/bin/compile @@ -18,8 +18,18 @@ install_backplane() { install_backplane +echo "-----> Backplane Agent sources labels from the enviroment varaible BACKPLANE_LABELS by default." +echo " Add unique labels for each process listed in the Procfile using BACKPLANE_LABELS_." +echo " Example: BACKPLANE_LABELS_web=\"endpoint=www.mydomain.com\"" + echo "-----> Writing .profile.d/backplane.sh" cat <<-EOF > $build/.profile.d/backplane.sh +CURRENT_PROCESS_TYPE=\${DYNO%.*} +BACKPLANE_LABELS_proc=BACKPLANE_LABELS_\${CURRENT_PROCESS_TYPE} +if [ -n \${!BACKPLANE_LABELS_proc+x} ]; then + BACKPLANE_LABELS="\$BACKPLANE_LABELS, \${!BACKPLANE_LABELS_proc}" +fi + BACKPLANE_LABELS="\$BACKPLANE_LABELS, heroku=true" \$HOME/bin/backplane connect "\$BACKPLANE_LABELS" http://127.0.0.1:\$PORT & EOF