Engineering Elixir Applications: JPperf workaround clarification (page 144)

Thanks for the excellent book @elliefairholm and @Gilacost , really well paced and clearly written.

One small suggestion: I think it would be useful to make clear that both the builder and runner need to have the ENV ERL_FLAGS="+JPperf true" in the Dockerfile for the multi-architecture builds to complete sucessfully.

Thank you for your kind words, @pgmcdonnell! We really appreciate your feedback and are glad you’re enjoying the book.

Regarding the ERL_FLAGS="+JPperf true" flag, it’s only required during the build stage and specifically for multi-architecture builds. It’s not needed in the runner stage. I don’t want to spoil the later chapters, but as you progress, you’ll deploy prebuilt images that we create daily for these platforms:

platforms: linux/arm64,linux/amd64

You can verify that the runner stage does not include this ENV flag by inspecting the image with whaler:

❯ whaler ghcr.io/beamops/kanban
Analyzing ghcr.io/beamops/kanban
Docker Version: 27.4.0
GraphDriver: overlayfs
Environment Variables
|PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|LANG=en_US.UTF-8
|LANGUAGE=en_US:en
|LC_ALL=en_US.UTF-8
|MIX_ENV=prod

Image user
|User is root

Potential secrets:
unable to parse history from json file

This image is used in later chapters, and if you want to test it, here’s what you need to do:

Running the Kanban app locally

1. Start PostgreSQL

If you don’t have a running PostgreSQL instance, you can spin one up with Docker:

❯ docker run -d --name postgres-container   -e POSTGRES_PASSWORD=postgres   -p 5432:5432   postgres:latest

2. Find your local IP

Since Docker networking can sometimes cause issues, you may need your local IP to connect from the Elixir container. On macOS (if using Wi-Fi), you can retrieve it with:

❯ ipconfig getifaddr en0

If you’re on Ethernet, replace en0 with the correct interface.

3. Run the Kanban app

Use the obtained IP to set up the DATABASE_URL when running the container:

❯ docker run   -e "DATABASE_URL=ecto://postgres:postgres@192.168.1.178:5432/postgres"   -e "SECRET_KEY_BASE=oQGFFW50gMjfoKx5Naa2C1Ks9aN2rX41wNB9zm9c8ykc54/X06zvRF0lt9UReNbe"   -p 4000:4000   ghcr.io/beamops/kanban:non-distributed

4. Access the app

Visit http://localhost:4000 in your browser, and you should see the Kanban login page.

By the way, I see you’re in the UK—are you based in London, near Clapham by any chance? Would love to meet up at a pub sometime to chat about this or any other Elixir topics!

Cheers,
Pep

1 Like

Hi @Gilacost :wave:,

Thanks for the detailed reply and I can see you’re totally right. As I was working though this section I was getting consistent failures during the apt-get dependency installation step for arm64 architecture immediately after targeting multi-architecture.

Adding the +JPperf environment variable into the Dockerfile was a little bit of a speculative fix and it seemed to resolve the issue.

However, looking at the history of my ci_cd.yaml file I can see my failing pipeline was caused by a typo in my platforms config. If only amd64 and arm64 weren’t so similar :person_facepalming:.

All fixed now, and really enjoying pressing on with the book!

Thanks for the pub invite: I’m based up in Scotland but may have some London travel so I’ll message you on LinkedIn!