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

[Docker] Settings won't be changed #104

Closed
bassmaster187 opened this issue Dec 27, 2019 · 22 comments
Closed

[Docker] Settings won't be changed #104

bassmaster187 opened this issue Dec 27, 2019 · 22 comments

Comments

@bassmaster187
Copy link
Owner

bassmaster187 commented Dec 27, 2019

Warning: file_get_contents(/etc/teslalogger/settings.json): failed to open stream: No such file or directory in /var/www/html/admin/language.php on line 2

ubuntu 18.09 64 Bit.

Docker version 19.03.5, build 633a0ea838
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0

Teslalogger: 1.36.0.0

@bassmaster187 bassmaster187 changed the title [Docker] Settings won [Docker] Settings won't be changed Dec 27, 2019
@nortonsk
Copy link

I am experiencing the same issue.

@bluppdiwupp
Copy link

same here

@bassmaster187
Copy link
Owner Author

Please try to update. It seems like It has a problem, when there is no settings file available.

@nortonsk
Copy link

nortonsk commented Dec 29, 2019 via email

@bassmaster187
Copy link
Owner Author

@nortonsk could you please post a screenshot of your settings panel.

@nortonsk
Copy link

nortonsk commented Dec 30, 2019 via email

@tscsmith
Copy link

tscsmith commented Jan 2, 2020

Hi Christian,

updated to the latest published version

Teslalogger: | 1.36.1.0

the error warnings at the top are gone!
In the settings.php I can see now what is actually set, except the scanmytesla integration. It is unchecked but I changed the config the hard way so it is enabled.
Anyway if I change now something and save it a popup appears that says it's saved.
But if I check the settings.php again nothing changed.

So some progress but the issue is not finally solved. Thanks again for your efforts!

@bassmaster187
Copy link
Owner Author

Could you guys please send me your settings.json file.
After that please try to delete your settings.json file and reload the settings panel.

@tscsmith
Copy link

tscsmith commented Jan 2, 2020

Ok I think we found the problem. I haven't a settings.json file in my Teslalogger\Teslalogger folder structure.

Here is something that I just found.
In my:

"/TeslaLogger/TeslaLogger/www/admin" folder there is the a file called settings.php

If you check the code there is something written like:

            $content = FALSE;
            if (file_exists("/etc/teslalogger/settings.json"))
                    $content = file_get_contents("/etc/teslalogger/settings.json");

            if ($content === FALSE)
            {
                    echo ("$('#radio_kw').prop('checked', true);\r\n");
                    echo ("$('#radio_celsius').prop('checked', true);\r\n");
                    echo ("$('#radio_km').prop('checked', true);\r\n");
                    echo ("$('#radio_en').prop('checked', true);\r\n");
            }

As I wrote at the beginning I haven't found any settings.json file anywhere. checked the whole system find / -name settings.json

Maybe I do some mistakes here.

@bassmaster187
Copy link
Owner Author

But you see all the other files in /etc/teslalogger in your "webserver" docker?

@tscsmith
Copy link

tscsmith commented Jan 2, 2020

Yes,

root@93fcdc1eeee4:/etc/teslalogger# ls GeocodeCache.xml MySQL.Data.EntityFrameworkCore.dll TeslaLogger.exe geofence.csv nohup.out Google.Protobuf.dll MySql.Data.EntityFramework.dll TeslaLogger.exe.config git tesla_token.txt Logfile.dll MySql.Data.dll VERSION language-en.txt tmp Logfile.pdb MySql.Web.dll backup.sh language-no.txt view_trip.txt M2Mqtt.Net.dll SRTM-Data car_settings.xml mono_crash.131916e56.0.json MQTTClient.exe SRTM.dll cmd_updated.txt mono_crash.26121ab28.0.json MQTTClient.exe.config SRTM.pdb current_json.txt mono_crash.28f0b2e8c.0.json MySQL.Data.EntityFrameworkCore.Design.dll TASKERTOKEN geofence-private.csv mono_crash.2d7624494.0.json

The TeslaLogger.exe.config that I manually edited with the "scanmytesla True" option is also there.

@bassmaster187
Copy link
Owner Author

@tscsmith is the settings.json there, if you hit save button?
If not, could you please post the recent seconds of your webserver logfile.
docker logs

@tscsmith
Copy link

tscsmith commented Jan 3, 2020

1st there is no settings.json if I hit the Save button.

I am not very into the whole docker universe, so I have some questions.

I looked into the teslalogger_webserver1 container )connected to the console) and checked the logfiles of: root@93fcdc1eeee4:/var/log/apache2# more error.log

But there is no data inside in all off the logfiles.
So I googled a little bit and found out that logfiles are written to the host:
/var/lib/docker/containers/93fcdc1eeee4fb5df6396aefe8b80c218181f25a03a9fede673e177da8c239cf/93fcdc1eeee4fb5df6396aefe8b80c218181f25a03a9fede673e177da8c239cf-json.log

Attached the tail-f from the log but there is nothing that would help you I think.

{"log":"192.168.113.2 - - [03/Jan/2020:09:13:55 +0100] "GET /admin/img/icon-help-24.png HTTP/1.1" 304 180 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:13:55.214775753Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:14:00 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 444 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:14:00.091479169Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:14:02 +0100] "GET /admin/settings.php HTTP/1.1" 200 1689 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:14:02.584171127Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:14:12 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 445 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:14:12.46581551Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:14:13 +0100] "GET /admin/settings.php HTTP/1.1" 200 1689 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:14:14.010679053Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:16:48 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 446 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:16:48.203907297Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:16:49 +0100] "GET /admin/settings.php HTTP/1.1" 200 1689 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:16:49.698065772Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:17:13 +0100] "GET /admin/password.php HTTP/1.1" 200 996 "http://192.168.1.211:8888/admin/settings.php\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:17:13.643988394Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:17:21 +0100] "GET /admin/current_json.php HTTP/1.1" 200 701 "http://192.168.1.211:8888/admin/\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:17:21.886292805Z"}
{"log":"192.168.113.2 - - [03/Jan/2020:09:19:06 +0100] "GET /admin/current_json.php HTTP/1.1" 200 701 "http://192.168.1.211:8888/admin/\" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"\n","stream":"stdout","time":"2020-01-03T08:19:06.85555771Z"}

Sorry I don't know much about the docker stuff and how it plays all together with the 4 containers for the teslalogger.

@bassmaster187
Copy link
Owner Author

@tscsmith the docker will redirect the logfiles to stdout and stderr.
The attaced logfile is not long enough as I can't see settings_write.php has been loaded.

it should look like this:

172.19.0.1 - - [03/Jan/2020:10:16:03 +0100] "GET /admin/current_json.php HTTP/1.1" 200 652 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:03 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:08 +0100] "GET /admin/current_json.php HTTP/1.1" 200 695 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:09 +0100] "GET /admin/settings.php HTTP/1.1" 200 1735 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:09 +0100] "GET /admin/img/icon-help-24.png HTTP/1.1" 200 870 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:15 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 237 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:21 +0100] "GET /admin/settings.php HTTP/1.1" 200 1730 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"

@tscsmith
Copy link

tscsmith commented Jan 3, 2020

@tscsmith
Copy link

tscsmith commented Jan 4, 2020

Little update from me to the latest version
Teslalogger: | 1.36.3.0

  • no error messages
  • settings tab:
    can change settings but if I hit save, popup appears that confirms the saving, after that you see now immediately that the changed settings jumps back to the standard settings
  • so unfortunately its still not possible to change the settings from the settings tab

@tscsmith
Copy link

tscsmith commented Jan 5, 2020

Teslalogger 1.36.4.0 same behavior as 1.36.3.0

@bassmaster187
Copy link
Owner Author

Can anybody give me temporary remote access to their shell and admin panel?

@rowich
Copy link
Contributor

rowich commented Jan 7, 2020 via email

@nortonsk
Copy link

nortonsk commented Jan 14, 2020

UPDATE:
Issue was fixed by setting the ownership to www-data on the whole folder Teslalogger/bin
I have set the permission to other folders too.
chown -R www-data Teslalogger

Now the issue is gone and save of the settings.json works.

Still the issue is there:
When I have settings.json it cannot read it and do not show options...
When I remove settings.json file then it shows me default values and when I hit on SAVE it gives me window saved...
No file created.

From logs I have this:
192.168.1.18 - - [14/Jan/2020:16:03:56 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 445 "http://192.168.1.245:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

192.168.1.18 - - [14/Jan/2020:16:03:59 +0100] "GET /admin/settings.php HTTP/1.1" 200 1688 "http://192.168.1.245:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

If you like we can have a session via Skype/Teams or other program and I can share you my screen.

REgards,

Norton

@bassmaster187
Copy link
Owner Author

Please update to 1.37.3.0 - after Reboot you should see this in logfile:

teslalogger_1  | 15.01.2020 16:39:41 : Creating empty settings.json
teslalogger_1  | 15.01.2020 16:39:41 : chmod 666 /etc/teslalogger/settings.json

after that, you should be able to write the settings file.

@tscsmith
Copy link

Nice work! Thank you for your efforts. Works like a charm now. :)

bassmaster187 pushed a commit that referenced this issue Aug 13, 2020
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

5 participants