Skip to content

Commit

Permalink
Add /statusz to report some deploy-time info
Browse files Browse the repository at this point in the history
  • Loading branch information
cespare committed Sep 8, 2011
1 parent de6dfbe commit c5cfeda
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def replace_shas_with_links(text)
next if request.url =~ /^#{root_url}\/stats/
next if request.url =~ /^#{root_url}\/inspire/
next if request.url =~ /^#{root_url}\/keyboard_shortcuts/
next if request.url =~ /^#{root_url}\/admin/
next if request.url =~ /^#{root_url}\/statusz/
next if request.url =~ /^#{root_url}\/.*\.css/
next if request.url =~ /^#{root_url}\/.*\.js/
next if request.url =~ /^#{root_url}\/.*\.woff/
Expand Down Expand Up @@ -356,6 +358,11 @@ def replace_shas_with_links(text)
}
end

get "/statusz" do
content_type "text/plain"
File.read(File.join(File.dirname(__FILE__), "./git_deploy_info.txt"))
end

# For development use only -- for testing and styling emails. Use ?send_email=true to actually send
# the email for this comment.
get "/dev/latest_comment_email_preview" do
Expand Down
2 changes: 2 additions & 0 deletions config/recipes/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
command = "rsync -r --archive --safe-links --delete --exclude=.git --exclude=log --exclude=tmp " +
"#{local_path}/* '/tmp/#{app}/'"
puts `#{command}`
# Write out a bit of useful deploy-time info
`./config/recipes/write_git_info.sh > /tmp/#{app}/git_deploy_info.txt`
Rake::Task["fezzik:save_environment"].invoke
end

Expand Down
17 changes: 17 additions & 0 deletions config/recipes/write_git_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

echo "Latest commit:"
git log --pretty=%H -n 1
echo
echo "Current branch:"
git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
echo
echo "Date:"
date -u
echo
echo "Current user on host:"
whoami
echo
echo "Git user info:"
git config --get user.name
git config --get user.email

0 comments on commit c5cfeda

Please sign in to comment.