toniebox-reverse-engineering / teddycloud

teddyCloud is an open source server replacement for the Boxine Cloud
https://toniebox-reverse-engineering.github.io/docs/tools/teddycloud/
GNU General Public License v2.0
396 stars 31 forks source link

Function "Auto-Update tonies.json" does not update periodically #120

Open oliver-koch opened 7 months ago

oliver-koch commented 7 months ago

Function "Auto-Update tonies.json" does not update periodically

_Tested on TeddyCloud v0.3.5 (8602da9) - 2024-01-22 13:39:05 +0000 linux-x8664 on Docker

What was tested:

  1. Goto TeddyCloud webinterface and enable setting "Auto-Update tonies.json"
  2. Restart Container (done at 2024-01-23T07:30)
  3. Check Logs for auto-update entries after two days → Looks like 'tonies.json' was only updated after Container start.

What was expected:

I would expect an periodic update of the 'tonies.json' file (e.g. once a day) as the name of the settings "Auto-Update" tells.

Attached you can find the logs:

user@host:~# date
Thu Jan 25 11:08:38 AM CET 2024
user@host:~# docker logs --timestamps teddycloud 2>&1 | grep "tonies.json"
2024-01-23T07:30:23.819653378Z INFO |toniesJson.c:0057:tonies_update| Updating tonies.json from GitHub...
2024-01-23T07:30:24.161541749Z INFO |toniesJson.c:0079:tonies_update| ... success updating tonies.json from GitHub, reloading
2024-01-23T07:30:24.161621249Z INFO |toniesJson.c:0157:tonies_readJson| Trying to read /etc/teddycloud/config/tonies.json with size 4297501
SciLor commented 7 months ago

This is currently only used on startup, as there is a service missing that checks it once a day.

oliver-koch commented 7 months ago

Good to know. Then i will automatically restart my container as a workaround.

SciLor commented 7 months ago

As an alternative, you may trigger /api/toniesJsonUpdate.

oliver-koch commented 7 months ago

Good Hint. I read this a few minutes ago on Telegramm. This is less invasive. Thanks!

ceicke commented 6 months ago

I would like to tackle this ticket @SciLor but would like to get your input before. I see two ways of achieving this:

  1. Use CRON inside of docker to run something like ./bin/teddycloud --update-tonies-json
  2. Spin off a thread from within the server_init() function

What do you think? In my opinion, Option 1 is a little cleaner.

SciLor commented 6 months ago
  1. Would be an easy win, but does not integrate with teddyCloud (config file) and may only work with the docker variant.
  2. Using a dedicated thread for that would be the way to go
ceicke commented 6 months ago

@SciLor not sure if you already saw my PR and also not sure if it's what you are looking for. I had fun getting into the codebase though and am ready for feedback.

henryk86 commented 4 months ago

The solution looks fine and helpful for me, but it seems to be abandoned? @ceicke @SciLor ?

ceicke commented 3 months ago

It didn’t get merged yet because the build for Windows failed and I have no idea how to fix it…