containerization

Im thinking about implementing multiple techs/languages in a monolith. Does the containerization makes it possible
39 Replies
Lumberjack
LumberjackOP16mo ago
@cfkeef
Keef
Keef16mo ago
So as i was saying. Containerization is really just being able to have a process to create a binary thats explicit. A monolith will take advantage of this when you move to deploying it into the world and setting up ci&cd But if you want to have a Rust codebase that also does some python work you need to be looking at foreign function interface more then style of system (monolith,micro) I skimmed the chat earlier and you said you were doing a web api and a ml processor yeah? why not just set them up as two seperate services?
barry
barry16mo ago
That is, assuming you want it to be one service.
Keef
Keef16mo ago
by monolith he does is my assumption
barry
barry16mo ago
Monolith can be many apps.
Keef
Keef16mo ago
could be but then they would say distributed monolith
barry
barry16mo ago
hence monorepos
Keef
Keef16mo ago
WOULDNT THEY
Lumberjack
LumberjackOP16mo ago
I mean i asked about microservices yesterday and they told me use monolith instead 🤷🏻‍♂️ Afaik monolith is one service
Keef
Keef16mo ago
i don't even know if i'm properly defining things since the definitions can be very wide. A microservice technically should be owning its own data (has its own database, seperately deployed etc)
Lumberjack
LumberjackOP16mo ago
So how can i make my ML in a separate service Oh i see now
Keef
Keef16mo ago
but doing cross language stuff is more baggage then just having a service that service what the ml service is cooking just seems easier and the seperation is pretty clear If thats what you are doing then its fine but I was under the assumption you are just trying to deploy 1 thing that'll make use of ffi
Lumberjack
LumberjackOP16mo ago
So basically put the ml model in a separate docker container in a separate server
Keef
Keef16mo ago
it can be pretty loose. you can just have a server that runs docker compose for both of your apps and be fine you can seperate their compute (one server for each yadda yadda)
Lumberjack
LumberjackOP16mo ago
Nd how those dockers communicate?
Keef
Keef16mo ago
welcome to a whole ass world what flavor do you want async or synch async you can look at message queues, sync http grpc is another flavor of sync i think
Lumberjack
LumberjackOP16mo ago
So basically internal server communication 😕
Keef
Keef16mo ago
server 2 server usually in a private network
Lumberjack
LumberjackOP16mo ago
Nd how can i make it? Through api? And that still a monolith?
Keef
Keef16mo ago
i think the apt term is distributed monolith since we are probably using the same database for all of them and communicating through network means. like i said the definitions between monolith and microservice have several connotations that aren't just how many things you are deploying at the end of the day
Lumberjack
LumberjackOP16mo ago
Hmmm so technically using multiple techs/languages in a monolith is possible by using dockers nd make some communications between them What if i put the two dockers in one server
Keef
Keef16mo ago
its still gonna be the same thing its jsut on one system
Lumberjack
LumberjackOP16mo ago
Nd for caching i have to use kubernetes To manage the dockers
Keef
Keef16mo ago
no Caching what? Docker by itself will cache your layers if they don't change between builds Kubenetes is just a means to an end for orchestrating containers its docker compose + alot of extras
Lumberjack
LumberjackOP16mo ago
Aah i see, is that the only possible way to use multiple languages in a monolith?
Keef
Keef16mo ago
So When you say that what do you mean? Do you want multiple services so that language doesn't matter or do you want one single deployment that will call multiple languages if its the latter containerization isn't relevant thats just ffi (foreign function interface) if itsthe former containerization is the start to getting to where you'd want to be
Lumberjack
LumberjackOP16mo ago
I have my backend with node js but im using some ml models in python to parse some data nd send it to the node backend to store it in the db
Keef
Keef16mo ago
send it back so you are doing something with network communications?
Lumberjack
LumberjackOP16mo ago
Well its like the user upload a pic to the app. The backend have to parse that picture with an ml model croping it to make it look consistent then store it in the db or the s3 bucket Ofc i'll use other ml model to match that pic with another pictures So is that possible in a monolith
Keef
Keef16mo ago
So I"ll ask you What do you mean by monolith? Its clear to me what you can do here and I've answered it but I'm not sure how to further explain it without repeating what i said before Take that nicely I really don't mean it in a bad way
Lumberjack
LumberjackOP16mo ago
Afaik putting all ur backend logic in single codebase with a single database. Nothing personal dw
Keef
Keef16mo ago
So now I ask how do you plan to execute this python code from your nodejs? I mentioned languages can interface with other languages using ffi. Is that something you want to persue?
Lumberjack
LumberjackOP16mo ago
In rust u can do that by using other scripts idk if its possible in node js That's interesting
Keef
Keef16mo ago
it probably can but if you are already using a monorepo (turbo repo with two apps: nodejs api and the python worker) the easier path in my opinion is to just deploy them seperate and using http for communication or a message queue they can share the same codebase, same database but the deployment strategy is separated which makes it a distributed monolith nodejs can prob do ffi i imagine
Lumberjack
LumberjackOP16mo ago
I got it now so either the first option which is deploying them separately or going for ffi Cool
Lopen
Lopen16mo ago
Everything may work fine now But eventually, you may shoot yourself in the foot
Lumberjack
LumberjackOP16mo ago
How
Lopen
Lopen16mo ago
I can't categorically tell you how But only use this when it's actually needed and very important Because I know from here you will enter Kubernetes etc😀
Lumberjack
LumberjackOP16mo ago
Yeeh
Want results from more Discord servers?
Add your server