Welcome to my autoShellRoboshop project!
This repo is my upgraded journey in automating the Roboshop microservices e-commerce app for the IBM project, now with super-efficient scripting and modular code.
I’ve reduced code duplication, improved maintainability, and made debugging a breeze – all skills that make me a strong DevOps/Cloud Engineer candidate! ๐ผโจ
- ๐งฉ Modular Scripting: All repeated logic is now in
common.sh– less code, fewer bugs, easier updates! - ๐ Cleaner Scripts: Each service script is short, readable, and focused on just the unique steps.
- โก Faster Debugging: Centralized logging and validation functions.
- ๐ Reduced Lines: Compare with my old Roboshop repo – you’ll see the difference!
- ๐จ Easy to Maintain: Update one place, affect all scripts.
- My
roboshop.shscript is idempotent:- You can run it multiple times without causing duplicate resources or errors.
- It uses the
UPSERTaction in Route 53, so DNS records are created or updated as needed. - This makes automation safe and repeatable!
| File/Script | Description |
|---|---|
common.sh |
๐ง The brain of automation! Contains reusable functions for logging, validation, user checks, app setup, service management, and more. All other scripts source this file for efficiency. |
cart.sh |
๐ Sets up the Cart service. Calls common.sh for user creation, app download, Node.js install, and service setup. |
catalogue.sh |
๐ฆ Sets up the Catalogue service. Uses common.sh for MongoDB client, app setup, and service management. |
user.sh |
๐ค Sets up the User service. Leverages common.sh for Node.js, app, and service setup. |
shipping.sh |
๐ Sets up the Shipping service. Uses common.sh for Maven/Java, MySQL client, app, and service. |
payment.sh |
๐ณ Sets up the Payment service. Uses common.sh for Python, app, and service setup. |
frontend.sh |
๐จ Automates Nginx frontend setup. Uses common.sh for Nginx install, config, and service. |
mongodb.sh |
๐ Sets up MongoDB server. Uses common.sh for repo, install, config, and service. |
mysql.sh |
๐ฌ Sets up MySQL server. Uses common.sh for install, root password, and service. |
redis.sh |
๐ฅ Sets up Redis server. Uses common.sh for install, config, and service. |
rabbitmq.sh |
๐ Sets up RabbitMQ server. Uses common.sh for repo, install, user, and service. |
roboshop.sh |
โ๏ธ Provisions AWS EC2 instances and updates Route 53 DNS for all services. |
*.service |
โ๏ธ Systemd service files for each microservice. |
nginx.conf |
๐ Nginx reverse proxy config for frontend. |
mongo.repo/rabbitmq.repo |
๐ฆ YUM repo configs for MongoDB and RabbitMQ. |
- Centralized Functions:
check_root: Ensures scripts run as root.VALIDATE: Logs success/failure of each step.setup_app: Handles user creation, app download, and extraction.setup_nodejs,setup_python,setup_maven: Language-specific installs.setup_systemd,setup_service: Service management.print_time: Shows script execution time.
- Result:
- All service scripts are now just a few lines, calling these functions!
- Any update (like better logging) is made once in
common.shand benefits all scripts. - Less code, fewer mistakes, easier onboarding for new team members!
| Aspect | Old Roboshop Repo (link) | autoShellRoboshop (This Repo) |
|---|---|---|
| Code Duplication | โ High (same logic in every script) | โ
Minimal (all in common.sh) |
| Maintenance | โ Tedious, error-prone | โ Easy, one place to update |
| Debugging | โ Scattered, inconsistent logs | โ Centralized, clear logs |
| Script Length | โ Long, repetitive | โ Short, readable |
| Professionalism | โ Basic scripting | โ Modular, real-world ready |
-
๐ Forgot to update IP in Route 53 after EC2 restart:
โก๏ธ Now I always usenslookupto verify my DNS records are correct! -
๐ Missed updating backend IPs in
nginx.conffor reverse proxy:
โก๏ธ I double-check and reload Nginx after any config change. -
๐ Forgot to restart services after config changes:
โก๏ธ I always runsystemctl restart <service>to apply updates. -
๐ Port connection issues:
โก๏ธ I usetelnet <ip/domain> <port>to check if services are reachable. -
๐ฆ Service status and 404 errors:
โก๏ธ I checksystemctl status <service>to quickly spot and fix issues.
๐ก Each mistake made me a better troubleshooter and more reliable DevOps engineer!
- Handy Commands:
netstat -lntp– See which ports are open and which process is using them.telnet <domain/ip> <port>– Test if a service is reachable.nslookup <domain>– Check DNS resolution.systemctl status <service>– Check service health.
- Pro Tip:
Centralized logging incommon.shmeans you can always check/var/log/roboshop-logs/<service>.logfor errors!
- OS Selection:
- Chose Amazon Linux 2 or Ubuntu in the AWS EC2 launch wizard.
- Authentication:
- Selected password authentication (did not use SSH key).
- Set a default username and password during instance creation.
- Security Group:
- Allowed all inbound and outbound traffic for initial learning (source:
0.0.0.0/0, destination:*). โ ๏ธ Note: This is only for practice. In production, always restrict access!
- Allowed all inbound and outbound traffic for initial learning (source:
- Open MobaXterm.
- Click Session → SSH.
- Paste your EC2 instance’s public IP address.
- Enter the username you set during instance creation.
- Tick the box for password authentication and enter your password.
- Click OK to connect!
Pro Tip:
For learning, open security is OK, but always tighten security for real deployments!
- Real-world DevOps skills: Modular scripting, cloud automation, systemd, logging, debugging.
- Team-friendly: Easy for others to read, extend, and maintain.
- Cloud-native: AWS provisioning and DNS automation.
- Continuous improvement: I learned from my old repo and made this one better!
Ready to level up your shell scripting and automation game? Explore my key repositories that showcase a progressive journey from basics to cloud-grade automation:
- ๐ LEARN-SHELLSCRIPT-PRACTICE – Start here! Fundamentals, practice scripts, and troubleshooting gems for shell scripting newbies and pros alike. ๐๐ก
- โ๏ธ Roboshop-Automation-Scripts-AWS – Jump into real-world, cloud-ready automation scripts that power robust microservices on AWS! ๐๐ฅ
- ๐ค Automated-Roboshop-Setup-AWS.git – Hands-on integrated infrastructure setup scripts for a seamless Roboshop deployment experience. ๐โ๏ธ
Inspired by cloud-native, production-grade DevOps workflows and automation excellence.
Crafted with passion and dedication by Mahalakshmi ๐ฉ๐ปโจ
Shell scripting has been a game changer in my DevOps career — it taught me the true power of automation, modularity, and smart troubleshooting. ๐ช๐ ๏ธ
Let’s continue to build, automate, and innovate—one script at a time!
Join me on this journey, and together we’ll unlock greater efficiencies and creative solutions in automation. ๐ฏ๐กโจ
Happy scripting! ๐๐๐ฆ
“The best code is the code you never have to write twice.” – Me, after refactoring with
common.sh๐