How to develop and test your microservices locally without melting your laptop

In this article, we’ll discuss how to develop, debug, and test a microservice locally on your laptop, without having to run all the other microservices of an app (distributed across various servers/clusters) also on your laptop.

The solution presented in this article could also be used to debug, fix, and test a problem reported by your customer in your live production cluster by routing accesses to your microservice (that has the bug) to the one running in your laptop with the fix.

Problem Statement:

Let’s say your team is focussed on developing and testing a front-end ReactJS microservice for your company’s application that has like 25 other microservices such as Spring Boot, Elastic Search, Redis, Postgres, Grafana, and so on, in it.

As a dev, you would usually try to run all of these microservices in your laptop so that you could develop,build and test changes to your front-end ReactJS App natively on your laptop. But running all these 25 microservices on your laptop will literally convert it into a toaster, by pushing your laptop CPU, memory and power consumption to their maximum capacity throughout the day.

Workarounds Used Today

Many try to workaround this problem by upgrade their RAM or disk or fan module or even the laptop itself.

This adds more costs to your organization. Sometimes it may make you wonder, “Was it really a smart decision to convert your monolithic applications into microservices, in the first place?”

Don’t worry, you are not left alone. Many companies that have started their expedition into the microservices world, for the benefits it offers, have faced this problem. And SocketXP has a solution to address this problem.

Wall Power Sockets Analogy

Let me ask you this question. Would you run a huge nuclear power reactor in your house just because you needed some electricity to run your TV, Air Conditioner and Washing machine? The answer would be “no”. You’d just install a couple of sockets on your wall, run a power cable to the energy company in your city and hook up your electrical equipments to those wall sockets. Neat and simple isn’t it?

Then why do we try to run all our microservices(both 800 pound gorillas and tiny little mice ones) on that poor little laptop on your lap, all day long, just because you need to focus on developing and testing one front-end microservice? You could very well install software “wall sockets” on your laptop and have your ReactJS front-end microservice talk to 25 other microservices running remotely in a cloud (or some on-prem cluster perhaps?) via the software “wall sockets” And vice-versa.

Our SocketXP Microservice Remote Access solution would help create those software “wall-sockets” in your laptop, for all your remote microservices.

How SocketXP Microservice Remote Access Solution Works?

You need to download and run a SocketXP proxy agent (also available as Docker Container) on your laptop and on your remote cluster where other N-1 microservices of your application reside.

SocketXP proxy agent will create “tcp or http” sockets on your laptop (one for each of the microservice running in a remote cluster) and run a bidirectional TLS tunnel between your laptop and your remote cluster. We’d also adjust DNS records (for those remotely running microservices) in your laptop to route to the localhost IP address. So that, any requests from your front-end microservices to these 25 other microservices, would be routed to these local sockets.

Your front-end microservice would continue to connect to other microservices of the app as usual, without requiring any modifications to your code or configurations.*

Docker Container Demo

For this demo, we are going to run Postgres DB as a Docker Container in a remote server and make a python based backend microservice (under development in a laptop) access the remote DB via the SocketXP proxy.

We do this just to show case the power of SocketXP Microservices Remote Access solution in action.

Postgres DB is accessible via the hostname postgres and port 5432

Here is the simple backend microservice written in python.

The python backend microservice connects to the DB using the hostname ‘postgres’ and port ‘5432’

Run the Postgres DB Docker Container

First create a docker volume

Next run the Postgres DB container and mount the postgres volume in the host machine to the directory /var/lib/postgresql/data inside the container.

Run SocketXP Proxy Agent container in a Cluster/Server

First go to SocketXP Portal. Signup for a free account and get your authtoken there.

Use your authtoken in the below config file.

Store the config.json file in a local directory (/home/gvelrajan/config/config.json) and map the directory into the SocketXP docker container at /data as shown in the command below to start the docker container.

Execute the following command to check the logs for success status or any errors.

It would have something like this:

Now go to the SocketXP Portal’s Tunnel Page. Check the name of the tunnel created and its status.

Run SocketXP Proxy Agent on your Laptop

First download the SocketXP Proxy Agent in your laptop from the SocketXP download page. SocketXP Proxy Agent is available for all OS versions — Windows/Mac/Linux.

Use the same SocketXP authtoken you used in the previous section to authenticate the proxy agent with SocketXP Cloud Gateway.

Next run the SocketXP in a localproxy (slave) mode as shown below:

The above command requests socketxp agent to run in slave mode and create a local proxy TCP socket in your laptop at Also it requests socketxp to create a secure TLS connection to the postgres-mservice-cluster1 proxy device (running your remote cluster or server) we created in the previous section.

Although it is called TCP socket, we run TLS on top of it. So your data is securely transmitted over the internet end-to-end.

Next, update the DNS record in your laptop with the following command:

We need to add the above hostname mapping for our postgres microservice so that any local requests to the microservice will be routed to our SocketXP proxy agent listening at IP

Run the python backend microserver

We are all set to run the python backend microservice under development in our laptop.

Let’s validate this success by running an SQL query in our remote postgres database.

Awesome! We are able to develop/test our local python backend service and make it to seamlessly connect with the remote postgres DB microservice.

Make a remote NGINX microservice locally accessible

Now suppose, in addition to the postgres db microservice, we also need to make an NGINX microserice locally accessible from our laptop, use the following config.json file to setup the SocketXP Proxy Agent in the remote server/cluster.

Go to your laptop, and update the config.json file for the nginx microservice, as shown below.

The above config will create a TCP listening socket at port 80 in your laptop. Make sure port 80 is free in your laptop and not used by any other application.

Next, add the follow DNS entry into your /etc/hosts file, so that any local DNS resolution requests to access your ngnix service will be routed to the SocketXP Proxy Agent listening on IP

Now open up a browser in your laptop and point it to: http://nginx:80 or simply http://nginx. It will open up the NNGINX home page as shown below.


SocketXP solution provides an efficient solution to develop and test a microservice on your laptop without exhausting the CPU/Memory/Disk/Power resources on your laptop. SocketXP solution helps create lightweight proxy sockets on your local development machine(laptop) for those heavyweight and resource consuming microservices with which your microservice under development/testing needs to interact with.

We are looking for beta customers to evaluate our SocketXP Microservice Remote Access Solution. Please write to us at:

This article was originally published at:

Ganesh Velrajan is the founder of SocketXP. Learn more about SocketXP Remote Access Solutions at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store