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?
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 .
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With