This is an automated archive.
The original was posted on /r/golang by /u/pan-bubnov on 2023-09-03 12:30:58+00:00.
Hello!
Our project developed a monolithic application. But now our architects decide to divide the app into multiple small services called microservice architecture.To deploy services we use kubernetes.From now I have become a developer of one of the services and development has become a nightmare...To test my service I need to run all services which my service depends on. As far my service depends on only a few services that is not a big problem although it takes extra time compared to monolithic app.But I faced the next difficulties:
- I cannot attach with debugger to my service. Instead I need to use traces/logs to understand the root cause of bugs or wrong behaviour of my service. If I do not have enough traces/logs in my app I need to add them and then rebuild and deploy it again.
- Every time I make some changes in code I need to deploy my service again and it takes some time which slows down my development and debugging.
When I develop monolithic app to attach with a debugger was not a problem. I did it right from vscode. And I did not need to deploy my app I just run "run with debugger" that is it.
I did not waste my time at all and did my job very quickly.
There is another way to go it is using mocks of service which my app depends on in development. But to write a good mock and then maintain it - it is not so trivial task which will take some extra time. Sometimes the mock works differently from the original service which leeds to extra bugs during functional tests. Writing a good mock becomes more difficult when services depend on each other.
It seems I need to accept the fact that development and debugging will never be easy as in monolithic architecture.
I realize that I need to change my process of development and debugging because we switched to microservices architecture. I would like to know general best practices which (maybe) do not depend on programming languages. But if programming languages matter then we use go.
Can you please point me to any best practices? If there is no best practice can you please share how your process is organized?
I would prefer to run my service without any containrusters (docker/k8s/minikube and so on) to avoid deployment and in this case and I can attach debugger easily to my service. But here I need to mock other services which I depend on. Is it the wrong approach?