Stop updates over-riding my template changes?

Hi,

I’ve been trying to figure out why Lets Encrypt updates are failing after a while of working on my servers. Eventually I came to the conclusion it’s missing the modifications I made to all the .stpl files:

listen      %ip%:%web_ssl_port% ssl http2;

After I added:

listen [::]:%web_ssl_port% ssl http2;

Now, this all works perfectly and LetsEncrypt updates the certificates fine.

BUT, and its a big but… the upgrades running seem to overwrite the changes:

[ - ] Now applying any necessary patches from version v1.4.5…
[ * ] Updating File Manager…
[ ! ] Updating default web domain templates…
[ ! ] Updating default mail domain templates…
[ ! ] Updating default DNS zone templates…
[ ! ] Verifying phpMyAdmin v5.1.1 installation…

I just noticed this this morning when I read an update email. I didn’t realise modified templates were updated. How can I stop this? I don’t really want to have to create brand new template sets for each server that won’t get overwritten, so can I tell the upgrade script to skip template updates? (I can’t imagine much changes in them during an update)

Thanks

Andy

@andrewnewby you need to copy the default templates you modify and rename them to something else or they will always get replaced.

eg if you add extra items to the PHP-7_4 template file then you would copy it and rename it to something else eg HOSTNAME-PHP-7_4 and then make changes to that one not the default file.

2 Likes

How hard is it to read a message?

#=======================================================================#
# Default Web Domain Template                                           #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
#=======================================================================#

We are currently working on full IPv6 support with in HestiaCP but it will takes time…

Ah thats a shame. I was hoping I could just put a tag in the template file, to tell it not to get overwritten. Now I have 8 servers to go through and fix up, and then rename all the templates and 100 domains :frowning: Will have to see if I can write a little script to loop through all the domains, and replace the template set with “default2” . I have found a long winded way of doing it:

v-list-users

Get all the users , then with each user do:

v-list-web-domains "chambresdhote" | tail -n +3 | grep default

This will show the domains using the “default” template set (the problem one for me), then finally do:

v-change-web-domain-tpl chambredhote mydomain.org default2

If anyone can make that into a shell script, brill. Otherwise I’ll see if I can knock up a perl script to do the job :slight_smile:

@eris I’m not editing the domains conf files myself - I’m editing those in /usr/local/hestia/data/templates/web/nginx/php-fpm , which is quite different. I didn’t realise they were overwritten when autoupdates to Hestia are run (it never used to overwrite them in Vesta, AFAIK … but then again, there were bugger all updates to Vesta =))

Anyway - I’ve now created a new default2 template set, and a simple Perl script to search for the users, and replace them:

use strict;

use File::Find;
use File::Slurp;

my $path = "/usr/local/hestia/data/templates/web/nginx/php-fpm";

find(\&wanted, $path);

my @users = split /\n/, `v-list-users | tail +3`;

foreach (@users) {
	my @tmp = split /\s+/;

    # now lets work on each user and get their domains... but only if they are using "default" template set!
    my @domains = split /\n/, `v-list-web-domains "$tmp[0]" | tail -n +3 | grep "default "`;

    foreach my $d (@domains) {
        my @tmp2 = split /\s+/, $d;
        print qq|USER HAS "default" template set: '$tmp[0]' for $tmp2[0] ... lets change it \n|;
        `v-change-web-domain-tpl $tmp[0] $tmp2[0] default2`;
    }

}

The “issue” with this that changes with support for new features will also never reach older setups…

Fair enough. What would be cool in the future maybe, is the option to disable that folder being updated :slight_smile: (i.e “don’t overwrite my nginx template files”, "“don’t overwrite my apache template files” etc)

Anyhow, now I have created default2 and changed all the users to use that :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.