Page 1 of 1

Backup creates to many tempfolders

Posted: Fri Dec 02, 2016 5:48 am
by aumarov
I am using VestaCP for several years now. Last Friday, the panel was autoupdated. From that day I am facing problems with my VPS. I have investigated it and found out that VestaCP is trying to make backup (I usually do once a day) and system is creating large number of temp folders, but not zipped back up file. In one or two hours, these temp files occupying all free space on my hdd. Can you take a look to your backup script? By the way, I cannot check Let's Encrypt box as well.

Re: Backup creates to many tempfolders

Posted: Mon Dec 05, 2016 11:19 am
by skurudo
Please check /var/log/vesta -> backup log
aumarov wrote:By the way, I cannot check Let's Encrypt box as well.
How so? Did you get some error?

Re: Backup creates to many tempfolders

Posted: Tue Dec 06, 2016 8:10 pm
by skamasle
If you get a lot of tmp.xxxx dirs in /backup

maybe can be caused because:

1- You not have enough space to do a full backup
2- You maybe have corrupted databases and backup stop whit error

First option is very frecuent

Re: Backup creates to many tempfolders

Posted: Tue Jan 03, 2017 8:22 am
by donat
We have the same problems with backup.

There are a lot of tmp.xxxx files in /home/backup, thil the disk is full...

After deleting this tmp.xxxx files, I have a disk usage around 28%.

In the backup.log there are some error messages, but I can't evaluate, what is wrong:
egrep: /usr/local/vesta/data/templates/web/nginx/.stpl: File oder folder not found
wc: /usr/local/vesta/data/templates/web/nginx/.stpl: File oder folder not found
Error: can't parse template /usr/local/vesta/data/templates/web/nginx/.stpl

In this folder I have several files ending with .stpl but no file or folder only named as .stpl

After that message, the backup is looping and filling up my disk...

Is it a bug?

Re: Backup creates to many tempfolders

Posted: Mon Jan 23, 2017 10:00 am
by donat
Still have the problem. Is there anyone else whith this problem?

Any help is very appreciated.

Kind regards
Don

Re: Backup creates to many tempfolders

Posted: Thu Jan 26, 2017 3:34 pm
by Falzo
yes, I can reproduce that.

it seems that this is caused if you have nginx+apache2 installed, then deactivate proxy for a (sub)domain but have ssl enabled. haven't found it yet, but it looks like if there is a check missing when grepping the the templates throughout backup-process, because proxy off isn't a problem with also ssl turned off. also you can see that this only occurs on grepping an stpl while missing the name for the proxy (because it's deactivated, there is no such name).

as a workaround you might want to make sure, that you activate the reverse proxy on every domain which is using ssl... actually I don't have the time for digging deeper into a real solution :(

Re: Backup creates to many tempfolders

Posted: Thu Jan 26, 2017 3:47 pm
by Falzo
just had another look into /usr/local/vesta/bin/v-backup-user where the things are done...

there you'll find two blocks:

Code: Select all

        # Backup proxy config
        if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then
            tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.tpl"
            conf="$HOMEDIR/$user/conf/web/$PROXY_SYSTEM.conf"
            get_web_config_lines $tpl_file $conf
            sed -n "$top_line,$bottom_line p" $conf > conf/$PROXY_SYSTEM.conf
        fi

        # Backup ssl proxy config
        if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ]; then
            tpl_file="$WEBTPL/$PROXY_SYSTEM/$PROXY.stpl"
            conf="$HOMEDIR/$user/conf/web/s$PROXY_SYSTEM.conf"
            get_web_config_lines $tpl_file $conf
            sed -n "$top_line,$bottom_line p" $conf > conf/s$PROXY_SYSTEM.conf
        fi
while the first one is backing up the non-ssl config, the second one is doing so for ssl if available.

if I get this right, in the first block it checks if we are on a proxy-system (e.g. nginx+apache) and if we use that proxy (aka the var will hold the template name). in the second block it also checks first for the proxy-system and after that if ssl is enabled. yet the check for using the proxy itself is missing.

I'd suggest first line of that second block has to look like:

Code: Select all

        # Backup ssl proxy config
        if [ ! -z "$PROXY_SYSTEM" ] && [ "$SSL" = 'yes' ] && [ ! -z "$PROXY" ]; then
but haven't tested that yet...

Re: Backup creates to many tempfolders

Posted: Thu Jan 26, 2017 4:17 pm
by donat
You are my hero!

It seem's to work with this patch. Thanks a lot!

Kind regards
Don

Re: Backup creates to many tempfolders

Posted: Fri Jan 27, 2017 6:56 am
by Falzo
you're welcome. as it seems the same problem is mentioned here: https://github.com/serghey-rodin/vesta/issues/1035 , I will put a backlink there...

Re: Backup creates to many tempfolders

Posted: Sun Sep 17, 2017 4:21 pm
by BaDTaG
thanks still works. got this error and this fixed right up.