- Clone this repo
cd national-parks-demo
- Export environment variables to forward ports on the
export HAB_DOCKER_OPTS='-p 8000:8000 -p 8080:8080 -p 8085:8085 -p 9631:9631'
hab studio enter
build
source results/last_build.env
- Load
core/mongodb
package from the public depot:
hab svc load core/mongodb/3.2.10/20171016003652
- Override the default configuration of mongodb:
hab config apply mongodb.default $(date +%s) habitat/mongo.toml
- Load the most recent build of national-parks:
hab svc load $pkg_ident --bind database:mongodb.default
- Load
core/haproxy
from the public depot:hab svc load core/haproxy --bind backend:national-parks.default
- Override the default configuration of HAProxy:
hab config apply haproxy.default $(date +%s) habitat/haproxy.toml
- Run
sup-log
to see the output of the supervisor
You should now be able to hit the front end of the national-parks site as follows:
- Directly -
http://localhost:8080/national-parks
- HAProxy -
http://localhost:8085/national-parks
You can also view the admin console for HAProxy to see how the webserver was added dynamically to the load balancer:
http://localhost:8000/haproxy-stats
username: admin
password: password
There is also an index.html
file in the root of the repo that updates the map of the National-Parks app to use red pins and colored map. This can be used to demonstrate the package promotion capabilities of Habitat.
- create a new feature branch -
git checkout -b update_homepage
- Bump the
pkg_version
inhabitat/plan.sh
- Overwrite
src/main/webapp/index.html
with the contents of thered-index.html
in the root directory _NOTE: the index.html has a version number hard coded on line 38. Update that to your version number if you want it to match. hab studio enter
build
We would recommend proceeding with any of the following demos to learn more about running habitat in production.