Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres database switching to sqlite3 #14315

Closed
jpilisuk opened this issue Dec 4, 2018 · 1 comment
Closed

postgres database switching to sqlite3 #14315

jpilisuk opened this issue Dec 4, 2018 · 1 comment

Comments

@jpilisuk
Copy link

jpilisuk commented Dec 4, 2018

What Grafana version are you using?

5.4.0

What datasource are you using?

a postgres database being stored in azure

What OS are you running grafana on?

alpine

What did you do?

  1. made a postgres database
  2. deployed grafana in kubernetes with a helm chart
  3. coppied the grafana.ini defaults into a folder and modified the database portion of it to contain my database that I just made, specifically the DB and making the DB be postgres
[Database]
type = postgres
host = HOSTNAME
name = grafana
user = grafanaadmin@HOSTNAME
password = ******
max_idle_conn = 2
conn_max_lifetime = 14400
  1. use kubectl to create a secret from my grafana.ini file
    kubectl create secret generic grafana.ini --from-file=grafana.ini
  2. edit the grafana deployment to use my secret (under spec volumes)
volumes:
      - emptyDir: {}
        name: grafana-storage
      - configMap:
          defaultMode: 420
          name: grafana-grafana
        name: grafana-dashboards
      - name: grafana-config
        secret:
          defaultMode: 420
          secretName: grafana.ini
  1. restart the pod running grafana

What was the expected result?

the pod would restart and use the new database information I posted

What happened instead?

the pod errored out
grafana-grafana-6556b4f569-86p7d 1/2 CrashLoopBackOff

when I look at the grafana pods logs I see the follewing error
lvl=eror msg="Fail to initialize orm engine" logger=sqlstore error="Sqlstore::Migration failed err: unable to open database file\n"

here is the whole logs from the pod . (notice 3rd line from the end is says the db type is sqlite3 despite being told that its to use postgres

t=2018-12-04T19:50:32+0000 lvl=info msg="Starting Grafana" logger=server version=5.0.0 commit=af6e283 compiled=2018-02-28T17:42:58+0000
t=2018-12-04T19:50:32+0000 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2018-12-04T19:50:32+0000 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.provisioning=/etc/grafana/provisioning"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from command line" logger=settings arg="default.log.mode=console"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ADMIN_USER=admin"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ADMIN_PASSWORD=*********"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_AUTH_ANONYMOUS_ENABLED=true"
t=2018-12-04T19:50:32+0000 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_AUTH_BASIC_ENABLED=true"
t=2018-12-04T19:50:32+0000 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2018-12-04T19:50:32+0000 lvl=info msg="Path Data" logger=settings path=/usr/share/grafana/data
t=2018-12-04T19:50:32+0000 lvl=info msg="Path Logs" logger=settings path=/usr/share/grafana/data/log
t=2018-12-04T19:50:32+0000 lvl=info msg="Path Plugins" logger=settings path=/usr/share/grafana/data/plugins
t=2018-12-04T19:50:32+0000 lvl=info msg="Path Provisioning" logger=settings path=/usr/share/grafana/conf/provisioning
t=2018-12-04T19:50:32+0000 lvl=info msg="App mode production" logger=settings
t=2018-12-04T19:50:32+0000 lvl=info msg="Initializing DB" logger=sqlstore dbtype=sqlite3
t=2018-12-04T19:50:32+0000 lvl=info msg="Starting DB migration" logger=migrator
t=2018-12-04T19:50:32+0000 lvl=eror msg="Fail to initialize orm engine" logger=sqlstore error="Sqlstore::Migration failed err: unable to open database file\n"

I thought that it wasnt using my custom grafana.ini at first so I made changes to it to beak it and then I recieved errors that it couldnt be parsed.

@marefr
Copy link
Member

marefr commented Dec 4, 2018

You have to use lowercase characters for the database section, [database]

@marefr marefr closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants