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😄