I run metabase on a docker container and I use postgres for my database.
I have created a big amount of questions, charts and dashboards.
I backup all my data just by dumping the database and then importing it again like this
docker exec -t postgres_container pg_dump -U user -d metabase > metabase_dump.sql
And import it like this:
DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT USAGE ON SCHEMA public to PUBLIC; GRANT CREATE ON SCHEMA public to PUBLIC; cat metabase_dump.sql | docker exec -i postgres_container psql -U user -d metabase
I had a problem when I wanted to change my passwords for the postgres user and the metabase user.
Here is a simplified version of my compose file
postgres: image: postgres environment: POSTGRES_USER: myuser POSTGRES_PASSWORD: pass POSTGRES_MULTIPLE_DATABASES: db1, db2 METABASE_USER: metabaseuser METABASE_PASSWORD: metabaseuser METABASE_DB_NAME: metabase metabase: restart: "always" image: metabase/metabase environment: - MB_DB_TYPE=postgres - MB_DB_DBNAME=metabase - MB_DB_PORT=5432 - MB_DB_USER=metabaseuser - MB_DB_PASS=metabasepass - MB_DB_HOST=postgres - MB_ENCRYPTION_SECRET_KEY=8901234567890123 ports: - 3000:3000 depends_on: - postgres
I changed the username password and encryption key, rebuild and restarted my containers then imported my metabase dump with the command shown above.
When I tried to login metabase prompt me to create a new user (usually it logs in automatically).
I couldn’t login with my old user account that btw existed in the core_users table of metabase.
I bypassed this problem by creating a new user, logged out and re-logged in with my account.
After when I went to the administrator page the first tab (settings) was not showing anything.
When I tried to view some of my dashboards I got the error:
Invalid value for string: must be either "true" or "false" (case-insensitive).
I believe that my data have some sort of protection by the encryption key and because I changed it and “forced” my old configuration to the database something crashed.
Now I want to find a better way to backup my data and not risk losing them, I searched the forum for the backup topic but I did not find anything I can use. The documentation page also does not provide much info only this:
Simply follow the same instructions you would use for making any normal database backup. It’s a large topic more fit for a DBA to answer, but as long as you have a dump of the Metabase database you’ll be good to go.
Metabase is a great tool and having an easy way for backing up the database would be awesome.
Also as this is my first post to the forums I wan’t to congratulate the developers for this amazing tool.