HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Is there a way to commit an Apache vhost template change? (http://www.howtoforge.com/forums/showthread.php?t=56195)

Justin Albstmeijer 16th February 2012 11:49

Is there a way to commit an Apache vhost template change?
 
Hi,

I was wondering if there is a nice way to commit an Apache vhost change to all existing Apache vhosts?

So I added or changed /usr/local/ispconfig/server/conf-custom/vhost.conf.master and I want all existing vhosts to conform to this new template instead of only new ones created after the template change.

Ideally there would be a way using the API to achieve this or a "commit template changes" button for each server in the web interface.

Thank you for any useful feedback in advance.

Justin

till 16th February 2012 11:58

You can do this with the rmote api, the function to update a website is named sites_web_domain_update. as params array, you pass the array that you got with the sites_web_domain_get function.

Justin Albstmeijer 16th February 2012 12:50

Till,

Thank you for your feedback.

Tried it.
I don't need to make any web domain config change.
I tried updating without any domain_record parameter set, just to get the vhost config to be generated again against the new template.
But then my update action gets ignored.

Also tried just setting a parameter without actually changing it;

$domain_record['active'] = 'y';

but this gets ignored too.

Is there a way to work around this without having to update/change a parameter temporarily?

Justin

till 16th February 2012 13:28

The update function requires it that you pass all parameters to it. If you pass no parameter or just one parameter, the function must fail.

Justin Albstmeijer 16th February 2012 13:54

You are right, I am using the remoting_client/examples as reference, so I pass all parameters.
But I need to change a parameter to actually trigger a ispconfig job.

Otherwise I get:
Number of records that have been changed in the database: 0

So my question is, is there a way to trigger a vhost re-generate without changing a parameter temporarily?

till 16th February 2012 14:07

I think thats not possible as the update script creates a difference record and skips the update when the difference affects 0 columns of the database. But you might e.g. change a parameter that is not actually used when the vhost is rewritten like the traffic quota, so that you dont have any negative effect beside thet the vhost has been modified twice. Traffic quota is only read once per night.

Justin Albstmeijer 16th February 2012 18:18

Till,

Thank for your suggestion.
Got it to work this way.

I had to process 100 vhosts. (all vhosts on one webserver)

So my script sent 200 api calls (100 to make a temporary change and 100 to revert the change) resulting in 200 apache reloads.

Do you agree it might be a good idea if I post a feature request to add a function to be able to re-generate all vhosts config files after a template change and only reload apache once?

Such function might also become useful when a future ISPconfig software update needs to change global settings on already generated config files or file structures.

Justin

till 16th February 2012 18:23

Quote:

So my script sent 200 api calls (100 to make a temporary change and 100 to revert the change) resulting in 200 apache reloads.
If you disable the option "Test apache configuration on restart" under System > server config, then apache is only reloaded once when all sites have been modified.

Quote:

Do you agree it might be a good idea if I post a feature request to add a function to be able to re-generate all vhosts config files after a template change and only reload apache once?
Yes, it might be a good idea to add a api for refreshung a record.


All times are GMT +2. The time now is 02:30.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.