Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default server template should have it's own file #900

Open
shoulders opened this issue Sep 17, 2024 · 10 comments
Open

default server template should have it's own file #900

shoulders opened this issue Sep 17, 2024 · 10 comments

Comments

@shoulders
Copy link

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.4
Usermin version 2.102
Virtualmin version 7.20.2
Theme version 21.20.7
Apache version 2.4.52
Package updates 68 package updates are available

The issue

the defaut settings server templste does not have it's own file. From what I can see all of these settings are stored in the follwing file along with other virtualmin configurations

/etc/webmin/virtual-server/config

Proposed solution

create a default settings server template file here

/etc/webmin/virtual-server/templates/<template_id>

  • In this folder there is a file called 0 which has nothing in it.
  • Settings For Sub-Servers has the number 1

So logically you could use this for the default settings template

/etc/webmin/virtual-server/templates/0

@jcameron
Copy link
Collaborator

I 100% totally agree with you on this! But also, given the way templates have been developed over time, it's near impossible to transition to putting the default template into it's own file ... so we'll just have to stick with the current behavior.

@shoulders
Copy link
Author

shoulders commented Sep 18, 2024

I think this should be put on the list as it is a limiting factor, maybe move settings over time into a standalone template. Obviously I don't mean drop all the work you are doing now just to do this. 😄 - The template feature of Virtualmin is the flagship feature 🚢

Work around (a brief suggestion)

  • To start with you could physically separate all of the template settings in their own file (as proposed above), keep the virtualmin config settings in their own file, but when the config settings are called you could add an extra routine to merge the 2 files before they are returned back to virtualmin (i.e. array_merge() ) which will keep compatibility.
  • Over time, change where the settings are called from until they are both completely separate.
  • At some point the account plans will also need re-visiting so they all working like Administrator's webmin modules but just not in the server templates.

NB: Server templates can inherit from the default settings, maybe you can use this mechanism to break out the default server template settings from the virtualmin config file.

@iliajie
Copy link
Collaborator

iliajie commented Sep 18, 2024

I think this should be put on the list as it is a limiting factor,

What kind of limitation are you referring to?

To start with you could physically separate all of the template settings in their own file (as proposed above), keep the virtualmin config settings in their own file, but when the config settings are called you could add an extra routine to merge the 2 files before they are returned back to virtualmin (i.e. array_merge() ) which will keep compatibility.

I think, the effort isn't worth it, because the amount of work and potential bugs that could arise from this kind of rework outweigh aethereal benefits! We have many more practical tasks that are more important to focus on.

@shoulders
Copy link
Author

What kind of limitation are you referring to?

  • I cannot just copy the default template settings from one virtualmin server to another
  • cannot use custom scripts to alter the default settings (i appreciate this is a niche and probably not recommended, but it was just something that popped in my head for an example.)
  • It is not logical to mix these settings so makes it harder to develop Virtualmin.
  • I assume this is one of the reasons you cannot have multi-level inheritance.

We have many more practical tasks that are more important to focus on.

  • This is true, but in the future this might become an issue and should warrant consideration at that point in time. i.e. a blueskies sort of thing.

@jcameron
Copy link
Collaborator

You can use the virtualmin backup/restore function to copy templates to other systems though - I'd strongly recommend this over just copying files, as it protects you from changes to our internal implementation.

@iliajie
Copy link
Collaborator

iliajie commented Sep 19, 2024

  • I cannot just copy the default template settings from one virtualmin server to another

You could just copy the Virtualmin config from the /etc/webmin/virtual-server directory. This is how the default template is built.

cannot use custom scripts to alter the default settings (i appreciate this is a niche and probably not recommended, but it was just something that popped in my head for an example.)

You can do this by changing the Virtualmin config file directly, or better yet, by using the webmin set-config command.

It is not logical to mix these settings so makes it harder to develop Virtualmin.

Well, yeah, we agree on that.

I assume this is one of the reasons you cannot have multi-level inheritance.

What's that?

@shoulders
Copy link
Author

I assume this is one of the reasons you cannot have multi-level inheritance.

Currently you can:

  • use the default settings server template
  • use a sub-server template and inherit specified settings from the default template
  • make your own server template and inherit specified settings from the default template

You cannot:

  • make a template which inherits from custom template which in turn inherits from the default settings template, and so on.

@iliajie
Copy link
Collaborator

iliajie commented Sep 19, 2024

I believe the complexity would be the key obstacle for implementing such a change...

@shoulders
Copy link
Author

shoulders commented Sep 19, 2024

I don't know Perl so I will take your word on the complexity.

I would just say that the inheritance model (single level) is already there, and in my mind I would just use array_merge() hence the separate files idea. This method would allow for multi level inheritance and it would be easy to add immutable values if required.

@jcameron
Copy link
Collaborator

Multi-level inheritance is something we could potentially implement regardless of how templates are stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants