| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# This script sets up the web servers. The web servers just output who |
| 4 |
# they are initially. Serf will do some additional configuration. Presumably |
| 5 |
# in a real environment you would use a real configuration management system |
| 6 |
# to do this. But for this demo a shell script is used for simplicity. |
| 7 |
# |
| 8 |
set -e |
| 9 |
|
| 10 |
# Install apache2 |
| 11 |
sudo apt-get update |
| 12 |
sudo apt-get install -y apache2 |
| 13 |
|
| 14 |
HOSTNAME=`hostname` |
| 15 |
cat <<EOF >/tmp/index.html |
| 16 |
I am "${HOSTNAME}" |
| 17 |
EOF |
| 18 |
sudo mv /tmp/index.html /var/www/index.html |