Community
OpenEnergyMonitor

Community

Need help with first Emoncms setup on synology diskstation

Hello to everyone,

maybe someone can help me… I’m trying to start a local Emoncms setup on Synology diskstation. Was following this old post with step by step directions:
https://openenergymonitor.org/forum-archive/node/12298.html

Got through all steps but in the end I get a blank page, when I turned on debuging in Web services in synology accessing my local emoncms site I got this error:

Warning: require_once(default-settings.php): failed to open stream: No such file or directory in /volume1/web/emoncms/process_settings.php on line 21 Call Stack: 0.0001 241880 1. {main}() /volume1/web/emoncms/index.php:0 0.0002 242408 2. require('/volume1/web/emoncms/process_settings.php') /volume1/web/emoncms/index.php:17 Fatal error: require_once(): Failed opening required 'default-settings.php' (include_path='.') in /volume1/web/emoncms/process_settings.php on line 21 Call Stack: 0.0001 241880 1. {main}() /volume1/web/emoncms/index.php:0 0.0002 242408 2. require('/volume1/web/emoncms/process_settings.php') /volume1/web/emoncms/index.php:17

And the dumbest thing I don’t get a /var/log/emoncms.log directory or log file…

I hope from this it’s possible to see a newbie mistake :wink:

Hello @Vaidas and welcome!

Is default-settings.php present in your emoncms directory? The latest version of emoncms support ini format for emoncms settings. Rename: example.settings.ini to settings.ini and adjust as needed

hello TrystanLea and thanks for your sugestions!

Had to go another way, found a guy with more experiernce :slight_smile: he was able to start the site with help of “docker” and finaly got to see initial log in page of the emoncms!

But we are still unable to make it run automaticaly after restart of the Synology diskstation and the error that we can’t get past is:

Fatal error: Class ‘Redis’ not found in /volume1/web/emoncms/index.php on line 34 Call Stack: 0.0001 245128 1. {main}() /volume1/web/emoncms/index.php:0

any sugestions where to lok for a fix?

I think there may be an issue relating to env variables relating to docker installs, @borpin has a fix for this that I need to review.

My fix is here https://github.com/emoncms/emoncms/pull/1467 to the envars.

I also suggested this https://github.com/emoncms/emoncms/issues/1469 was an issue.

Thanks for your suggestion but do I understand it correctly that this solution is for linux machines?

My problem how my friend explained is that in principal everything works natively on Synology DS918+ “web station” except the Redis service for that he needed to install docker and make this whole workaround… is it a known problem that Redis is not working on Synology diskstation and only solution is docker? it’s quite disappointing to have docker with all it’s booked resources only for this one service as I don’t have any other uses for Docker…

Thanks for your thoughts in advance :slight_smile:

Hello @Vaidas my understanding is that Synology is a specific environment which is quite different from the debian linux environment that the emoncms installation is designed for. We havent tested the latest emoncms build on Synology yet so Im not suprised that you came across issues there. A while ago I tried an emoncms install on Synology but came across an issue, I cant remember now what it was but I ended up going the docker route as well which worked fine.

However my understanding is that the latest version of emoncms needs a couple of fixes to work with docker (we have made quite a number of large changes recently). @borpin has been looking at this but I havent had a chance yet to test his solution yet.

The nice thing about using docker for the emoncms install on Synology is that it keeps emoncms contained and separate from the rest of your Synology system.

Hello @TrystanLea

I’ve been using EmonCMS in my Synology servers with Web Station for the last five years, everything works fine (with previous versions EmonCMS, ex. 9.8.28).

But when installing the latest version of EmonCMS (master), I encountered a problem: “Error connecting to the database”

I was able to install the latest version of EmonCMS on one my Synology NAS (with the latest DSM) with Web Station. But only if I edit the settings.php file as follows (as in previous versions EmonCMS):

$_settings = array(
// Suggested installation path for symlinked emoncms modules /opt/emoncms
"emoncms_dir" => "/volume1/web/emoncms",
// Suggested installation path for emonpi and EmonScripts repository: /opt/openenergymonitor
"openenergymonitor_dir" => "/opt/openenergymonitor",

// Show all fatal PHP errors
"display_errors" => true,

// Set to true to run database update without logging in
// URL Example: http://localhost/emoncms/admin/db
"updatelogin" => false,

//1 #### Mysql database settings
"sql"=>array(
    $server   = "127.0.0.1",
    $database = "emoncmshome",
    $username = "emoncms",
    $password = "emondb***********",
    $port     = 3307,
    // Skip database setup test - set to false once database has been setup.
    $dbtest = true
),

Only after such editing can I create an account and log in.

But in the file default-settings.php, it looks like this:

$_settings = array(
// Suggested installation path for symlinked emoncms modules /opt/emoncms
"emoncms_dir" => "/opt/emoncms",
// Suggested installation path for emonpi and EmonScripts repository: /opt/openenergymonitor
"openenergymonitor_dir" => "/opt/openenergymonitor",

// Show all fatal PHP errors
"display_errors" => true,

// Set to true to run database update without logging in
// URL Example: http://localhost/emoncms/admin/db
"updatelogin" => false,

// Mysql database settings
"sql"=>array(
    "server"   => "localhost",
    "database" => "emoncms",
    "username" => "_DB_USER_",
    "password" => "_DB_PASSWORD_",
    "port"     => 3306,
     // Skip database setup test - set to false once database has been setup.
    "dbtest"   => true
),

You wrote, that the file default-settings.ini can be used for settings? How right?
Thanks.

I was inattentive! If I use for settings a file settings.ini, everything works great (EmonCMS v.10.1.13).

But on the Administrator page, I received some notifications:

Notice: Undefined index: total in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 304 Notice: Undefined index: free in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 306

admin_main_view.php

<h4 class="text-info text-uppercase border-top pt-2 mt-0 px-1"><?php echo _('Memory'); ?></h4>
        <dl class="row">
            <?php 
            echo row(_('RAM'), bar($ram_info['table'], sprintf(_('Used: %s%%'), $ram_info['percent']), array(
                'Total'=>$ram_info['total'],         **< 304 line**
                'Used'=>$ram_info['used'],
                'Free'=>$ram_info['free']           **< 306 line**
            )));
            if (!empty($ram_info['swap'])) {
                echo row(_('Swap'), bar($ram_info['swap']['table'], sprintf(_('Used: %s%%'), $ram_info['swap']['percent']), array(
                    'Total'=>$ram_info['swap']['total'],
                    'Used'=>$ram_info['swap']['used'],
                    'Free'=>$ram_info['swap']['free']
                )));
            }
            ?>
            
        </dl>

What could be wrong? Thanks.

The admin page assumes that you are running on a physical machine rather than in a Dock etc. It just means it cannot get the data. The fetching of that data needs to be more robust.

Hello @borpin

In my case EmonCMS running on a physical machine (Synology with last DSM 6.2.2U4) in Web Station. Not in Docker.

It must mean that the source used for the $ram_info either does not exist on the underlying OS or Disto on the Synology.

Took a while to find it.

I do not quite understand what is in the code.

But in Synology, in the file /proc/meminfo empty.

proc/meminfo

meminfo

?

That is why you get the error. On my Debian VM and Raspbian it isn’t empty. It is nothing to worry about.

MemTotal:         999036 kB
MemFree:          561952 kB
MemAvailable:     722308 kB
Buffers:           30844 kB
Cached:           202764 kB
SwapCached:            0 kB
Active:           260532 kB
Inactive:          97388 kB
Active(anon):     130828 kB
Inactive(anon):    34604 kB
Active(file):     129704 kB
Inactive(file):    62784 kB
Unevictable:          16 kB
Mlocked:              16 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        124348 kB
Mapped:            62596 kB
Shmem:             41124 kB
Slab:              59100 kB
SReclaimable:      25700 kB
SUnreclaim:        33400 kB
KernelStack:        1368 kB
PageTables:         3556 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      601912 kB
Committed_AS:    1189140 kB
VmallocTotal:    1064960 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:             1232 kB
CmaTotal:           8192 kB
CmaFree:            6028 kB

It’s strange. I understood. Thanks.