-
Notifications
You must be signed in to change notification settings - Fork 19
Reset grafana password via grafana-cli #21
base: master
Are you sure you want to change the base?
Conversation
The `grafana-cli admin` command was introduced in v 4.1 and allows to change admin user password via cli. This will allow us to set new password in the manifest and rotate it during deployment. Unfortunatelly `grafana-cli` is a little bit silly now and can only read config from `$WORKING_DIR/conf/defaults.ini` and as we have grfana.db in `/var/vcap/store/grafana` we need to point it to it somehow.
Now covered by #22. |
cd $(dirname $0)/.. | ||
mkdir conf | ||
ln -s $(pwd)/config/config.ini $(pwd)/conf/defaults.ini | ||
/var/vcap/packages/grafana/bin/grafana-cli admin reset-admin-password <%= p("grafana.admin_password") %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be escaped using Shellwords.shellescape
- passwords can have funny characters in them.
@@ -5,3 +5,11 @@ $(dirname $0)/create-update-datasources | |||
|
|||
echo "[$(date)] Calling 'create-update-dashboards' ..." | |||
$(dirname $0)/create-update-dashboards | |||
|
|||
echo "[$(date)] Updating password for admin user" | |||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a subshell here will prevent a failure within from making the outer script fail. Is that intentional?
May want to use pushd
and popd
instead, if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(should have requested changes but have forgot, and can't leave this blank)
@combor Are you still interested in getting this cleaned up? If not, I can try to knock out the requested changes. |
What
The
grafana-cli admin
command was introduced in v 4.1 and allows tochange admin user password via cli.
This will allow to set new password in the manifest and rotate it during deployment.
Unfortunatelly
grafana-cli
is a little bit silly now and can only read config from$WORKING_DIR/conf/defaults.ini
and as we have grfana.db in/var/vcap/store/grafana
we need to point it there somehow.NOTE This requires grafana 4.1 so version bump is necessary.
How to test