See git commit hash of running Dokku app?
Asked Answered
B

6

10

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?

Booklover answered 22/4, 2015 at 15:0 Comment(0)
G
18

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.

Grath answered 22/1, 2016 at 12:24 Comment(1)
It probably changed since then because that’s not the case now: fatal: this operation must be run in a work tree. /home/dokku/<app-name> contains a lot of various things like the app logs, its nginx config, its environnement, SSL certificates, etc.Dustin
N
5

To get the current git commit hash for a dokku app just run

dokku config:get <myapp> GIT_REV
Nisen answered 14/9, 2021 at 12:48 Comment(0)
P
3

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

Prink answered 27/4, 2015 at 8:32 Comment(0)
A
3

You can also do dokku config:show myapp | grep GIT_REV to get it from the app's environment variables. The above command assumes your app name is myapp.

Atthia answered 17/3, 2021 at 9:22 Comment(0)
C
3

The fastest way to do this is to issue this command:

dokku config:get GIT_REV

This queries the server for the git revision that was most recently deployed. During deployment the GIT hash is set as an envirnoment variable, that's why it's possible to get with config:get.

Crystalloid answered 22/3, 2021 at 8:45 Comment(0)
T
1

You can also just bash into your doku app and echo $GIT_REV

Terribly answered 27/8, 2018 at 13:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.