Ably Debugging Tales Part 1 — An Elixir Erlang Mystery | Ably Blog: Data in Motion

Eve Martin
Jul 30, 2019 · 6 min read

Part 1 — Debugging in Elixir Erlang

$ curl https://staging-translator-realtime.ably.io/nonexistantpath -v < HTTP/1.1 500 Internal Server Error * Server Cowboy is not blacklisted < server: Cowboy
=INFO REPORT==== application: logger exited: shutdown type: permanent =ERROR REPORT==== Error in process <0.438.0> with exit value: {[{reason,undef}, {mfa,{'Elixir.AppName.Web.CatchAll',handle,2}}, {stacktrace, [{'Elixir.Inspect.List',inspect, [[], #{'__struct__' => 'Elixir.Inspect.Opts', width => 80, ...}], []}, {'Elixir.Kernel',inspect,2,[{file,"lib/kernel.ex"},{line,1566}]}, {'Elixir.AppName.Web.CatchAll',handle,2, [{file,"lib/web/catch_all.ex"},{line,11}]}, ...
Logger.warn "Unknown path: #{:cowboy_req.path(request) |> elem(0)}, params: #{:cowboy_req.qs_vals(request) |> elem(0) |> inspect}"
Logger.debug "Some data structures: #{inspect {%{}, [], MapSet.new, 0.1, 1..2, ~r//, :a, <<1>>}}"
if File.exists?('/tmp') logger.info 'Cleaning up temp files older than 2 days' warn 'Could not delete old temp files' unless system( 'sudo find /tmp -type f -mtime +2 -exec rm -f {} \;' ) end
def slug_volume(slug_path) # use an overlayfs mount so that the container cannot change files in the # underlying slug directory - tmp = Dir.mktmpdir("slug-") - run "sudo mount -t overlayfs \ - -o lowerdir=#{slug_path},upperdir=#{tmp} overlayfs #{tmp}" + FileUtils.mkdir_p "/slugs/mnt" + mnt = Dir.mktmpdir("slug-", "/slugs/mnt") + run "sudo mount -t overlayfs \ + -o lowerdir=#{slug_path},upperdir=#{mnt} overlayfs #{mnt}" { - host: tmp, + host: mnt, guest: "/app" } end

Ably: Serious, serverless realtime infrastructure

Ably is a realtime data stream platform that makes it easy…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store