Developing an application in Clojure is fun and productive, but deploying the application can be a challenge for people who have not studied infrastructure (DevOps). DigitalOcean has a product called App Platform, which is a PaaS (Platform as a Service), a platform that makes it easy to deploy applications in various languages, including Clojure.
In this tutorial, we will share how to deploy an application using Docker on DigitalOcean’s App Platform. In this case, we will have a Docker image for Clojure - you can follow the same tutorial to deploy other languages by writing the Docker image.
App Platform supports deploying applications in Docker containers. To deploy a Clojure application, you need to create a Dockerfile using the official Clojure Docker image (docker.io/clojure:latest
), install your application’s dependencies, and run the .jar
.
To do this, simply create a file called Dockerfile
at the root of the repository, which the App Platform will use to build and deploy the application.
The example below shows how we do it at moclojer.
|
|
It might be a bit confusing, but don’t worry
To simplify understanding, we will create a basic HTTP server in Clojure (reitit + ring) and deploy it on the App Platform - this way we can ensure that you understand how the whole process works.
|
|
[[2024_06_18]]
Create App
main
and the directory that contains the application (if you work with a monorepo, this is where you select the application directory)Next
and select the Region
where the application will runCreate Resources
and wait for the application to deployHere is the domain of your application running on the App Platform: