Setting AppSignal revision

almirsarajcic

almirsarajcic

Created 6 months ago

You can easily enable setting a new AppSignal revision every time you commit and deploy your Elixir application.

# Dockerfile
COPY rel rel
COPY .git .git
RUN cat .git/HEAD | grep "ref: " && \
    (cat .git/HEAD | awk '{print ".git/"$2}' | xargs cat >>priv/REVISION) || \
    cat .git/HEAD >>priv/REVISION
RUN mix release


# config/runtime.exs
revision_file = Path.join([:code.priv_dir(:app_name), "REVISION"])
appsignal_revision = revision_file |> File.read!() |> String.trim()
config :appsignal, :config, revision: appsignal_revision

Make sure your .dockerignore file contains:

.git
!.git/HEAD
!.git/refs

It will give you the ability to see which deployment caused the error to start appearing. This applies to other error-reporting services as well.