A simple weather application with containerized deployment, cloud hosting, and automated infrastructure provisioning.
The original repository contained basic frontend and backend code. This solution adds a complete production-ready infrastructure:
- Multi-stage Dockerfiles for both frontend and backend with development and production targets
- Docker Compose configurations for both development and production environments
- Hot reload support for development with volume mounting
- Optimized builds using Alpine Linux and multi-stage builds
- Terraform modules
- EC2 instance with security groups
- SSH key management
- Nginx reverse proxy for secure external access
- Container isolation
- Docker and Docker Compose v2 installation playbook
- Application deployment playbook
- Additional admin user management for task evaluation
Before running the app, ensure you have:
- Docker and Docker Compose installed on your local machine
- OpenWeatherMap API key
- AWS account
- Terraform installed on your system
- Ansible installed
- SSH key pair for AWS access
# Clone the repository
git clone https://github.com/igorkaw7/recruitment-2025.git
cd recruitment-2025-main
# Create backend environment file
cp backend/.env.example backend/.env.local
Edit backend/.env.local
:
APPID=your_openweathermap_api_key_here
MAP_ENDPOINT=http://api.openweathermap.org/data/2.5
TARGET_CITY=Helsinki,fi
PORT=9000
# Start development environment with hot reload
docker compose up --build
Access the application:
- Frontend: http://localhost:8000
- Backend API: http://localhost:9000/api/weather
cd terraform
# Initialize Terraform
terraform init
# Review the infrastructure plan
terraform plan
# Deploy infrastructure
terraform apply
Note the output IP address for next steps or run:
terraform output
Update host.ini
with your EC2 instance IP:
[weatherapp]
weatherapp ansible_host=YOUR_EC2_PUBLIC_IP ansible_user=ec2-user
[all:vars]
ansible_python_interpreter=/usr/bin/python3
cd ansible
# Install Docker on the remote server
ansible-playbook playbooks/install_docker.yml
# Deploy the application
ansible-playbook playbooks/deploy_app.yml
- HTTP: http://YOUR_EC2_PUBLIC_IP
- API: http://YOUR_EC2_PUBLIC_IP/api/weather
- Make code changes in
backend/src
orfrontend/src
- Changes automatically reload in development containers
- Test changes at http://localhost:8000
- Obtain a domain name
- Configure DNS to resolve the domain to the EC2 public IP using Route 53
- Add Let's Encrypt certificates
- Enable port 443 access
- Create an SSL-enhanced Nginx configuration
- Add basic Docker Compose health checks
- Use
wget --quiet --tries=1 --spider
for API and frontend - Use
nginx -t
for Nginx validation
- Use
- Add a Certbot service to Docker Compose for SSL certificate management
- Automate SSL certificate generation and management
- Connect certificate to updated Nginx config and Certbot
- Setup certificate renewal cron job
- Test API over HTTPS
- Automate deployment with GitHub Actions
- Deploy jobs executed on deploy agents
- Store the API key securely
- Use IAM-based permissions to control access by deploy agents