I’m not really familiar with modern Linux OS, but have some out of date background in Solaris, plus some general IT troubleshooting experience. It took two days for me to solve all the issues with getting emoncms to run on the current DSM (Disk Station Manager) release (5.2 5644 Update 5, March 2016), with the help of many web searches and a lot of hints on this forum. I thought it would be worth posting a step-by-step guide of what needs doing to get this set up working, (or at least, what worked for me!).
Set up the Synology webserver and MySQL database for emoncms
- Enable Web station in Web Services and accept firewall port changes if required
- Use Package Center to download and install MariaDB (MySQL equivalent)
- Use Package Center to download and install phpMyAdmin
- Launch phpMyAdmin via http://<IP address of NAS>/phpMyAdmin and logon with username “root”, leaving password blank
- Select Databases tab and create database “emoncms” with Collation unselected (will default to utf8_general_ci)
- Select Users tab in phpMyAdmin and click Add user. Create user “emoncms” and set Host to “localhost” (both without inverted commas). Generate a password and copy this carefully. Do not grant any global privileges. Create user by selecting “Go”.
- Select the “Edit Privileges” for the new "emoncms" user and click the Database button on the resulting page. Highlight the emoncms database item in the list and click “Go”. Select “Check All” on the database privilege page and click “Go”.
- Optional, but important for security, set a password for all the root user entries in the phpMyAdmin user page (makes sense to set them all to the same password). You might also delete the default anonymous user.
Create the emoncms website
- Download the latest emoncms zip file from the https://github.com/emoncms/emoncms webpage. Use the Download ZIP button on the page (I missed this originally!)
- Windows: Open the \\<NAS name>\web share using the Synology admin password.Presumably NFS/AFP equivalents work, but I’ve not tried them. If all else fails, enable FTP in the Synology File Services Control Panel and use ftp to connect to the Synology IP address using the admin password.
- Create an emoncms folder under the web folder and extract all the files from the downloaded zip to this folder.
- Open default.settings.php and edit the lines $username = "_DB_USER_"; and $password = "_DB_PASSWORD_"; to the user and password of the emoncms database user you created above.
- Scroll down to $log_filename = '/var/log/emoncms.log'; and change to $log_filename = '/var/services/tmp/emoncms.log'; (This path is already in the php open_basedir path.You could try adding /var/log to this path as an alternative but I have not tested this: see below).
- Save file as settings.php to the emoncms web folder (i.e. where the original default.settings.php came from!)
- In DSM Control Panel/Web services/PHP settings tab select the “Customize PHP open_basedir” and add /var/lib/phpfina to the path (make sure to separate this with a colon from the existing path)
- Browse to http://<IP address of NAS>/emoncms and you should see the expected log in page.You can create a user now as per usual “first use” and get the read and write API keys.
- If you check back inphpMyAdmin the tree view on the left of the page should now have a (+) next to the emoncms database which, when clicked, expands to show all the tables created by the first access of the site
- Edit settings.php to set line $dbtest = true;to $dbtest = false;.
Create feed directories on Synology.
- Enable SSH service in DSM Control Panel/Terminal and SNMP/Terminal and accept firewall port changes if prompted
- Download PuTTY or equivalent SSH client and connect to the Synology IP address with username “root” and the admin password.Using “admin” as the username will NOT work
- To create the new directories for emoncms to write feeds, in the terminal shell CAREFULLY type the following
cd \var\lib
mkdir phpfiwa
mkdir phpfina
mkdir phptimeseries
chmod 777 phpfiwa
chmod 777 phpfina
chmod 777 phptimeseries - Check the feed directories are present and correct by typing
ls –l
In the list returned you should see each of the new feed directories as below:
drwxrwxrwx 2 root root 4096 Mar4 10:15 phpfina
drwxrwxrwx 2 root root 4096 Mar 4 10:15 phpfiwa
drwxrwxrwx 2 root root 4096 Mar 4 10:15 phptimeseries - Quit the terminal session (close PuTTY window or type exit)
At this point, you can add your Write API to the local EmonHub config editor and save. The inputs will then appear in the DSM emoncms webserver and you can create Feeds as normal.
As I said above, this setup worked for me although I have only gone as far as basic feed creation and display on the DSM hosted server so other issues with DSM may arise down the line. I hope this will help others get up and running but, obviously, anyone following the above must do so at their own risk.
Cheers
Andy
Re: Set up of emoncms on Synology DSM
hi Andys
Good job.
I'm also quite a while to get this up and running.
I have a problem with the dashboards.
I get the following message;
Warning: is_dir(): open_basedir restriction in effect. File(Modules/AppConfig_model.php/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/Readme.md/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/app.js/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/app_controller.php/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/app_menu.php/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/app_schema.php/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/client.php/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/image.png/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/roundedrect.js/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/style.css/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22 Warning: is_dir(): open_basedir restriction in effect. File(Modules/vis.helper.js/widget) is not within the allowed path(s): (/etc.defaults:/etc:/usr/syno/synoman:/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfina:/var/services/web/emoncms/Modules) in /volume1/web/emoncms/Modules/dashboard/Views/loadwidgets.php on line 22
Do you have any idea?
Ferry
Re: Set up of emoncms on Synology DSM
Hi Ferry,
Not played with the modules as yet as it took long enough just to get the logging going and there are issues with the hardware I need to sort. Modules are job for the near future. It looks like an issue with the open_basedir path, so I guess some research will need doing on what this actually does and then working out what is going wrong. I'll post again if I find anything more. Have you tried adding /volume1/web/emoncms to the open_basedir?
Andy