Julia is a high-level, high-performance dynamic programming language for numerical computing. Genie is a full-stack MVC web framework that promotes a streamlined and efficient workflow for developing modern web applications. I’ve put together a Dockerfile that helps in the deployment of a Genie web app, where the setup for the running environment, and the serve process have been configured.

You can find the gist of this Dockerfile here.

  1. An official Julia 0.6 base image is used, since Genie requires Julia v0.6.x.
  2. Few system dependencies like unzip, build-essential are installed with apt-get, and the reason why this being important is stated in the next section.
  3. The Genie web-framework requires few package dependencies, which are saved asdeps.jl. This is like a package.json listing the dependency packages.

So any package that are to be added to the project can be mentioned here with Pkg.add(<package_name>) or Pkg.clone("git://example.com/path/to/Package.jl.git") to this file.

4. The script is executed with RUN julia deps.jl. The packages are fetched during the first deployment and this process is cached during further deployments, unless there’s a change in the file.

5. The Genie web-app source code is placed at app directory which is set as the WORKDIR.

├───Dockerfile
├───deps.jl
├───app
└─── config/routes.jl
└─── genie.jl
...

6. We start the server with$> bin/server on the container, which starts the server and listens at 0.0.0.0:8000.

Issues that I came across during implementation of this:

  1. The Genie site mentions AppServer.startup() to run the web server, and since it can only run on a genie interpreter, it isn’t possible to run in the executable section of CMD . Hence as mentioned in some deeply buried line in the Genie docs, we start the server with bin/server command.
  2. During deployment, the build kept failing throwingLoadError: could not spawn `unzip -x ... , apparently the Julia docker image doesn’t come with the necessary building tools for building the packages during runtime. So, packages like unzip ,make,build-essentialare installed in the system to build the package dependencies successfully. More on this issue.

I’m currently interning at Hasura. With Hasura, you can deploy anything that can be dockerized, with just a git push. So, I’ve put together a Hasura quickstart for Genie framework.

To try a sample Julia Genie project on Hasura (it’s free and it’ll only take you few minutes)

  1. Install the Hasura CLI tool
  2. Run this command (you can copy the entire command below in one shot)
hasura quickstart anirudhm/hello-julia-genie && 
cd hello-julia-genie &&
git add . && git commit -m "First commit" &&
git push hasura master &&
hasura microservice open www

The sequence of commands above will result in your browser window with a Hello World Genie app deployed. Make changes and git push to deploy again!

Read more about this quickstart here: https://hasura.io/hub/project/anirudhm/hello-julia-genie.

I would love to hear your feedback on this, let me know in the comments below. :)


How I deployed a Julia web-app using Genie framework with Docker was originally published in Hasura on Medium, where people are continuing the conversation by highlighting and responding to this story.