Custom configurations are difficult to maintain

interfasys

Verified User
Joined
Oct 31, 2003
Messages
1,821
Location
Switzerland
Here is a pretty common scenario when using CB
  1. Configure PHP using CB's default templates
  2. Decide that some of the generated files don't look quite right
  3. Copy a few templates to the custom folder
  4. Modify the custom template
  5. Generate configs again

The problem
CB doesn't only use templates as is or doesn't only replace some of the templates' content before putting config files in place, it also generates partial or full config files, but only does so if we're not using custom configs.

Let's say I have httpd-aliases.conf in my custom folder and I've decided to let CB generate aliases for me by making changes in options.conf.

After rebuilding the configs, I'll see no change, because CB detected a file with the same name in the custom folder and simply copied it over.
Code:
	if [ -e ${WORKDIR}/custom/ap2/conf/extra/httpd-alias.conf ]; then
		cp -pf ${WORKDIR}/custom/ap2/conf/extra/httpd-alias.conf /etc/httpd/conf/extra/httpd-alias.conf
	else
That means that as CB evolves, we don't get the changes or fixes and we have no easy way of knowing how CB is now generating some of the configs.

I understand that merging changes can break havoc, but maybe more templates could be used and content replaced with regexp?
Or maybe CB could generate the files it wants to using a different file extension?
That way we would have httpd-aliases.conf.cb in the same folder and could quickly check for modifications by comparing it with our file.

What other strategy would work?
 
Hmm.. The httpd-aliases.conf is a special file in that it's very dynamic.
It's appearance can change drastically depending on the options.conf settings.

What customizations are you trying to add?
If they're extra aliases or other paths, might be easier to create a list file, like:
Code:
squirrelmail=/var/www/html/squirrelmail
phpmyadmin=/var/www/html/phpmyadmin
phpMyAdmin=/var/www/html/phpmyadmin
roundcube=/var/www/html/roundcube
so you can make changes to it...

Of course, it gets a bit more complicated if one shuts off those items in the options.conf.

In any case, if we can sort out what you're trying to accomplish, we can work from there.

John
 
Hmm.. The httpd-aliases.conf is a special file in that it's very dynamic.
It's appearance can change drastically depending on the options.conf settings.
I haven't checked the whole build file for "cp" occurences, but it's not just that file, since per example webapps copy config files found in the custom folders without merging anything. So any improvements you introduce will not find their way into current installations unless documented somewhere.

Maybe each template and internal routine which injects data could have a revision number and CB could issue a warning if it finds a difference between the number found in the custom template and the most current one?

What customizations are you trying to add?
If they're extra aliases or other paths, might be easier to create a list file, like:
Code:
squirrelmail=/var/www/html/squirrelmail
phpmyadmin=/var/www/html/phpmyadmin
phpMyAdmin=/var/www/html/phpmyadmin
roundcube=/var/www/html/roundcube
so you can make changes to it...
I like the idea of having a list, because people needing a different set of aliases are currently forced to use a custom template, which never gets updated, even if changing PHP method, if I'm not mistaken.
With the list you'll generate aliases based on the PHP method used and we could easily fix the script to make it work with PHP-FPM per example and would notice changes in the code, when you introduce them.
That would be great if you can use lists or JSON every time you need to need to inject data into templates.
 
The template versioning would be handy, a possible future addtion.For now, I've added the list for CustomBuild 2.0.To use it, create this file:
Code:
/usr/local/directadmin/custombuild/custom/webapps.list
The list will contain the addtional webapps you need to add.DA will not use this list for internal aliases already present... so the above example containing squirelmail, etc.. would not be valid, else you'll end up with duplicates.The yes/no switches in the options.conf would control those items.For custom entries, you'd use a sample file that contains something like this:
Code:
customname=custompath
which will be added to the httpd-alias.conf *in addition to* the entries that area already there.This would point 1.2.3.4/customname to the DocumentRoot /var/www/html/custompath.If this method is too confusing, or doesn't offer enough control, we could alternatively change it to have the internal list dynamically added to a config/webapps.list for each rewrite.If a custom version is desired, then use the custom/webapps.list is used.Then the list controls all aliases, allowing for the removal of some built-in aliases (like squirrelmail), while still having CB manage the data in /var/www/html/*.Right now, the feature only allow adding custom aliases to the list (changing it isn't too hard, just need to know what's needed)John
 
Hello John,

That's great. Though I've been using a custom list of aliases for years (it was included into apache with a separate file), your update looks good (never ever before have thought of it), and I'll be happy to use it.

Will it be added into CB 1.2 as well?
 
It would be nice if this would be added to CB 1.2 as well.
I always have to change the webmail alias.
 
I've just sifted over the 1.2 code and it won't work in that way, so can't be done in that manner.
The httpd-alias.conf for 1.2 and older isn't dynamic.. it's a boring static file copy.
This is because it doesn't need to divert from the "Alias" method of doing Aliases.. unlike CB2, which needs mod_rewrite entries in some cases.

If you want a custom httpd-alias.conf file for 1.2, then just put the file exactly how you want it into this path:
Code:
/usr/local/directadmin/custombuild/custom/ap2/conf/extra/httpd-alias.conf
and any ./build rewrite_confs will copy your custom path overtop of /etc/httpd/conf, thus giving you the custom file.

John
 
I've just tried using CB 2.0.0-RC7 (rev: 910) and it did not work at all

webapps.list
Code:
webmail=/var/www/html/webmail
myadmin=/var/www/html/myadmin
Microsoft-Server-ActiveSync=/var/www/html/webmail/rpc.php
autodiscover/autodiscover.xml=/var/www/html/webmail/rpc.php
Autodiscover/Autodiscover.xml=/var/www/html/webmail/rpc.php
AutoDiscover/AutoDiscover.xml=/var/www/html/webmail/rpc.php

Message from CB
Adding custom webapps from /usr/local/directadmin/custombuild/custom/webapps.list
for alias webmailvar/www/html/webmail
for alias myadminvar/www/html/myadmin
for alias Microsoft-Server-ActiveSync/rpc.php
for alias autodiscover/autodiscover.xmlpc.php
for alias Autodiscover/Autodiscover.xmlpc.php
for alias AutoDiscover/AutoDiscover.xmlpc.php

Result in alias file
Code:
Alias /webmail /var/www/html/webmail
 
With PHP-FPM you can just use Alias now and it should work correctly :)
 
Please give it a try with "rev 925". It seems that the implementation of this feature was incomplete. You shouldn't use "/var/www/html/" with it. Just simply "alias=file", where file is a file/folder in /var/www/html. An example:
Code:
webmail=webmail
myadmin=myadmin
Microsoft-Server-ActiveSync=webmail/rpc.php
autodiscover/autodiscover.xml=webmail/rpc.php
Autodiscover/Autodiscover.xml=webmail/rpc.php
AutoDiscover/AutoDiscover.xml=webmail/rpc.php

Please let me know the results :)
 
Back
Top