Simple web app providing detailed weather/astronomical data from nearby Wunderground stations.
- First you need an API key from Wunderground.
- Get free account and API key from Wunderground:
- Create account at: https://www.wunderground.com/weather/api
- Under "Key Settings", you can get free developer API key.
- Configure WeathSnap to use your API key. Two choices for doing this:
- Put your key in a file:
- Create folder "secrets" at top-level of your repo clone, as sibling to folder "src". (The .gitignore file excludes this folder from git.)
- In that folder, put your API key in file "./secrets/wunder-api-key".
- Alternatively, you could put your key in an environment variable:
- WUNDER_API_KEY (must be accessible to the container)
- Put your key in a file:
- Get free account and API key from Wunderground:
- To run WeathSnap app locally in your development environment, you do not need to
do any make or build. This web app runs as-is inside
a Docker container that's based on the official Docker image for PHP.
- Run this command from top-level of your repo clone:
docker run -d --rm -p 8050:80 --name weathsnap-app-dev -v "$PWD/src/":/var/www/html -v "$PWD/secrets/":/var/www/data/secrets php:5.6-apache
- Next, point your web browser to: http://localhost:8050/weathsnap.php
- Any edits you do to the source code under "src/" are immediately effective in this running container, since the container's volume points to your "src" directory.
- Reference: Sections on "With Apache > Without a Dockerfile" on this page: https://hub.docker.com/_/php/
- Run this command from top-level of your repo clone:
I built and deployed this app as a Docker container to Amazon ECS (Elastic Container Service), using the new "Fargate" launch type (compared to standard EC2 launch type). ECS Fargate was introduced in November 2017, and currently only supports public Docker registries or private Docker registries that are in Amazon ECR (Elastic Container Registry). Since the ECS container has a public IP address, I can access my copy of the web app using mobile phone, tablet, etc.
- Still only half-done.
- The actual weather details are pretty limited at the moment, while I get the infrastructure stuff in place. Adding more weather details should be straightforward.
- For now, all locations are hardcoded to ones from my own area.
- Only current weather/astronomical conditions are displayed, there's no forecasting yet.