Question about backup scheme

Discussion in 'General' started by Gino Carpanetti D., Nov 7, 2016.

  1. Gino Carpanetti D.

    Gino Carpanetti D. New Member

    Hi everyone,
    I'm using Ispconfig3 in my work. It is a group of small companies 10 for now but maby will be more so i used the system to make a hosting emviroment and use every companie with it's emails, pages, databases, etc. A a single client. The diference is that there's no billing.
    My Ispconfig is running inside an Ubuntu 16.04 (The perfect server tutorial) wich runs as a VM in Azure.
    My question is, what kind of backups should i made. For example, Roundcube has backups but they work i think if the mailbox is corrupted, the same with the databases.
    But, what if the virtual machine crashed or something happens in Microsoft?
    What backup policy should a robust hosting company running Ispconfig should have?
    Thanks a lot, bye!
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    put simply. backup everything.
    if you can, backup the whole vm as an image every night and store the image off host-server

    if you can only backup parts of the vm:
    tar.gz all of /etc
    tar.gz all of /opt
    tar.gz /usr/local/ispconfig
    backup all databases
    backup all webfolders, i assume these will be /var/www/
    backup all mailfolders, i assume these will be /var/mail or /var/vmail
    i also find it useful to back the crontabs. there's usually something there you forget about.

    i use this script to backup the configs to a mounted backup drive containing the last 2 weeks of server configs ( this is for server configs only, website files, mail files, and website database are backed up separately)

    ispdb="ispconfig_CP"
    suffix=$(date +"%d-%m-%Y")
    bakdir="/var/backup/cpserver/$suffix"
    mkdir -p $bakdir
    tar pcfz $bakdir/etc.tar.gz -C / etc
    tar pcfz $bakdir/opt.tar.gz -C / opt
    tar pcfz $bakdir/crontabs.tar.gz -C / var/spool/cron/crontabs
    tar pcfz $bakdir/ispconfig.tar.gz -C / usr/local/ispconfig
    mysqldump --databases mysql | gzip > $bakdir/mysql.sql.gz
    mysqldump --databases $ispdb | gzip > $bakdir/$ispdb.sql.gz
    find /var/backup/cpserver1/* -type d -ctime +14 -exec rm -rf {} +

    we have a multi-server setup, so you'd need to change the db name variable and the server name in the folder paths for each server

    to restore, recreate the server as the perfect server instructions (or use ansible or similar to script the install) and then restore all of the backups to their original locations.
     
  3. Gino Carpanetti D.

    Gino Carpanetti D. New Member

    Thanks very much.
    Do you know if there is some standard server/recources configuration for mounting a hosting service for multiple clients?
    I mean like, how many virtual machines, load balancers, virtual networks, etc.
    Maby a paper or some document by someone who did it to a small scale.
    Thanks again.
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    I doubt you'll find anything for a 'standard'. you might find examples of lots of different methods, but there is no 'right way' it depends on how many clients, how big/active are the websites, what is on the websites, eg a large magento site will want a lot more resources than a little wordpress site, as will a site with 10000 concurrent users compared to a site with 30-50 visits a day.

    you mention load balancers, so yep, you can use them, and have multiple ispconfig mirrored webservers behind them. or drop the load balancer and use dns round-robin so each webserver has it's own public ip, and each site/domain has multiple dns 'A' records.
    are the databases on the same server as the webservers? using a central database server? is it replicated/clustered?
    how is the website data stored? is it rsynced between mirrored webservers? is it on a central server and served to the webservers via nfs/samba, or on a NAS/SAN?

    if you ask 10 different people, you'll probably find 10 completely different setups in use.
     
    Gino Carpanetti D. likes this.
  5. Gino Carpanetti D.

    Gino Carpanetti D. New Member

    Thanks again for your anwser.
    Very complete and, to be honest, there are many things that goes beyond my knowledge but is an excelent point to start searching and learning for more.
    My custom hosting "provider" is very simple since it is non comercial and part of a "cluster" of small companies, i don't think i'll ever have more than 200 domains all of them with small sites each of them (or none since some of them just need the email under their domain). The only thing that is sacred is the email wich i'm running under Rounbcube/Ispconfig. i would like to have the service solid, secured and with backups so i can avoid any possible problems.
    Thanks very much.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Email is the easiest part to backup as all files are (normally) in /var/vmail and owned by user and group vmail and all user specific config is in the ispconfig database. So as long as you have a recent copy of the content of the /var/vmail folder and a copy of the ispconfig "dbispconfig" database, you can restore the email service on any fresh ispconfig install without problems.

    For the other parts of the setup, make backups of all mysql databases, make a backup of the whole /etc folder and a backup of /var/www (or the folder where all sites are in). all backups should keep the user and permission infor of the files, so e.g. use "tar pcfz mybackup.tar.gz /path/that/shall/be/backed/up/"

    Beside tar, there are nany other solutions as @nhybgtvfr pointed out like rsync, numerous backup tools etc. For example, I use virtualisation on most of my servers and as a backup I take snapshots of the virtual machines and store them on backup servers. So if I need just a single file from a backup, I mount that snapshot and copy over the file to the live system and when a server is completely messed up, then I restore the whole vm.
     
  7. Gino Carpanetti D.

    Gino Carpanetti D. New Member

    Thanks to both of you, really. You helped me a lot.
    I'll start playing with vm's to learn those concepts by doing.
     

Share This Page