{"id":103,"date":"2025-06-15T05:46:08","date_gmt":"2025-06-15T05:46:08","guid":{"rendered":"http:\/\/blizzard.iptime.org\/?p=103"},"modified":"2025-08-01T05:46:42","modified_gmt":"2025-08-01T05:46:42","slug":"teslamate-2-0-0-%ec%97%85%eb%8d%b0%ec%9d%b4%ed%8a%b8","status":"publish","type":"post","link":"https:\/\/blog.myserveronthe.cloud\/?p=103","title":{"rendered":"Teslamate 2.0.0 \uc5c5\ub370\uc774\ud2b8"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">2025\ub144 4\uc6d4 26\uc77c Teslsmate v.2.0.0\uc774 \uacf5\uac1c\ub418\uc5c8\ub2e4 (<a href=\"https:\/\/github.com\/teslamate-org\/teslamate\/releases\">https:\/\/github.com\/teslamate-org\/teslamate\/releases<\/a>). <br><br>2025\ub144 6\uc6d4 15\uc77c Teslamate \ubc84\uc804 1.3.2\uc5d0\uc11c 2.0.0\uc73c\ub85c \uc5c5\ub370\uc774\ud2b8\ub97c \uc2dc\ub3c4\ud558\uba74\uc11c \ub0a8\uae30\ub294 \uae30\ub85d.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This update requires postgreSQL version 16.7, 17.3 or higher.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Check current version<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec database postgres &#8211;version<br>WARN[0000] \/home\/pi\/teslamate\/docker-compose.yml: <code>version<\/code> is obsolete<br>postgres (PostgreSQL) 16.6 (Debian 16.6-1.pgdg120+1)<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create database backup<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T database pg_dump -U teslamate teslamate &gt; .\/teslamate_2025-06-15.bck<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"994\" height=\"260\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-11.35.41\u202fAM.png\" alt=\"\" class=\"wp-image-105\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Stop the running containers<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1040\" height=\"220\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-12.36.36\u202fPM.png\" alt=\"\" class=\"wp-image-106\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Update the &#8216;docker-compose.yml&#8217;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Open the &#8216;docker-compose.yml&#8217; file and update the image version.<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>services:\n  database:\n    image: postgres:17\n    ...<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"356\" height=\"126\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-12.40.25\u202fPM.png\" alt=\"\" class=\"wp-image-107\" style=\"width:209px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. (Error) Run the &#8216;database&#8217; container<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose up -d database<br>WARN[0000] \/home\/pi\/teslamate\/docker-compose.yml: <code>version<\/code> is obsolete<br>[+] Running 0\/0<br>\u280b database Pulling 0.1s<br>error getting credentials &#8211; err: exit status 1, out: <code>GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files<\/code><\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1968\" height=\"230\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-1.02.38\u202fPM.png\" alt=\"\" class=\"wp-image-133\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5-1. Try Manual Pull<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker pull postgres:17<br>17: Pulling from library\/postgres<br>6aafc35ac588: Pull complete<br>1f678460491e: Pull complete<br>ab1541c2cc21: Pull complete<br>2a1dd2cd14ae: Pull complete<br>bb6197ced2d4: Pull complete<br>3e751019b3b3: Pull complete<br>533b1db07902: Pull complete<br>436d3b49bcef: Pull complete<br>b28acd88fcff: Pull complete<br>019b2c634abf: Pull complete<br>b1dbcb6d4226: Pull complete<br>6f04b6d20f78: Pull complete<br>209fb6f4de59: Pull complete<br>18c843985750: Pull complete<br>Digest: sha256:6cf6142afacfa89fb28b894d6391c7dcbf6523c33178bdc33e782b3b533a9342<br>Status: Downloaded newer image for postgres:17<br>docker.io\/library\/postgres:17<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5-2. Run the &#8216;database&#8217; container again<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose up -d database<br>[+] Running 3\/3<br>\u2714 Network teslamate_default Created 0.2s<br>\u2714 Volume &#8220;teslamate_teslamate-db&#8221; Created 0.0s<br>\u2714 Container teslamate-database-1 Started<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Not sure the manual pull cleared the error away or re-trying it did the job, it runs now.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Check postgres version<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec database postgres &#8211;version<br>postgres (PostgreSQL) 17.5 (Debian 17.5-1.pgdg120+1)<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now pulled 17.5 version is pulled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">7. (Error) Pull all docker containers<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose pull<br>[+] Pulling 0\/0<br>\u280b grafana Pulling 0.0s<br>\u280b teslamate Pulling 0.0s<br>\u280b database Pulling 0.0s<br>\u280b mosquitto Pulling 0.0s<br>error getting credentials &#8211; err: exit status 1, out: <code>GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files<\/code><\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This means Docker is trying to access <strong>stored credentials<\/strong> (e.g., from a keyring or secret manager), but my environment doesn\u2019t have a running secret service (like GNOME Keyring or similar).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">7-1. Install the secret service<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ sudo apt install gnome-keyring<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">7-2. Pull docker images<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose pull<br>[+] Pulling 31\/31<br>\u2714 teslamate Pulled 27.7s<br>\u2714 addc1be20d09 Pull complete 10.5s<br>\u2714 5128e741d0c8 Pull complete 10.7s<br>\u2714 294835a1471d Pull complete 11.4s<br>\u2714 795155113141 Pull complete 11.9s<br>\u2714 7518e5dcc2e3 Pull complete 23.5s<br>\u2714 289188b73aff Pull complete 23.9s<br>\u2714 mosquitto Pulled 19.0s<br>\u2714 76099982f066 Pull complete 10.1s<br>\u2714 59fdea63e2e9 Pull complete 14.0s<br>\u2714 bc41ff03e4bf Pull complete 15.2s<br>\u2714 database Pulled 2.4s<br>\u2714 grafana Pulled 60.6s<br>\u2714 85f3b18f9f5a Pull complete 11.1s<br>\u2714 2c6d01fffec5 Pull complete 11.2s<br>\u2714 c42de6df1517 Pull complete 15.6s<br>\u2714 5fb4475f3ee1 Pull complete 16.3s<br>\u2714 384236ac3b65 Pull complete 16.5s<br>\u2714 7c2c04a8572b Pull complete 16.8s<br>\u2714 d60f34454bb3 Pull complete 36.3s<br>\u2714 6c1703403c0b Pull complete 54.9s<br>\u2714 8e9b79f51b66 Pull complete 55.9s<br>\u2714 55e463089067 Pull complete 56.0s<br>\u2714 b8bfedf2304b Pull complete 56.1s<br>\u2714 2f1c786ddd98 Pull complete 56.2s<br>\u2714 58f4ca4f08ce Pull complete 56.3s<br>\u2714 3f9dea0119cc Pull complete 56.3s<br>\u2714 b4e23da631a9 Pull complete 56.4s<br>\u2714 495928fed2e7 Pull complete 56.5s<br>\u2714 bf99d1f7e253 Pull complete 56.6s<br>\u2714 201936771044 Pull complete<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now no error while pulling the images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8. Restore data from the backup<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">It was advised in the documentation that:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"># Stop the teslamate container to avoid write conflicts<\/mark><br>docker compose stop teslamate<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"># Drop existing data and reinitialize (Don&#8217;t forget to replace first teslamate if using different TM_DB_USER)<\/mark><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"># Connects to the teslamate database as user teslamate.<br>#Completely drops the public schema, which deletes all tables and #data.<br>#Recreates the public schema.<br># Adds extensions cube and earthdistance, which are used by TeslaMate for geographic calculations.<\/mark><br>docker compose exec -T database psql -U teslamate teslamate &lt;&lt; .<br>DROP SCHEMA public CASCADE;<br>CREATE SCHEMA public;<br>CREATE EXTENSION cube WITH SCHEMA public;<br>CREATE EXTENSION earthdistance WITH SCHEMA public;<br>.<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"># Restore<\/mark><br>docker compose exec -T database psql -U teslamate -d teslamate &lt; teslamate.bck<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"># Restart the teslamate container<\/mark><br>docker compose start teslamate<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">But it didn&#8217;t go easy as it seems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8-1. (Error) Dropping existing data and reinitilize<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec -T database psql -U teslamate teslamate &lt;&lt; .<br>DROP SCHEMA public CASCADE;<br>CREATE SCHEMA public;<br>CREATE EXTENSION cube WITH SCHEMA public;<br>CREATE EXTENSION earthdistance WITH SCHEMA public;<br>.<br>service &#8220;database&#8221; is not running<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The error service &#8220;database&#8221; is not running means &#8216;Docker Compose&#8217; cannot find a running container named database as defined in your docker-compose.yml file. The &#8216;yml&#8217; file should define the name &#8220;database&#8221; as<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  database:\n    image: postgres:17\n    ...<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">But with the name properly defined I still got an error when I try to run the database container<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose up -d database<br>[+] Running 1\/2<br>\u2714 Network teslamate_default Created 0.4s<br>\u2819 Container teslamate-database-1 Starting 1.1s<br>Error response from daemon: network 25966f0aefa97e371018f3acea4d80d5572bb6b179dfeac2745afe621f5f84f3 not found<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1646\" height=\"146\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.09.36\u202fPM.png\" alt=\"\" class=\"wp-image-108\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Teslamate docs has a note that says:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-small-font-size wp-block-paragraph\">If you get the error&nbsp;<code>No such service: database<\/code>, update your&nbsp;<em>docker-compose.yml<\/em>&nbsp;or use&nbsp;<code>db<\/code>&nbsp;instead of&nbsp;<code>database<\/code>&nbsp;in the above command.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">It doesn&#8217;t clearly state to which name should the &#8216;docker-compose.yml&#8217; be updated, but let us try changing &#8216;database&#8217; into &#8216;db&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  db:\n    image: postgres:17\n    ...<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">And run the container with the new name.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose up -d db<br>WARN[0000] Found orphan containers ([teslamate-database-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the &#8211;remove-orphans flag to clean it up.<br>[+] Running 1\/1<br>\u2714 Container teslamate-db-1 Started<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1974\" height=\"152\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.15.18\u202fPM.png\" alt=\"\" class=\"wp-image-109\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Since the database name has been defined as &#8216;db&#8217;, the line &#8216;DATABASE_HOST = database&#8217; should be updated as well. If not, we&#8217;ll see error logs like:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker logs teslamate-teslamate-1<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<br>waiting for postgres at database:5432<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"252\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.33.32\u202fPM.png\" alt=\"\" class=\"wp-image-115\" style=\"width:471px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now the database container &#8216;db&#8217; is running. We&#8217;ll try again to re-initialize the database <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec -T db psql -U teslamate teslamate &lt;&lt; .<br>DROP SCHEMA public CASCADE;<br>CREATE SCHEMA public;<br>CREATE EXTENSION cube WITH SCHEMA public;<br>CREATE EXTENSION earthdistance WITH SCHEMA public;<br>.<br>psql: error: connection to server on socket &#8220;\/var\/run\/postgresql\/.s.PGSQL.5432&#8221; failed: FATAL: database &#8220;teslamate&#8221; does not exist<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1884\" height=\"206\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.15.59\u202fPM.png\" alt=\"\" class=\"wp-image-110\"\/><\/figure>\n\n\n\n<p class=\"has-manrope-font-family has-medium-font-size wp-block-paragraph\">It means that <strong>inside your <code>database<\/code> container, the <code>teslamate<\/code> database is missing<\/strong>.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now I need to check check existing databases in the container<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I checked the list of databases<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec database psql -U teslamate -c &#8220;\\l&#8221;<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1840\" height=\"298\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.17.18\u202fPM.png\" alt=\"\" class=\"wp-image-111\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">There is no database named &#8216;teslamate&#8217;, so I tried to create the database, and got an error like:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T db psql -U teslamate -c &#8220;CREATE DATABASE teslamate;&#8221;<br>psql: error: connection to server on socket &#8220;\/var\/run\/postgresql\/.s.PGSQL.5432&#8221; failed: FATAL: database &#8220;teslamate&#8221; does not exist<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1892\" height=\"424\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.17.56\u202fPM.png\" alt=\"\" class=\"wp-image-112\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This is because The psql command, if no database is specified, tries to connect to a database named after the user (teslamate here). But we did not specify the database to connect to for this command. So it tries to connect to teslamate(default DB matching the user) which doesn&#8217;t exist.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So we should try instead:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T db psql -U teslamate -d postgres -c &#8220;CREATE DATABASE teslamate;&#8221;<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Tried initializing the database again<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec -T db psql -U teslamate teslamate &lt;&lt; .<br>DROP SCHEMA public CASCADE;<br>CREATE SCHEMA public;<br>CREATE EXTENSION cube WITH SCHEMA public;<br>CREATE EXTENSION earthdistance WITH SCHEMA public;<br>.<br>DROP SCHEMA<br>CREATE SCHEMA<br>CREATE EXTENSION<br>CREATE EXTENSION<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1276\" height=\"276\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.18.30\u202fPM.png\" alt=\"\" class=\"wp-image-113\" style=\"width:544px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now the database has been successfully initialized, we can try restore data from the back up.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T db psql -U teslamate -d teslamate &lt; teslamate_2025-06-15.bck<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1610\" height=\"796\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.19.02\u202fPM.png\" alt=\"\" class=\"wp-image-114\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">It will take a wile to get finished.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-large-font-size wp-block-paragraph\">9. Run all the docker containers<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose up -d<br>[+] Running 5\/5<br>\u2714 Network teslamate_default Created 0.2s<br>\u2714 Container teslamate-mosquitto-1 Started 2.0s<br>\u2714 Container teslamate-teslamate-1 Started 2.3s<br>\u2714 Container teslamate-grafana-1 Started 2.2s<br>\u2714 Container teslamate-db-1 Started<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"196\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.35.08\u202fPM.png\" alt=\"\" class=\"wp-image-116\" style=\"width:403px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And check the logs if there&#8217;s no error.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker logs teslamate-teslamate-1<br>2025-06-15 04:58:34.406 [info] == Running 20250407155134 TeslaMate.Repo.Migrations.UpgradeEarthdistance.change\/0 forward<br>2025-06-15 04:58:34.416 [info] execute &#8220;ALTER EXTENSION earthdistance UPDATE&#8221;<br>2025-06-15 04:58:34.419 [info] version &#8220;1.2&#8221; of extension &#8220;earthdistance&#8221; is already installed<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1740\" height=\"136\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.34.49\u202fPM.png\" alt=\"\" class=\"wp-image-117\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">10. Open Web UI and check Grafana Dashboard.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The web interface is accessible, meaning that the containers are talking properly.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1572\" height=\"738\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.37.20\u202fPM_Mosaic.png\" alt=\"\" class=\"wp-image-135\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Grafana reads its data from TeslaMate\u2019s PostgreSQL. So if<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">TeslaMate restored data properly,<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Time range in Grafana dashboard is correct (e.g., Last 7 days),<\/li>\n\n\n\n<li class=\"has-medium-font-size\">And the dashboards are configured correctly,<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">It should display the data as it did before the update.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"1410\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.38.19\u202fPM.png\" alt=\"\" class=\"wp-image-121\" style=\"width:471px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Although the web UI is accessible, the data is not being displayed at all. It should be checked if the data restoration has finished successfully.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">10-1. Inspect Database Contents Manually<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Run this to inspect the tables inside the <code>teslamate<\/code> database:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T db psql -U teslamate -d teslamate -c &#8220;\\dt&#8221;<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Then we&#8217;ll see<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec -T db psql -U teslamate -d teslamate -c &#8220;\\dt&#8221;<br>List of relations<br>Schema |        Name         | Type  |   Owner<br>&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;<br>public | addresses           | table | teslamate<br>public | car_settings        | table | teslamate<br>public | cars                | table | teslamate<br>public | charges             | table | teslamate<br>public | charging_processes  | table | teslamate<br>public | drives              | table | teslamate<br>public | geofences           | table | teslamate<br>public | positions           | table | teslamate<br>public | schema_migrations   | table | teslamate<br>public | settings            | table | teslamate<br>public | states              | table | teslamate<br>public | tokens              | table | teslamate<br>public | updates             | table | teslamate<br>(13 rows)<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1362\" height=\"512\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.38.52\u202fPM.png\" alt=\"\" class=\"wp-image-122\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If it failed it would have showed errors:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">ERROR: relation already exists<br>permission denied<br>or anything else<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">And to see the actual data inside the tables:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose exec -T db psql -U teslamate -d teslamate -c &#8220;SELECT * FROM updates LIMIT 5;&#8221;<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Which will show if no errors:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">pi@raspberrypi:~\/teslamate $ docker compose exec -T db psql -U teslamate -d teslamate -c &#8220;SELECT * FROM updates LIMIT 5;&#8221;<br>id | start_date | end_date | version | car_id<br>&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;<br>1 | 2024-07-24 11:54:35.495 | 2024-07-24 11:54:35.495 | 2024.14.200.2 ee4474339aad | 1<br>2 | 2024-08-06 03:42:29.455 | 2024-08-06 04:20:20.112 | 2024.20.100 f3e392c63402 | 1<br>34 | 2024-10-06 04:24:01.071 | 2024-10-06 04:43:54.189 | 2024.26.8 7c528851cb24 | 1<br>35 | 2024-12-22 06:01:52.393 | 2024-12-22 06:12:04.811 | 2024.44.25.3 b26d46a49cbf | 1<br>36 | 2025-01-28 10:32:54.168 | 2025-01-28 10:32:54.168 | 2024.45.32 26bf7521c499 | 1<br>(5 rows)<\/p>\n<\/blockquote>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The fact that the we can read data from the tables means the data restoration was successful. Now the issue is likely due to the service renaiming, &#8216;database&#8217; into &#8216;db&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">10-2. Check docker-compose.yml<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Open the &#8216;docker-compose.yml&#8217; file and find lines with the DATABASE_HOST in it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>environment:\n  - DATABASE_HOST=database<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">If it sill contains old name, this should be renamed as &#8216;db&#8217;, so update it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>environment:\n  - DATABASE_HOST=db<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Then save and restart the stack<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-fira-code-font-family has-small-font-size wp-block-paragraph\">docker compose down<br>docker compose up -d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">10-3.  Check Grafana Configuration<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Grafana connects to PostgreSQL independently. If Grafana started before the DB or before TeslaMate had inserted any data, the data source may be misconfigured or empty.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>To check:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Go to Grafana at <code>http:\/\/&lt;your_pi_ip&gt;:3101<\/code><\/li>\n\n\n\n<li class=\"has-medium-font-size\">Login (default is usually <code>admin<\/code> \/ <code>admin<\/code>)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Go to \u2699\ufe0f <strong>&#8220;Configuration&#8221;<\/strong> \u2192 <strong>&#8220;Data Sources&#8221;<\/strong><\/li>\n\n\n\n<li class=\"has-medium-font-size\">Click the <code>PostgreSQL<\/code> data source (should be named <code>TeslaMate<\/code>)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Click <strong>Save &amp; Test<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">If it fails, it might show <code>database \"teslamate\" does not exist<\/code> \u2014 this could happen if the DB wasn\u2019t ready when Grafana started.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"> The host URL was configured as &#8216;database:5432&#8217;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"380\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.43.11\u202fPM.png\" alt=\"\" class=\"wp-image-130\" style=\"width:346px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">which should be &#8216;db:5432&#8217;. Update it and hit the &#8216;Save &amp; Test&#8217; again.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1320\" height=\"224\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.44.27\u202fPM.png\" alt=\"\" class=\"wp-image-126\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">11. Check if it works!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"978\" height=\"358\" src=\"http:\/\/blizzard.iptime.org\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-15-at-2.45.44\u202fPM.png\" alt=\"\" class=\"wp-image-127\" style=\"width:360px;height:auto\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>2025\ub144 4\uc6d4 26\uc77c Teslsmate v.2.0.0\uc774 \uacf5\uac1c\ub418\uc5c8\ub2e4 (https:\/\/github.com\/teslamate-org\/teslamate\/releases). 2025\ub144 6\uc6d4 15\uc77c Teslamate \ubc84\uc804 1.3.2\uc5d0\uc11c 2.0.0\uc73c\ub85c \uc5c5\ub370\uc774\ud2b8\ub97c \uc2dc\ub3c4\ud558\uba74\uc11c \ub0a8\uae30\ub294 \uae30\ub85d. This update requires postgreSQL version 16.7, 17.3 or higher. 1. Check current version pi@raspberrypi:~\/teslamate $ docker compose exec database postgres &#8211;versionWARN[0000] \/home\/pi\/teslamate\/docker-compose.yml: &hellip; <a href=\"https:\/\/blog.myserveronthe.cloud\/?p=103\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":5,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":137,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/137"}],"wp:attachment":[{"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.myserveronthe.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}