Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See git commit hash of running Dokku app?

Tags:

dokku

I am running a Dokku app in production and need to know what version of the app is running on the server.

Is this possible with Dokku?

like image 823
Rick Avatar asked Apr 22 '15 15:04

Rick


People also ask

How do I view commit hash?

If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .

What is the hash of a commit?

At a high level, a git commit hash is a SHA1 hash of the state of the git repository at the time of the commit. A short git commit hash is an abbreviation of the hash to the first 7 characters, it is almost certainly unique within a repository and git will increase the number of characters used if it is not.

How does git determine commit hash?

The commit hash by hashing the data you see with cat-file . This includes the tree object hash and commit information like author, time, commit message, and the parent commit hash if it's not the first commit.


2 Answers

There's no need for a plugin.

All apps in dokku are git bare repositories. Just connect to your server, switch to the app directory (mine are in /home/dokku/<app-name>) and run a git log. That should do the trick as well.

like image 71
PenthousePauper Avatar answered Oct 14 '22 03:10

PenthousePauper


Yes, you can add the SHA1 of the latest git commit using this plugin: https://github.com/dokku-alt/dokku-alt/tree/master/plugins/dokku-git-rev

There are many other alternatives based on different scenarios and different environments. If you are deploying Node.JS apps and using package.json properly, you can easily parse out the version using the fs standard lib; JSON.parse(fs.readFileSync('package.json')).version

like image 35
carl-johan.blomqvist Avatar answered Oct 14 '22 03:10

carl-johan.blomqvist