Need help with PHP Server Monitor packaging
Hi there! I've been using PHP Server Monitor for years to check my (customers) sites for uptime, valid SSL certificates and the likes. The reason why I haven't packaged this for Cloudron was because of the missing LDAP support which was requested and in the works for quite a few years now. But this got resolved now and it would be good to go when merged to master, so I gave it another shot, here's what I got so far:
In theory everything works: You can build and install it, visit the site, create an admin user. Then I ran into two issues:
- I can't set the SMTP password through start.sh because it's encrypted in the db. I already got a hint on how it might work and it does encrypt something, but not the whole thing and I don't know how to fix it. So if you want to use it at the moment, you have to manually insert the correct password in the adminpanel
- The LDAP fields only show up in the database after activating it in the Config/Authentication tab, so when you want to use LDAP for your users, you can activate it and restart the server, then the information gets written into the db automatically. I've opened another ticket to ask for an unattended installation procedure or some other way to automatically activate it, but no dice so far, but maybe some of you have an idea how to get around that.
After that extra step with restarting after enabling authentication (and setting the mail password automatically afterwards) it's good to go. You have a nice uptime monitor with a lot of settings and options (like check if a string exists, if not --> mark site as down and send email - using that for WordPress sites that have other issues).
If anyone has an idea how to fix the password issue (I just lack the experience for that), would be much appreciated.
Oh yes, at the moment it uses the regular scheduler-addon which does 15 minute intervals, we could easily change this to a manual crontab which then checks whatever interval you like, this was just the easier approach to get it going.
@msbt For the SMTP password issue, a trick we use is to encrypt it using a simple PHP script. For example, see https://git.cloudron.io/cloudron/osticket-app/-/blob/master/encrypt.php , https://git.cloudron.io/cloudron/snipeit-app/-/blob/master/CloudronLdap.php#L51 and https://git.cloudron.io/cloudron/limesurvey-app/-/blob/master/EncryptCommand.php . This script will of course depend on how the app encrypts.
As for LDAP, maybe we can start out with not having LDAP and then we can add it in the next release (when upstream merges it).
@girish yea I've tried with https://git.cloudron.io/msbt/phpservermonitor-app/-/blob/master/start.sh#L26 from the github recommendation, but that comes out a few characters short
@msbt I guess we should put this app in App Requests? I can't seem to find it
Hah yea, I wasn't sure where to create that topic - totally your call. I'm a big fan and other people might like it as well.
Edit: Also wondered why it wasn't there, maybe it's not that popular.