New development: update emonCMS, modules and themes from UI

Hi, I am working in a project where the main emonCMS user has no access to the server command line. Therefore every time I change something we need to ask the system administrator to login and manually pull everything.

To make life easier I have added an update functionality to emonCMS. You can find it in this fork: https://github.com/carboncoop/emoncms/tree/updates

I know there is already an update functionality for emonPi, this one is specific for emonCMS as a whole, or themes/ modules installed by the user.

Below you can see the readme

Update module

The aim of the module is to provide a user interface for administrators to update emonCMS, modules and themes.

Only items installed with git can be updated.

Notes:

  • If emonCMS’ default settings file has been modified, a message is shown to the user asking to do the update manually and copy over the settings
  • If the shema file of a module has changed, a message is shown to the user to remind that database update is required
  • emonCMS will check if there are updates available everytime a page is loaded and show a message if there are updates available. The user only needs to close the message once per session
  • It’s very likely that the user will have permissions problems when updating an item. When installing via git on the command line the user is probably different than the one used by Apache. In this case a message is shown to the user with instructions about how to change the owner of the files. Typical fix would be to run in the command line sudo chown -R www-data:www-data your_emonCMS_path. This assumes you apache user is www-data

This is a great feature IMHO, I hope it will be included into master emoncms !
Did you think of creating a Pull Request on emoncms ?

Thanks dtony :slight_smile:

Yes, I have thought about the pull request but I wanted to wait for somebody else to try it and be sure that it is working as expected and not buggy. Once we know it doesn’t break I’ll do the pull request.

Have you tried it?

Cheers

I have been thinking more on this and before requesting the pull I think the permissions issue I say in the notes should be sorted.

What I have done in my installation: I originally changed the user and group to www-data but that was super annoying as I couldn’t install anything from the command line or change any file. So I had to change the owner again to myself and leave the group as www-data, then I made every file writable for the group. This way the Updates module (which runs as www-data) can modify the files. But I don’t like the idea of making everything writable for the group. Also the idea of the module is to make life easier and by this I mean to avoid asking the user to go to the command line and fiddle with users and permissions.

One solution I am thinking is to add an “Install” functionality. Once a module has been installed through the user interface, the files owner will be www-data and there will not be the need of changing owner or permissions. Only problem with this is that we will only be able to update modules and themes that have been installed via the user interface, while it will not be possible to update the emonCMS core files (including its module and basic theme)

Agree, this would be a really nice addition to Emoncms. Especially if Modules could be installed and individually updated through the user interface. It would be really great if Emoncms would notify the user when an update was available. A further extension of this would be to give the user a choice of branch e.g. Either ‘stable’ or ‘master’.

2 Likes

@cagabi - I have been working on some related stuff, rather than over-whelm your thread with my idea’s, I have started another thread and would be interested in any comments you might have,

1 Like

It would be a start to have a list of current modules in the Guide rather than rooting through pages of old GitHub repos trying to find the right module :frowning:

1 Like

Thanks pb66 for the call :slight_smile: Having a look now

1 Like

It would be a start to have a list of current modules in the Guide

That would be very good to make it possible find modules. A starting point could be pasting the github url

1 Like