Hello everyone! My name is Viacheslav Aksenov. I am a professional Java/Kotlin backend developer in a large enterprise. I am developing microservices for high-load projects. In my free time, I am writing small pet projects, you can find some of them on my GitHub: https://github.com/v-aksenov
I was thinking about the architecture for another pet project to keep myself busy in my free time and decided to choose a stack that I saw on one of the projects where I worked - Spring Boot + Spring Cloud for configs. Let's go in order.
Spring Cloud is a Spring module that has a lot of different things for developing a microservice architecture. There are pieces of infrastructure and other useful goodies. One of the main things that is there is Service Discovery. For example, you can keep in your Spring Cloud application addresses of your other services.
Using Spring Cloud on a large project consisting of 50+ microservices greatly helps to structure the storage of configuration files, configure interaction between microservices, and also simplify the separation of configurations for different circuits - test, stage, production.
But is it justified to use it for a personal project?
My idea was as follows - a Spring Boot application that handles requests for a Telegram bot. The source codes of the application itself are on my GitHub and open for everybody: https://github.com/v-aksenov/whid-bot
I wanted to make it as open as possible so that anyone can use the bot and at the same time not store all configs in GitHub Secrets.
Disclaimer - I find GitHub secrets a very convenient mechanism for storing environment variables that are needed for deployment, but not for configuring an application in production.
In this regard, I needed a place where I could safely store the configuration, change it at any time with minimal effort to run the application.
In my case, this place was the private GitHub repository, where the config file is located, which contains sensitive information. The link to this GitHub repository is stored in a private Spring Cloud project, which stores the private key to access the private repository.
And finally - my Spring Boot service, which connects to the Spring Cloud application at startup in order to get the necessary configs.
The architecture I chose has a very interesting feature when used for pet projects - when you try to automate some of the worries during the project, you will not get a wow effect. To fully appreciate the benefits of DevOps practices - you need to use them at least at a minimal level - but in all steps of your project development.
If you want to build a full-fledged pipeline for the CI/CD of your project, then you have to take care of the full-fledged environment. You won't be able to stop halfway.
Thus, I managed to simplify my life and automate the process of storing configs. I would be glad to read in the comments your solutions that you use for your projects.
Also, I am always open to feedback on my GitHub: https://github.com/v-aksenov
Good luck and clean code to everyone!
Photo by Caspar Camille Rubin