DocCyblade / tkl-odoo

Turnkey Linux - Odoo v8 (Published v14.2)
https://www.turnkeylinux.org/odoo
GNU General Public License v3.0
21 stars 24 forks source link

First boot Odoo Auto Server Tune #63

Closed DocCyblade closed 8 years ago

DocCyblade commented 8 years ago

No I am not talking music! See https://github.com/DocCyblade/tkl-odoo/issues/58#issuecomment-148980308 Jeremy makes a good suggestion on I am already working on. I want to know everyones thoughts should we proceed with out this feature or would this be worth the effort (few days maybe) to write and test.

  1. If a pre-seed file is detected read it
  2. If no pre-seed will detect hardware (CPU, Memory) and compute values
  3. Present these values to the user during first boot to first login
  4. Allow user to accept changes or keep in threaded mode (workers=0)
  5. If user allows changes, asked for email address to send more information about the changes with links Wiki documents etc..

I know I can do 1-4 easy, the email thing I would need to learn how they are doing that.

So thoughts? Is this worth pending Odoo release for? (I think it would be) not sure about the email part, I think that could wait till next release.

l-arnold commented 8 years ago

the AutoTune should likely have a few settings:

1: Firstboot 2: Second and Beyond (if Memory or Processors Changed) 3: If the Manager wants to accept the changes.

Perhaps the Matrix itself could be updated by the manager. It seems there could be other things that come into play. For instance, the "JobRunner" system for the Connector Modules need similar Tweaks. though I don't know if they need more or less ram for their purposes.. I know that sometimes up to "workers = 10" may be specified.

Also, it would seem likely that the number of concurrent Users and Web Browsers may effect some of this.

There is a Testing Protocol over in the Connector World that pretty much every commit is supposed to be run through. Not remembering its name just now (seems there was another name than what is referenced here below as "the tests")

http://odoo-magento-connector.com/project/contribute.html https://github.com/guewen/odoo-connector-magento-buildout

DocCyblade commented 8 years ago

This would be just a one time setup for now. As with any system when things change config files would need to be updated. I am more focused on first boot. However the script I would call could be re-called even after the first boot so it would be able to be used later as well

Like all things these are guide lines that can and should be updated from time to time when new info emerges. This is not a magic script that set what it should be it makes a best guess and allows the end user to choose to set it or not to

l-arnold commented 8 years ago

Understood.

Going to the "TKL HUB" I think it is conceivable that a "base install" can be run on a "Micro" setting (2 cents an hr). Gives .617 gb RAM and (variable ecu, ie 1 or less). Seems conceivable that it could run especially if workers were set to 0.

(UPDATE) That Said, we should test if it Prints an ORDER at that Level othewise would be good to not let people try that Level for the ODOO AP

ACTUALLY JUST did test it and It did Print based on the tests w/ 512mb ram 1 cpu and workers= 0

DocCyblade commented 8 years ago

@l-arnold so should we add this basic functionality or wait for the next version

l-arnold commented 8 years ago

I say wait if RC1 is acceptable now. I feel it should be. Easy enough to change.

Perhaps we could simply have a alt openerp-server.conf file for workers =2 .

Thoughts?

Thanks. Landis

DocCyblade commented 8 years ago

Even if we have an alternative config file you still hav to update the init script. You might as well edit the config file yourself. I included lots of documentation inside the file any way.

I kind of like the idea but it would take time to implement a day or so. I could be swayed in either direction. I'll wait to see if @JedMeister has to say

l-arnold commented 8 years ago

I agree. Easy enough to edit the Config File!

It seems a lot of work to build another init script right now. No other TKL App has this capability and it is pretty painless to edit the config file.

DocCyblade commented 8 years ago

I still think having it auto config during firstboot would be benefit the novice users, and would not be too much hassle to write as much of the code already has been write. In the form of templates.

JedMeister commented 8 years ago

It would be pretty sweet to have but IMO is more of a cool/nice feature rather than a "have to have". So I'll pass it back to you Ken! :stuck_out_tongue_closed_eyes:

Keep in mind though that if you make it interactive; headless deployments (e.g. launched from the Hub) it will need to run non-interactively (i.e. it will need a "DEFAULT"). So I would amend your points to look something like this:

  1. If a pre-seed file is detected read it
  2. If no pre-seed; will detect hardware (CPU, Memory) and compute values - these values then become the "DEFAULT"
  3. If running headlessly accept "DEFAULT" (and email root@localhost); otherwise interactively ask user to <accept>|<adjust>|<skip> (or similar wording) during first boot.
  4. (If running interactively) <adjust> allows user to manually configure worker & soft & hard mem_limit settings; <skip> will keep Odoo in threaded mode (workers=0)
  5. (If running interactively) If user allows changes, ask for email address to send more information about the changes with links Wiki documents etc..
DocCyblade commented 8 years ago

Let discuss this more, I agree it's a "cool" feature. Let put this one up to the next release

l-arnold commented 8 years ago

This is a good idea. Do note that the openerp-server.conf file has both workers = 2 and workers = 0 in it still (seems to be taking the 0).

I would love a "Webmin" controller for this. I think it would tie it together well. ConfConsole also wouild work however and would integrate with firstboot inithooks better.

DocCyblade commented 8 years ago

This is a good idea. Do note that the openerp-server.conf file has both workers = 2 and workers = 0 in it

still (seems to be taking the 0). This was fixed, the v14-READY tag and current master/dev should be fixed (on forked copy of the rep)

I would love a "Webmin" controller for this.

I have not looked at creation of a webmin-addon. Would be neat to see how we can make a plug in for it. I would not think it would be very hard to create on that just updates a pre-defined config file. I'll put that on the todo list to look into how hard it would be to do. (something else to learn fun!)

ConfConsole also wouild work however and would integrate with first boot inithooks better.

This would neat to do. I want to learn python, as that is what confconsol is written in source code here Not sure of there is a way to "extent" this so that modules could be added. The easy thing to do would be create a bash script with some menu helpers that are out there. The nice menus during first boot is python scripts.

JedMeister commented 8 years ago

FWIW Webmin is written in Perl. I have no experience with it (i.e. none at all; never even tried it) but my cursory opinion is that it is hard to read and something of an arcane language... :frowning:

Python on the other hand is much better; although I don't know a lot about that either...

Stefan (@OnGle) has had a stab at extending confconsole and has a (private) prototype. Unfortunately though confconsole is one of those programs that was built for a specific purpose a long time ago and has had bits bolted on as time has gone by. Currently there is no easy way to add functionality.

I would really like to get Stefan (or someone who knows Python) to rewrite confconsole so you could drop files into a directory hierarchy and confconsole would automagically pick them up (somewhat like inithooks does now). Or even if a simple config file (possibly in json?) had an entry added? But Alon is not so keen so I'll need to get him onside first! :smile:

DocCyblade commented 8 years ago

Now I am talking out of my head so to speak as I don't know Python, however I think it could be refactored either to just add an option to the existing list that calls a new extension that can be extended in some way. Or total rewrite the core and make it all modular and refactor the current options and make then modules. First would be the easiest as you would just need to hook into the menu and then some how read the added modules and show them.

I really need to learn Python

JedMeister commented 8 years ago

I think it could be refactored either to just add an option to the existing list that calls a new extension that can be extended in some way.

Yeah that's sort of what Stefan has already done...

Or total rewrite the core and make it all modular and refactor the current options and make then modules.

Ideally this is what I'd like to see done.

First would be the easiest as you would just need to hook into the menu and then some how read the added modules and show them.

Regardless we still need to convince Alon...! :smile:

OnGle commented 8 years ago

Ohk so this is how confconsole works to my understanding. We have our main class that holds most of the program, it has a mainloop which calls functions of the current instance and is returned the name of another function which it promptly calls. Each function could be a menu or a message or whatever you want but they're each stage. The important parts being that confconsole only check's it's own instance for functions meaning that there really isn't any "list" of pages to add to (I guess you could override "getattr" to catch invalid function names and direct them to some dynamically imported list of modules but that's just asking for bugs). As nice as it would be to change what's already there to be more modular without changing the whole program structure, it tends to descends into hacky spaghetti code. Although I'm not closed to the idea that there's an easy way I just haven't thought of. I personally believe waiting for a rewrite would be the best course of action.

DocCyblade commented 8 years ago

@OnGle thanks for info.

So we know of any thing that outside that hooks into conf console? I ask cause what if we fork it and re-wrote it good enough that Alon would approve? I started learning Python last night seems like a straight forward language

JedMeister commented 8 years ago

I don't know for a fact but I imagine that Alon would be cool with a confconsole v2 (although actually it's currently only up to v0.9.4).

AFAIK it's a self contained package. So as long as it continues to do what it does then I don't see an issue. I'll discuss with Alon.

OnGle commented 8 years ago

I'd definitely be interested in being part of this if/when it happens.

l-arnold commented 8 years ago

Test and suggestion meister here. And have updates apply after i.p. address is setup. For years I did'nt have dhcp in my static network space so voukd never update around first boot.

Could have update and everything else in FBoot be console scripts avail. And lovely to build a CSR there and nearly set up full SSL. (a few caveats there for sure)

JedMeister commented 8 years ago

Test and suggestion meister here.

Hehe! :smile: :+1:

FWIW I have previously discussed tweaking/extending inithooks to add additional tweaks and he's not very keen on that. He is in theory ok with extending conconsole but doesn't want me to spend time on it (which is fair enough IMO as I have TONS of other stuff to do!).

Because of when confconsole runs (i.e. straight after inithooks) adding additional options into confconsole would appear to be part of the same package (from a user perspective). So a possible workflow could be something like this:

l-arnold commented 8 years ago

Conf Console is fine though I think a more live environment like wbmin could be better. Ie for SSL you needbto copy paste certs and put them into folder etc.

Apache is great with webmin. Command (something),works well as does text editor

DocCyblade commented 8 years ago

I see this is a just Python script but packaged as a Debian package. (Seeing all the extra files) I need to read up on that anyway.

I too want in on the action, however I need to learn Python first. I am done with the first chapter of a book I am reading on the subject.

@OnGle you should take the lead since you know more Python than I do and you already took a stab at it I am told :-)

OnGle commented 8 years ago

Sounds like a plan, wish I'd seen this yesterday, would of had an extra free day on it, should always check githum everyday. Eitherway I'll have a bit of a hack around with it. I have a feeling that a minimum product could be produced by hacking at the TurnkeyConsole.loop function, although I've never built any form of module/plugin system so that'll be interesting.

DocCyblade commented 8 years ago

Want to fork it and I'll work off your copy?

On startup I guess we would check a config file or scan a directory. We need to agree on some type modularized way. Maybe look how Odoo does modules and add ons

OnGle commented 8 years ago

Sounds good, I've got a fork but I'll be working off the branch "module-system", (advanced-menu-update is the dig at it I had Jed was talking about).

I had an idea that perhaps we could have a hook.py which is run by confconsole.py but is interfaced by each "module" which converts the function to a class function and adds it to TurnkeyConsole class before it's first initialized (this would solve issues such as when the module needs to access properties of the TurnkeyConsole instance). Although monkey patching's a dangerous road to walk down.

Another possible approach would be to have TurnkeyConsole have a static list which held the function names and it simply iterates over each "module", import and add each module's function (or functions, depending on how this discovery would be done) to the list. This would be possible at any point in the programs execution although it'd work much better before initialization of TurnkeyConsole.

Also should this conversation still be held here? I'm pretty amateur when it comes to github :p

OnGle commented 8 years ago

Also as far as when the module needs to access TurnkeyConsole's attributes they could simply get passed the instance I guess so it's not even that big of a deal.

DocCyblade commented 8 years ago

I'll take a look tonight. Should we move this discussion to your branch? Maybe make a WIP issue to dialogue in?

OnGle commented 8 years ago

I've got all day to play around with it and I'm interested so I might start getting a bit of a game plan.

On the tracker?

DocCyblade commented 8 years ago

Yeah on your fork

DocCyblade commented 8 years ago

Just tag me in an issue on your fork and we can discuss

OnGle commented 8 years ago

Done, cheers for baring with me :)

DocCyblade commented 8 years ago

Closing this issue for now. Neat idea but don't think we could really set this automatically. I think this could be fixed with good clear documentation.