This repository is a learning project that demonstrates deploying a multi-tier Java web application through three stages:
- Manual local deployment (classic setup with Tomcat, MySQL, Memcache, RabbitMQ)
- Automated local deployment using Vagrant (multi-VM environment, service setup scripts)
- AWS "Lift-and-Shift" architecture and guidance for migrating the same multi-tier app to AWS
- Manual setup webapp source: Manual Setup/ (see pages and Java code)
- Automated setup guide: Automated Setup/Automated_setup_Guide.txt
- AWS migration guide: AWS-Lift-and-Shift/README.md
- Show a typical multi-tier web application stack:
- Java web application (Spring + JSP) running on Tomcat
- Relational DB (MySQL/MariaDB)
- Memcache (caching)
- RabbitMQ (message broker)
- Provide:
- Manual configuration/examples so you can understand each component and how they integrate
- An automated Vagrant-based environment that brings up multiple VMs and configures services with shell scripts
- Documentation and architecture notes for migrating the same stack to AWS (lift-and-shift approach)
- Learning outcomes:
- Understand component roles and interactions
- Learn how to automate provisioning, install services, and deploy a WAR
- Understand the AWS services that map to each component (EC2, ALB, ASG, S3, IAM, ACM, Route53)
- Practice debugging and troubleshooting multi-tier integration problems
This is useful to learn how components are configured by hand.
- cd into Manual Setup
- Refer the Manual Setup Guide to do the complete setup of the servers one by one Manual_setup_Guide
- Once the setup is done validate the working of the web app
This is the recommended route for reproducing a production-like multi-VM environment similar to a small data center.
Steps:
- Open a terminal and go to the
Automated Setupfolder:- cd "Automated Setup"
- View the guide:
Automated_setup_Guide.txt
- Bring up the environment:
- vagrant up
- This will create multiple VMs (examples: db01, memcache, rabbitmq, app servers) and run the provisioning scripts.
- The provisioning scripts:
mysql.sh— installs & configures MariaDBmemcache.sh— installs memcachedrabbitmq.sh— installs RabbitMQtomcat.sh/tomcat_ubuntu.sh— installs Tomcat, deploys the WARnginx.sh— optional reverse proxy configuration
- After provisioning finishes, access the app using the IP / hostname configured by Vagrant (see Automated guide for IP/hosts)
What the automation does (summary from guide):
- Creates VMs, updates /etc/hosts, installs & configures all services, builds and deploys the application automatically.
Note: This section includes both hands-on implementation steps and architectural guidance for lift-and-shift migration to AWS.
Purpose: show how to migrate the same multi-tier app with minimal code changes into AWS.
Key ideas (documented in AWS-Lift-and-Shift/README.md):
- Keep the application as-is and run it on EC2 instances (no refactor) — "lift-and-shift"
- Replace local infrastructure with AWS equivalents:
- EC2 instances for Tomcat and backend services
- ALB (Application Load Balancer) instead of Nginx
- Auto Scaling Group (ASG) for scaling app servers
- RDS (or EC2-hosted MariaDB) for MySQL (RDS recommended)
- ElastiCache for Memcached
- Amazon MQ or managed RabbitMQ if needed (or run on EC2)
- S3 for artifacts and static assets
- Route 53 for DNS; IAM and ACM for credentials and certificates
- The AWS folder contains diagrams and notes to help design the migrated architecture.
- Check logs:
- Tomcat logs in
logs/on Tomcat host - MySQL logs if DB connection errors occur
- Application logs printed by Spring to console or configured log files
- Tomcat logs in
- DB connectivity issues:
- Confirm
application.propertiesvalues and that DB user has privileges and DB exists
- Confirm
- Port conflicts:
- Ensure ports used by Tomcat, MySQL, RabbitMQ, memcached are available
- Vagrant provisioning fails:
- Rerun
vagrant reload --provisionafter fixing the provisioning script or Vagrantfile
- Rerun
- Increasing VM RAM/disk:
- Edit Vagrantfile or VirtualBox settings if provisioning fails due to resource constraints
Read the lift-and-shift doc for details:
- LinkedIn: www.linkedin.com/in/shreyashsupe
- Email: shreyashsupe11@gmail.com
