Question about Clojure development setup

Most of my development set up is with docker and docker compose and I see some advantages in containerized development set up.

Recently when I started playing around with Clojure, I started by developing the apps on my laptop and not in a container. And now I am planning to write a production app with Clojure and am wondering if I should containerize the development setup or keep developing on the host machine.

How does most people here develop their Clojure apps, do they use containers or do they develop on their host machines. Are there any pluses and minuses for both of these approaches from a Clojure development perspective ?

Thank you in advance :smiley:

Historically for the JVM docker is less important.
The JVM and its classpath concept + maven put Java historically in a good position regarding the creation of identical development environment without Docker, at least regarding the JVM as such. IDEs is an other story.

Clojure has inherited this.

The moment you go polyglot, the situation changes, and something like this could become useful:

I use Docker to run databases, search engines, and all the external infrastructure that my apps need, but for the app itself – for the REPL that runs the app – I start that directly on my machine in a terminal and I connect my editor to that running locally.

I run a separate REPL for each of my projects, and leave them running for days (or weeks), and each of them is completely self-contained, with their own classpaths, so I don’t see any value in containerization around that.

2 Likes

Clojure is my first JVM language, and I was also wondering how it is done among java projects. Thanks for pointing it out.

I think am gonna do exactly this, run Clojure on host and some other dependencies on containers, thanks for sharing !

I do it exactly like @seancorfield, infrastructure in docker, but JVM / REPL stuff outside of docker.

1 Like

I used to have infrastructure in docker and JVM/REPL directly on the host, but I recently moved everything into docker.

The main advantages of having everything in docker (for me) are:

  • easier networking - our app has several workers running in containers across various hosts, and having everything in docker with an overlay network makes networking much simpler
  • consistency - much easier to ensure a consistent environment between dev and prod
  • make dependencies clear - I found it too easy to rely on files and resources on the host that would not be available in production, with everything in docker all resources are explicitly mapped into the container
  • resource management - easy to constrain the resource (memory/cpu) for a docker container

So far I’m pretty happy with the everything in docker approach. The main disadvantage has been the time and effort that went into setting up docker.

Let me know if you have any questions about this approach.

For my use case I think running REPL in host and infrastructure in docker will do.

Nevertheless less I tried setting up the app in docker and found that the REPL was taking much more time to load than in host. Have you experienced this issue ?

Also if there is a docker and docker compose file that you could share, that would be useful.

This changes the moment you go polyglot.
The main use case for my template is data science.
In here most algorithms are in Python and R.

So interop is very important, and these comes with complex setups of python + R + Clojure . So here Docker pays off.

For only Clojure I would not use Docker neither.

Even though I like the idea to know that having a dockeried workflow would allow me to run things in the cloud easely.