Skip to main content

Mastering Microservices PART 1: Setup Your Microservice Development Environment

ยท 5 min read
Victor Ikeme
Platform Engineer | Kubernetes | Cloud-Native Advocate | OSS | Technical Writer

Welcome to Part 1 of the Mastering Microservices Series! In this tutorial, I'll guide you through setting up your microservice development environment using a pre-configured Devbox environment. This setup eliminates manual installations and configurations, making the process much smoother. With Devbox, you'll have all the essential tools at your fingertips, ready to start building microservices right away.

This environment is perfect for Windows, macOS, or Linux users seeking a fully equipped setup to begin their microservices journey.

title image reading "what-is-platform-engineering"

๐Ÿš€ Get the Code: https://github.com/cloudikeme/mastering-microservices-with-kubernetes-terraform-azure/tree/main/01-part-1

This environment provides everything you need to get started on Windows, macOS, or Linux.

Why Choose Devbox for This Project?โ€‹

Devbox empowers you to create isolated, reproducible development environments. Instead of manually installing tools like Docker, Kubernetes, Terraform, Node.js, and Go, you can use Devbox to quickly spin up a pre-configured environment customized for this project. You can learn more about Devbox and its benefits in the What is Devbox? article.

I've taken the time to tailor this Devbox environment specifically for the Mastering Microservices Series. Therefore, you won't encounter any dependency conflicts or frustrating configuration issues. This customization ensures a consistent and enjoyable experience for all developers contributing to the project.

Setting Up Your Pre-Configured Devbox Environmentโ€‹

Follow these steps to set up your local development environment with Devbox:

Step 1: Clone the GitHub Repositoryโ€‹

First, clone the GitHub repository that contains the project and its Devbox environment:

  1. Open your terminal and execute the following command:

    git clone https://github.com/cloudikeme/mastering-microservices-with-azure-docker-kubernetes-terraform-github-actions.git

2. Navigate to Part 1โ€‹

cd mastering-microservices-with-kubernetes-terraform-azure/01-part-1

3. Install Devboxโ€‹

If you haven't already installed Devbox on your system, follow these instructions:

  1. For Linux/macOS:

    curl -fsSL https://get.jetpack.io/devbox | bash
  2. For Windows: Install Devbox through WSL (Windows Subsystem for Linux) using the same steps as for Linux. However, you can find WSL-specific instructions in the Devbox WSL documentation.

  3. Verification:

    After installation, verify that Devbox is ready by running this command:

    devbox --version

    Your terminal should display the installed Devbox version.

If you encounter any installation issues, refer to the official Devbox installation guide.

Step 4: Activate Your Devbox Environmentโ€‹

The repository includes a Devbox folder that contains a devbox.json configuration file, which automatically sets up the tools you'll need. Next, let's activate the environment:

  1. Navigate to the Devbox folder:

    cd devbox
  2. Activate the Devbox shell:

    devbox shell

    Devbox will start downloading and installing the necessary tools. A change in your terminal prompt will signal that you're now working inside the Devbox environment.

Tools in Your Devbox Environmentโ€‹

Here's a summary of the pre-installed tools you'll find in your Devbox environment:

  1. Docker: You'll use Docker to containerize and run your microservices.
  2. kubectl: This command-line tool enables you to manage your Kubernetes clusters, whether they are running locally or in the cloud.
  3. Terraform: Define and manage your infrastructure as code with Terraform.
  4. Node.js & npm: Utilize the Node.js runtime and npm for managing JavaScript dependencies.
  5. Go: Build efficient microservices with the Go programming language.
  6. Git: This version control system helps you track changes in your code.
  7. GitHub CLI (gh): Interact with GitHub directly from your command line, making your workflow more efficient.
  8. kind: Run local Kubernetes clusters within Docker, simplifying testing and development.

Step 5: Verify Your Setupโ€‹

After activating the Devbox shell, verify that all the tools have been installed correctly:

  • Check Docker:

    docker --version
  • Check kubectl:

    kubectl version --client
  • Check Terraform:

    terraform --version
  • Check Node.js:

    node --version
  • Check Go:

    go version
  • Check Git:

    git --version

The output should show the version information for each tool, confirming that your Devbox environment is set up correctly.

Manual Installation (Optional)โ€‹

While Devbox simplifies the process, you have the option to install the tools manually:

Manual Installation Instructions

If you opt for manual installation, refer to these guides for each tool, ensuring compatibility with your operating system:

Troubleshooting Devboxโ€‹

If you encounter problems, here are some Devbox troubleshooting tips:

  • Keep Devbox Updated: Run devbox update to download the latest version.
  • Network Check: Ensure a stable internet connection for Devbox to successfully download and install tools.
  • Review the Logs: Check the Devbox logs for detailed error messages if installations fail.
  • Clean Reinstall: If you suspect issues, use devbox rm to remove the environment and then recreate it with devbox shell.

For additional help, check out the official Devbox documentation.

What's Next?โ€‹

Now that you've successfully set up your Devbox environment, you're ready to dive into building microservices! In Part 2, we'll focus on setting up Git repositories and structuring the microservices codebase.

Head over to Part 2: Create a Repository from Linux Terminal Using Git and GitHub CLI to start managing your code using Git and GitHub.


GitHub Repository: You can find all the code for this series in the following repository:

Mastering Microservices with Azure, Docker, Kubernetes, Terraform, and GitHub Actions