mesos/spark — pull request #316 by JoshRosen (2012-12-02 02:30:56+00:00)
Title: Use external addresses in standalone web UI when running on EC2

This patch modifies the standalone cluster launch scripts to detect when they are run on EC2 so that links in the web UI use machines' externally-accessible addresses. This is a first pass at fixing [SPARK-613](https://spark-project.atlassian.net/browse/SPARK-613); I'm submitting it here for review.

This solution is modeled on the `MESOS_PUBLIC_DNS` environment variable used in the Mesos EC2 scripts.

In Spark's scripts, I pattern-match the machine's hostname to determine whether it is running on EC2 before attempting to resolve its public address. Is there a better way to do this? I don't want to use a method that relies on contacting an external service, since this might slow or break the script for users who run standalone clusters that do not have internet access. Relying on the hostname is fine for clusters created with our EC2 scripts, but custom EC2 clusters might use a different hostname scheme.

I used a `SPARK_PUBLIC_DNS` environment variable to set each slave's public address; should this be a command-line option to the standalone worker instead?