appsignal-ruby icon indicating copy to clipboard operation
appsignal-ruby copied to clipboard

Support mina deploy

Open risen opened this issue 6 years ago • 2 comments

We're using mina instead of capistrano to deploy. It'd be nice to have out of the box support for AppSignal deploy markers.

Right now we're using something like this:

namespace :appsignal do
  task :deploy do
    in_path "#{fetch(:current_path)}" do
      command %{#{fetch(:bundle_prefix)} appsignal notify_of_deploy --revision=`cat #{fetch(:current_path)}/.mina_git_revision` --user=#{ENV['USER'] || ENV['USERNAME']} --environment=#{fetch(:rails_env)}}
    end
  end
end

… which uses the deprecated (?) CLI command.

Or this:

default: &defaults
  push_api_key: "api_key"
  name: "app_name"
  revision: <%= File.read(Rails.root.join('.mina_git_revision')).strip if Rails.root.join('.mina_git_revision').exist? %>

… which works too but doesn't include the username in the deploy.

There's not :current_revision variable in mina, so it's a bit clumsy to use a remote (server-side) revision to execute local ruby code for the deploy notification. Proper support would be nice.

Thanks!

risen avatar Dec 20 '19 15:12 risen

Hi @risen,

Thanks for the request! We've been meaning to add support for the user name to the revision option.

For mina support, and better capistrano support so they don't use the deprecated option, we will have to look into the best way to read the revision from the app. I currently wouldn't know of a better way than to write a file on deploy and read it on boot.

tombruijn avatar Dec 20 '19 16:12 tombruijn

I stumbled across this issue when trying to get Mina and AppSignal working together, there is a third party gem(mina-appsignal) that utilizes curl to create a deploy marker. I created a PR to update the mina dependency so you can still use it with the latest Mina as well.

nickhammond avatar Feb 11 '22 22:02 nickhammond