External email storage / server

Hello, I currently use Linode VPS for the Web server (with HestiaCP) and a simple unmetered Hostgator server as email server (with cpanel) … I pointed the MX records for every domain to the hostgator and everything works fine. I don’t have exim/dovecot installed on hestiacp… Now I’m about to migrate everything to Amazon AWS, but storage is quite expensive there from what I saw. Is it possible to use cheaper extra disk (HDD) attached to the instance just to store emails? Or would it be possible and better to use another Amazon email / storage service? How would integration with HestiaCP look like, managing mailbox accounts for eg? I would like to clients have ability to manage their own mailbox accounts, today I manage them manually. I really appreciate your opinion. Thank you.

Yes, possible on both Linode and AWS. If you’ve got one mail domain you can mount the extra drive at
/home/user/mail/domain.com/
If you’ve got one user with several domains, you can mount
/home/user/mail/
Otherwise, you’re probably going to have to mount the whole /home/ directory, if the mail storage is over several domains and users.

1 Like

Hello, Thank you.

I have several users with several domains. In this case when mounting the cheapest storage (HDD) in /home I would lose performance on the sites, right? I think it’s not an option then.

Is it possible to change the default location of Hestiacp to store emails or a symlink? For example to /mail/domains/user? Customers use a different quota for emails.

Or would it be better to use another aws instance only for emails in this case? Would I be able to integrate through CLI or any other way the two instances so customers would manage their emails boxes?

Thanks

Yes it possible it will be only impossible to maintain with Hestia as Hestia just creates an folder an nothing more as it all managed from the home folder.

Using the normal EBS storage (Amazon) or block storage (Linode) its basically the same disk as the VMs use themselves, so no performance hit noticable. With AWS I thing you have faster and slower options available as well, so you can pick and choose.

Symlinking I guess would also be possible. But you’d have to make those symlinks manually yourself each time a mail domain was created.

I’d personally recommend you stay away from moving the default mail store location, unless you’re really familiar with exim and dovecot configs and confident you can maintain them through upgrades, typhoon, floods and other disasters.

I have been able to move users away from their homes one by one to a bigger and cheaper HDD.
I can freely decide in which drive I host each user.

I have been using the system for some time now without issues BUT I have not tried to delete an user yet.

I this post I comment the solution: Moving Home directories

Script to move an user to a different location

#!/bin/bash
#compruebo que lo corre root
if [ "$(id -u)" != "0" ]; then
echo "Debes ejecutar este script como root"
exit 1
fi

#compruebo que haya parametro
if [ -z "$1" ]; then
echo "Debes introducir el dominio que quieres mover."
echo "sintaxis: $0 midominio.com"
echo " "
ls /home/ --color="auto"
echo " "
exit 1
fi

origen="/home/$1"
destino="/home2/$1"

origenb="$origen/"
destinob="$destino/"

abortar="false"

#compruebo que el origen no sea un enlace simbólico
if [ -h $origen ]; then
    echo "El origen es un symbolik link"
    abortar="true"
fi

#compruebo que el origen es un directorio
if [ -d $origen ]; then
    echo "El directorio de origen existe."
    else
    echo "El directorio de origen no existe!"
    echo "Puede deberse a que el cliente no haya sido creado o que hayas introducido mal el nombre del dominio."
    abortar="true"
    fi
#compruebo que no haya una migracion anterior
if [ -d $destino ]; then
    echo "El directorio de destino ya existe! Aborto!"
    echo "$destino"
    abortar="true"
fi
#Si ha habido errores criticos aborto
if [ "$abortar" == "true" ]; then
exit 1
fi

#todo OK: Realizo la operacion.

#Para evitar inconsistencias paro servicios de correo
echo "*********************************"
echo "* Paramos los servicios...      *"
echo "*********************************"
#/usr/local/hestia/bin/v-list-sys-services | grep running |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Parando {}'; service {} stop; echo 'Fin.'"
service bind9 stop
service dovecot stop
service exim4 stop
    echo "Creando directorio: $destino"
    mkdir $destino
    echo "Moviendo los correos a: $destino"
    rsync -alH $origenb $destino
#cp -a $origenb $destinob
    echo "Preparo origen para borrarlo"
    chattr -i $origen/conf

    echo "Borrando los correos del origen"
    rm -Rf $origen
    echo "Creando enlace origen-destino"
    # ojo la sintaxis de ln: ln source_file link_file
    ln -s $destino $origen

#reinicio los servicios
echo "*********************************"
echo "* Iniciamos los servicios...    *"
echo "*********************************"
/usr/local/hestia/bin/v-list-sys-services | grep stopped |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Iniciando {}'; service {} start; echo 'Fin.'"

#Lista de servicios activos
/usr/local/hestia/bin/v-list-sys-services

Script to move a user back to /home

#!/bin/bash
#compruebo que lo corre root
if [ "$(id -u)" != "0" ]; then
echo "Debes ejecutar este script como root"
exit 1
fi
#compruebo que haya parametro
if [ -z "$1" ]; then
echo "Debes introducir el dominio que quieres mover."
echo "sintaxis: $0 midominio.com"
echo " "
ls /home/ --color="auto"
echo " "
exit 1
fi
origen="/home2/$1"
destino="/home/$1"
origenb="$origen/"
destinob="$destino/"
abortar="false"
#compruebo que el destino sea un enlace simbolico
if [ -h $destino ]; then
    echo "El destino ($destino) es un symbolic link."
    abortar="false"
else
    echo "El destino ($destino)  no es un symbolic link. Aborto."
    abortar="true"
fi

#compruebo que el origen es un directorio
if [ -d $origen ]; then
    echo "El directorio de origen existe."
    else
    echo "El directorio de origen no existe!"
    echo "Puede deberse a que el cliente no haya sido creado o que hayas introducido mal el nombre del dominio."
    abortar="true"
fi
#Si ha habido errores criticos aborto
if [ "$abortar" == "true" ]; then
exit 1
fi

echo "*********************************"
echo "* Paramos los servicios...      *"
echo "*********************************"
#/usr/local/hestia/bin/v-list-sys-services | grep running |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Parando {}'; service {} stop; echo 'Fin.'"
service bind9 stop
service dovecot stop
service exim4 stop
echo "Deshaciendo enlace origen-destino"
# ojo la sintaxis de ln: ln source_file link_file
unlink $destino

    echo "Creando directorio: $destino"
    mkdir $destino
    echo "Moviendo los correos a: $destino"
    rsync -alH $origenb $destino
    echo "Borrando los correos del origen"
    rm -Rf $origen

#reinicio los servicios
echo "*********************************"
echo "* Iniciamos los servicios...    *"
echo "*********************************"
#/usr/local/hestia/bin/v-list-sys-services | grep stopped |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Iniciando {}'; service {} start; echo 'Fin.'"
service bind9 start
service dovecot start
service exim4 start

Hello everyone, thank you very much for the answers. Due to the cost, quota and complexity, I think I will choose to keep the mail server separate. I will probably use a cheaper Lightsail plan with extra storage just for the mail server. And for the web server to use another instance with better processing capacity.

I will think of some way to integrate the mail server with the web server, even if I need to create a secondary user interface.

As a suggestion for the future, I think it would be nice to give the option for server admins to use and integrate external email servers or at least change the default email storage location and a specific storage quota for emails out of the box.

Thank you.

We all ready support email quotas out of the box. The current bug in 1.3.2 has been fixed …

I don’t thin there is not a lot of demand from most of the users to host email on separate servers. And if there is demand there plenty of other.

For 10 euro’s a month you can get 80gb storage…
https://www.hetzner.com/cloud

AWS is just expensive on storage…

That’s exactly what I do.

Just create:
web01.mydomain.tld
mail01.mydomain.tld

In that case, DON’T enable DNS cluster. Just use the cheapest machine available only for DNS.
If you set up a server as DNS slave servers can’t host any domain that they are already serving as DNS.

Hestia has been designed to have all users in the same machine. Until you buy a new machine and repeat the process.