Skip to content

Practicalli Articlesλ︎

Essential tooling for Clojure development

alternative text

Clojure development benefits from great tooling focused around an editor.

Autocomplete, refactor tools, diagnostics feedback and syntax highlighting enhance the creation and modification of code.

Evaluating in source code and using data inspectors for the results provides an effective interaction with the REPL.

Practicalli encourages editors that provide user actions driven exclusively via the keyboard and an uncluttered user interface.

Practicalli Clojure provides an overview of Clojure editors and the plugins that provide Clojure support, e.g. Emacs, Neovim, VS Code, Pulsar and Sublime.

Practicalli preferred editors

LightTable was the editor used in the early years of learning Clojure as it was simple to use and provided instant feedback as code was typed.

Once Spacemacs was release, Emacs with CIDER became the predominant editor for many years.

Treemacs and LSP have matured so Neovim and Conjure has been adopted to provide a fast editing environment with streamlined key bindings for Clojure development.

Safeguard against Git Commit Spoofing

alternative text

Git Commit Spoofing is where a person uses the Git identity of another person to modify commits pushed to GitHub, assuming they can obtain write permission to a branch or via a PR.

Signing is especially useful for those contributing changes via a pull request. Signing provides greater confidence that the contribution is from a verifyable account.

Working in the Financial sector for many years, signing of commits has become manditory to reduce risk and increase traceability for audit trails.

All Practicalli commits are now signed using a passphrase protected SSH key, registered as a signing key with the GitHub account. All contributions via pull request should be also be signed, either with GPG or SSH keys.

Build Emacs from source on Debian Linux

Practicalli Emacs Logo

Emacs 29 is the current stable release, adding major features: Eglot LSP client, Tree-Sitter language parser and package.el package install from Git repositories.

Building from source is a convenient way to try Emacs features in advance, especially useful for those maintaining or developing new tools on top of Emacs.

Emacs 29 Features

Emacs 29 - what to expect - a brief summary of the major features

Expose Clojure Service using Ngrok

Practicalli Clojure Logo

Exposing a local running services can be valuable when writing apps and web-hooks for Cloud API products, e.g. Slack, Atlassian Confluence, Hasura, Salesforce, etc.

ngrok exposes local networked services behinds NATs and firewalls to the public internet over a secure tunnel.

Create a free ngrok account to get an authorisation token for use with the ngrok agent to create a secure tunnel. Or add an SSH public key to use SSH reverse tunnel with the ngrok service.

Pin Emacs packages to manage issues

Practicalli Clojure Logo

Emacs provides a huge amount of features via packages. Community configurations like Spacmacs orchestrate packages so they work seemlessly together. It is rare, but sometimes a package will have a breaking issue.

Melpa provides (5,544) up-to-date packages automatically built from each projects Git repository. Builds are defined by a recipe for each package.

A custom recipe can be used to control which version of a package is used with the Emacs configuration, to work around issues or changes to a package.

Accessing AWS with Clojure from scratch - simple approach

Practicalli AWS topic logo

Cognitect Labs AWS API is an excellent data driven Clojure library for interacting with AWS from code. The project includes working code examples.

The biggest challenge for those new to AWS is to configuring suitable AWS accounts, programmatic access and service permissions.

This article starts with nothing and steps through the simplest and quickest AWS account and permission setup, using the 🌐 AWS Free Tier.

Service quota limits

Each service has itos own quota limits and some services are only free for a period of time (free trials & 12 months free).

The approach outlined is not intended for commercial work, only the bare essentials to start exploring what is possible with the Cognitect Labs library. Or try 🌐 LocalStack if docker is installed locally.

Docker: a simple workflow for Clojure

Practicalli Clojure Logo

Docker enables a consistent approach to building and running Clojure projects along with a range of other services locally (database, cache, streams, etc.), The Clojure project is built from source when starting services (a watch feature can rebuild on code changes). Heath checks and conditions are set to ensure dependant services start in the correct order.

Running Docker is relatively fast once image overlays (layers) are cached on their first run, so its a viable approach for local system integration testing and acceptance testing, before pushing changes to a remote Continuous Integration service.

A Docker workflow complements a REPL Driven Development workflow, it does not replace it. The main development effort should be more effective via a REPL connected editor with Docker Compose focused on orchestration of services.

Deeper into Docker

Practicalli Engineering Playbook covers Docker and Compose in more detail

Build and run Clojure with Multi-stage Dockerfile

Practicalli Clojure Logo

Deployment of a Clojure service is very simple, requiring only an Uberjar (archive file containing the Clojure Project and Clojure run-time) and the Java Run-time Environment (JRE).

A Clojure service rarely works in isolation and although many services are access via a network connection (defined in Environment Variables), provisioning containers to build and run Clojure along with any other services can be valuable as complexity of the architecture grows.

A Multi-stage Dockerfile is an effective way to build and run Clojure projects in continuous integration pipelines and during local development where multiple services are required for testing.

Docker Hub provides a wide range of images, supporting development, continuous integration and system integration testing.

FreeDesktop.org XDG standard for Clojure development tools

Debian Linux Logo

The 🌐 FreeDesktop.org XDG basedir standard defines specific locations to store all user configuration, data files and caches.

Without the XDG standard, these files and directories are often mixed together and stored in the $HOME of the users account, making it more challenging to backup or version control.

Development tools such as NeoVim, Emacs, Clojure CLI and Clojure LSP support the XDG specification, although some tools like Leiningen required a little help. There are simple approaches to work-around the limitations of tools that don't conform.

Building Emacs 28 on Ubuntu Linux

Practicalli Clojure Logo

Emacs 28.1 is a feature packed release and includes native compilation to significantly increase the speed of all Emacs software packages installed. This is a very noticeable difference, especially when Emacs is at the center of your developer workflow.

Ubuntu hasn't packaged Emacs 28.1 yet, although its usually straight forward to build Emacs yourself.