I have moved Timestore's database tree via its command line option D ( https://github.com/TrystanLea/timestore/blob/master/src/main.c#L57 ) to a new path.
Timestore nicely creates a new adminkey and also its tsdb files in the new path but emoncms was never picking up any data. Being new to emoncms I have been fighting badly with this one until I realized that emoncms's timestore module has the path to the database tree hardcoded.
root@emoncms /var/www/emoncms # fgrep -r /var/lib/timestore/ *
Modules/feed/engine/Timestore.php: $primaryfeedname = "/var/lib/timestore/$feedname";
Modules/feed/engine/Timestore.php: $meta = fopen("/var/lib/timestore/$feedname", 'rb');
Modules/feed/engine/Timestore.php: $meta = fopen("/var/lib/timestore/$feedname", 'rb');
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_0_.dat");
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_1_.dat");
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_2_.dat");
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_3_.dat");
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_4_.dat");
Modules/feed/engine/Timestore.php: $size += filesize("/var/lib/timestore/".str_pad($feedid, 16, '0', STR_PAD_LEFT)."_5_.dat");
readme.md: cat /var/lib/timestore/adminkey.txt
May I propose to add the database tree path to the emoncms settings.php to make it configurable.
Side note:
Timestore tries to switch to the timestore user after start. But neither the install guide nor the install script mention this. Is this on purpose?
Otherwise we could just add something like
useradd -s /usr/sbin/nologin timestore
chown timestore /var/lib/timestore
to the install script.
Re: Timestore.php - Hardcoded path to database tree
A yes of course, I forgot about that, good idea.
I've never had to set the timestore user, but I think the folder needs to be created as root, this is usually handled by the timestore install script, so maybe a note is required for installation without using the install script.