DEV Community

Cover image for πŸš€ Automating Microservices with Shell Scripts: Deploying RoboShop the DevOps Way
Mannmeet Ahir
Mannmeet Ahir

Posted on

πŸš€ Automating Microservices with Shell Scripts: Deploying RoboShop the DevOps Way

When managing microservices in a cloud-native world, we often default to tools like Terraform, Ansible, or Kubernetes. But what if we could do something equally powerful with something as old-school and universal as Bash?

Welcome to RoboShop Shell Automation β€” a complete, script-driven deployment solution for a microservices-based e-commerce application.

πŸ›οΈ What is RoboShop?

RoboShop (originally a project by DevOps enthusiasts for training and demonstrations) is a fully containerized or VM-deployable e-commerce platform built on a microservices architecture. Each service handles a business function such as:

  • catalog β€” product listings
  • user β€” user management
  • cart β€” shopping cart logic
  • payment β€” payment gateway simulation
  • shipping β€” logistics layer
  • frontend β€” user-facing UI
  • databases β€” MongoDB, MySQL, Redis, RabbitMQ (for async messaging)

🧠 Why Shell Scripting?

Many infra projects lean heavily on configuration management tools (Ansible, Chef, etc.), which are excellent but often overkill for small-to-mid scale dev/test environments. Definitely it's a simple and steady in learning as beginners level.

Shell scripting provides:

πŸ” Repeatability β€” one-click install via ./service.sh
πŸ“¦ Portability β€” runs on any POSIX-compliant environment
🧩 Composability β€” scripts are modular; services can be deployed independently
πŸ’‘ Learning opportunity β€” teaches sysadmin basics like systemd, user creation, logs, idempotency
πŸ“¦ Repo Overview
πŸ“‚ roboshop-shell GitHub Repo

Each script is service-specific and handles:

  • Dependency installation (Node.js, Python, Java, etc.)
  • App code setup from source or package repo
  • Service user creation (roboshop, catalog, etc.)
  • systemd unit file creation and daemon reload
  • Logging into /var/log/roboshop/

πŸ”§ Example Services

common.sh # Global setups: users, utils, colors, logging
catalog.sh # Node.js-based service for product listings
cart.sh # Redis-backed cart logic
shipping.sh # Java-based microservice
payment.sh # Python-based payment gateway
mongodb.sh # Installs & configures MongoDB backend

πŸ› οΈ How to Use It

🧰 Prerequisites

  • CentOS 7 / RHEL 9/ Amazon Linux 2023
  • Sudo privileges
  • Internet access (to fetch dependencies and app artifacts)

🐧 Installation Steps

1: Clone the Repo

git clone https://github.com/MannmeetOrg/roboshop-shell.git
cd roboshop-shell

2: Run the Scripts

sudo ./common.sh
sudo ./mongodb.sh
sudo ./catalog.sh
sudo ./cart.sh
…
sudo ./frontend.sh

3: Or Automate It All

for svc in common mongodb redis mysql rabbitmq user cart shipping payment frontend; do
sudo ./${svc}.sh || { echo "Failed on $svc"; exit 1; }
done

βœ… What Makes This Project Robust?

🧩 Idempotent Logic

Each script checks if a user exists, if services are already running, or if dependencies are installed. This prevents double provisioning or service conflicts.

πŸ” Centralized Logging

All scripts log to:

/logs/<service>.log

Helps in debugging failures post-installation.

πŸ” Secure Practices

  • App users are created with no-login shells
  • Systemd services run as non-root users
  • Limited package exposure to only what’s needed

πŸ”­ What I Learned

While building this project, I focused on:

  • Mastering systemd services
  • Realizing the power of Bash as an orchestration tool
  • Debugging with set -e, trap, and return codes
  • Emphasizing modularity so that each service is deployable in isolation

🚧 Future Enhancements

☁️ Integrate with Terraform to provision base VMs
🐳 Dockerize each service and use shell to build/run containers
πŸ” Add rollback logic for failed deployments
πŸ§ͺ Integrate with GitHub Actions or Jenkins CI

🀝 Contribute

This project is ideal for DevOps learners or infra engineers who want to:

  • Understand service orchestration from the ground up
  • Build infra-automation projects using core tools
  • Improve their shell scripting and systemd knowledge

Fork it here: https://github.com/MannmeetOrg/roboshop-shell

✍️ Final Thoughts

Shell scripting might be β€œold school,” but it’s still immensely powerful β€” especially when layered with a clean architecture, thoughtful structure, and microservice best practices.

If you’re preparing for a DevOps role, building demo labs, or learning backend automation β€” RoboShop Shell Automation is a hands-on, real-world project you should try!

πŸ”— Repo: MannmeetOrg/roboshop-shell
πŸ‘©β€πŸ’» Author: Manmeet Kaur Ahir
πŸ“« Connect: LinkedIn

Top comments (0)