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

Discussion in 'Installation/Configuration' started by Justin Albstmeijer, Feb 16, 2012.

  1. 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.

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    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.
  3. 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?

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    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.
  5. 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?
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    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.
  7. 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.

  8. till

    till Super Moderator Staff Member ISPConfig Developer

    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.

    Yes, it might be a good idea to add a api for refreshung a record.

Share This Page