Koozali.org formerly Contribs.org

Mojolicious

Offline janet

  • ****
  • 4,810
Re: Mojolicious
« Reply #15 on: June 18, 2019, 02:35:53 AM »
brianr

I have vague recollections of a similar ssue in the past that had something to do with multiple instances running, was it httpd-admin ?
Have a look with
htop
or
ps -aux

Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline brianr

  • *
  • 907
Re: Mojolicious
« Reply #16 on: June 18, 2019, 10:16:54 AM »
brianr

I have vague recollections of a similar ssue in the past that had something to do with multiple instances running, was it httpd-admin ?
Have a look with
htop
or
ps -aux

Still happening, tried reboot. Looked at ps -aux and can only see one runsrv httpd-admin.  Nothing in the logs.  However it also won't allow me to login using the "old" server manager, except as above using the text version from the config screens.

However I also remember some sort of problem involving cookies, so I fired up Chrome instead of Firefox and I can now get in.

Brian j Read
(retired, for a second time, still got 3 installations though)
.........

Offline ReetP

  • *
  • 2,559
Re: Mojolicious
« Reply #17 on: June 18, 2019, 10:56:01 AM »
I have reproduced the current manager behavior using a classic mojolicious application structure (without updates [actions] for now). A structure that must be enriched and improved, of course.

Ok, for those playing please note there is a MASSIVE difference between what I did and the work here.

My approach was to use Mojo as a simple templating system. A passive, drop in replacement for Formmagick.

Mabs approach is completely the reverse.

He is using Mojo as an entire application. It effectively runs as a stand alone server. That may well be where you are struggling with testing.

Personally I do not believe this is a good approach.

It is complex.
No one else round here currently has the skills to work on it.
It means the entire server-manager needs rebuilding including, every single contrib
It is another 'application' to maintain

The approach I took was different.

It was effectively JUST a drop in replacement for Formmagick. Yes, it does need work on some backend code, but even an idiot like me is capable of doing lot of it.

It has the benefit that when the backend code is tidied (removing Formmagick code from the perl files in /usr/share/perl5/vendor_perl and moving it to /etc/e-smith/web) you could use something else as your templating system.

Now, I fully admit I am not really a great judge of this due to my poor coding skills, and I had been asking if my approach was wrong, but no one ever replied.

I have written to mab to try and explain this in more depth but realised it might be worth pointing out the difference in approaches and where you may be struggling (another reason I stuck with simple templates rather than an 'application' - less to break)

Also, the approach is substantially different enough it should have a completely different rpm as there may be conflicts with my original code/rpms
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline brianr

  • *
  • 907
Re: Mojolicious
« Reply #18 on: June 18, 2019, 12:01:16 PM »
Ok ,so I spent about an hour on this and can see how the system hangs together, something I never really managed with the current formagick system.

My personal preference would be something NOT based on perl (ducks behind parapet), but I can see that makes no sense in the context of all the other code in smeserver which IS based on perl and could/should not be replaced on the if not broken don't fix it principle.

I think the general feeling is that the smeserver based on formmagick IS broken and needs a replacemenmt.

I suspect that whatever system we adopt to replace the current one will require some investment in learning and then some grunt work translating the current panels to the next format.

If you look at

etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/templates/starterwebsite.html.ep

And compare it with

/etc/e-smith/web/functions/starterwebsite

You might be able to see that the structure is similar although the syntax is quite different.

My own opinion....YMMV

Brian j Read
(retired, for a second time, still got 3 installations though)
.........

Offline ReetP

  • *
  • 2,559
Re: Mojolicious
« Reply #19 on: June 18, 2019, 01:40:16 PM »
Ok ,so I spent about an hour on this and can see how the system hangs together, something I never really managed with the current formagick system.

Yes, I understand the fundamentals of mabs code. I'll cover the 'but' in a bit.

It isn't difficult to understand fundamentally how serevr-manager currently works. If I can work it out, anyone can!! It was just never worth investing any further time in it.

Before bandying about what may or may not be a great idea, you really need to get your head round how it DOES work now in the first place.

You can go on your server and look at this easily.

In a perfect world you just have a set of Formmagick template files in:
/etc/e-smith/web/functions

They use functions that are in the files in:
/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel

If you have the wbl package it is a simple and very neat way of demonstrating this.

The file web/function/wbl is a formmagick template that calls some routines in FormMagick/Panel/wbl.pm

So in an ideal you could just rip out the FM template, add a new form of template system and call the original routines. Simples.

However, the issue is that some developers decided to use FM formatting in the pm files, which makes removing FM as a whole more bothersome, but not impossible. Even I can do some of it. It is just some time.

The old adage of separating form from content. The perl routines stay in the pm files, and templating code goes in 'function' files.

Quote
I think the general feeling is that the smeserver based on formmagick IS broken and needs a replacement.

No, it isn't that it is broken. It is because FormMagick is way old, unsupported, and not easy to learn and use. It therefore needs replacing.

Quote
My personal preference would be something NOT based on perl (ducks behind parapet), but I can see that makes no sense in the context of all the other code in smeserver which IS based on perl and could/should not be replaced on the if not broken don't fix it principle.

I am nor a perl evangelist - I can barely code quite frankly. But it is actually pointless because the whole backend relies on Perl. You would have to rip out the entire SME templating system (which is what it is after all) and rebuild it from the ground up.

HOWEVER, if you read what I have previously said, if we were really smart, I believe we can create new templates (just using Mojolicious as a templating system) which can output code as html, OR as JSON.

And if you can do that, you have the basics of an API, which can then be queried by whatever language you like. And you don't need to know anything about the perl behind it

Think:

server panel <- html -> mojo template <-> perl routine

PHP/python <- API/JSON -> mojo template <-> perl routine

The difference is in the query type.

if (type=html){
sub get_somedata()
output_somehtml
}

if (type=json){
sub (get_somedata($query)
output_somejson
}

/server-manager/wbl?type=json&query=get_dnsblist

Get the idea?

Quote
I suspect that whatever system we adopt to replace the current one will require some investment in learning and then some grunt work translating the current panels to the next format.

Yup - there will be an investment of time and effort somewhere.

The method I have suggested, assuming it is correct, will probably be easier and quicker. Especially if someone knowledgeable gave me a hand. So far I had zero assistance beyond answers to a couple of technical questions, despite requests for people to test and help.

Quote
If you look at
etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/templates/starterwebsite.html.ep

And compare it with
/etc/e-smith/web/functions/starterwebsite

You might be able to see that the structure is similar although the syntax is quite different.

Well, yes and no.

If you looked at my original templates, you would be able to see exactly the same thing.

But I DIDN'T need an entire new running application to do it. And it is simple enough that *I* can do it.

The system that mab has proposed is clever, but much more complicated. It is effectively a complete application, not just some templating. And possibly overkill. I won't be able to write anything for it as it is way over my head and the point was to try and lower the bar to entry, not raise it.

You have to consider who is going to maintain it, whose is going to convert existing contribs, and who is going to be able to write new ones?

We are not swimming in developers here.........

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline TerryF

  • grumpy old man
  • *
  • 1,190
Re: Mojolicious
« Reply #20 on: June 19, 2019, 12:46:50 AM »
Over my head on many levels, but do subscribe whenever possible to the KISS principle :-)
--
qui scribit bis legit

Re: Mojolicious
« Reply #21 on: June 19, 2019, 08:58:10 AM »
First of all, the proposal I am putting forward is just one element that I bring to the table.
I don’t have any a-priori I just want things to move for SME.

It is far from being achieved, and I have deliberately limited it, for the sake of time, to a sufficiently meaningful set.
Added to that I’m not a Perl developer...

It is not based on server mode and is not the most common solution among existing applications. Besides, the problem of performance could be posed. But one can assume that the number of admin per server is never very high.

In short Perl or not? Mojolicious as solution? For what part?

And if the most reasonable way (playable!) given the means was the cohabitation of FormMagick and Mojolicious for existing modules, a progressive conversion and a new form for the new modules and an immediate contribution of an API (which I don’t fully understand for the moment).

Anyway, this transition to Mojolicious would obviously require time and efforts, probably more in tests and debugging than in transcription.

I have written to mab to try and explain this in more depth .

i have not received it yet !?

You have to consider who is going to maintain it, whose is going to convert existing contribs, and who is going to be able to write new ones?

this is the whole future of SME.... Who maintains the existing one? Maintain this or that....

Ps: Sorry if my ideas are not always well expressed. Dual translation is a difficult task and can lead to misunderstandings which are obviously incidental.

Offline TerryF

  • grumpy old man
  • *
  • 1,190
Re: Mojolicious
« Reply #22 on: June 19, 2019, 09:18:09 AM »
Mate you are to be applauded, you are one of the very few who has jumped in .. JPP is also more than well worth a chat. Just now he is maxed out so may have to wait a short time..

Either way please stay with it, look at what John has been up to, we need the help.
--
qui scribit bis legit

Offline ReetP

  • *
  • 2,559
Re: Mojolicious
« Reply #23 on: June 20, 2019, 02:29:11 PM »
i have not received it yet !?

Sent to mab974 at your gmail address. I think there may be more than one.

Check your Junk?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Re: Mojolicious
« Reply #24 on: June 21, 2019, 06:57:44 AM »
Sent to mab974 at your gmail address. I think there may be more than one.

Check your Junk?

yes, all your mails in spam actually. "Rocket" looks a bit aggressive  :smile:

thanks

Offline ReetP

  • *
  • 2,559
Re: Mojolicious
« Reply #25 on: June 21, 2019, 11:20:38 AM »
yes, all your mails in spam actually. "Rocket" looks a bit aggressive  :smile:

Rocket is great !!!!

We don't bite..... ;-)

A good place to practice your English, and Jean Philippe is French.....

Anyone who wants an account to come and chat is welcome. Just ask me.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline TerryF

  • grumpy old man
  • *
  • 1,190
Re: Mojolicious
« Reply #26 on: June 21, 2019, 01:18:03 PM »
Its safe mab :-) just us old farts
--
qui scribit bis legit

Offline ReetP

  • *
  • 2,559
Re: Mojolicious
« Reply #27 on: June 21, 2019, 03:18:50 PM »
Its safe mab :-) just us old farts

:rofl:
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Re: Mojolicious
« Reply #28 on: June 24, 2019, 07:46:30 PM »
Hi,

In fact, there is not a lot of differences between the two approaches. The use of Mojolicious is the same, the difference is the scope.

The use:
Routes, Templates, Controllers (or not) and existing routines ( +/- adapted).

The "complete" structure is just a "familiar" way to store the different files cleanly : lib (Controllers), conf, public, templates and so on... Particularly when the modules number is growing.

I’m not sure we can avoid "Controllers" at least to separate modules and main program.
Other things have to be adapted to SME : conf, log, ...

The scope:
Maybe I was wrong about the scope of the project. I was convinced of a new version of server-manager and the progressive replacement of FormMagick.

Perhaps I am too optimistic and the ambitions should be lowered. But I think we need to aim for the SME9 EOL (11/2020) and give us an interesting target. It’s doable.



Offline TerryF

  • grumpy old man
  • *
  • 1,190
Re: Mojolicious
« Reply #29 on: June 24, 2019, 09:26:55 PM »
As they said in the movie, "build it and they will come", with you in it to the hilt, anything I can do just a shout away..
--
qui scribit bis legit