zone-eu / zone-mta

📤 Modern outbound MTA cross platform and extendable server application
European Union Public License 1.2
599 stars 96 forks source link

Warmup Ratio on specific zone #325

Closed pydubreucq closed 1 year ago

pydubreucq commented 1 year ago

Hi, I'm trying to use Warmup feature for zone but it didn't work.

I would like to warm-up ip for a specific zone and not for all zone.

I saw in your doc on IP-Warmup that:

You can assign a new IP to the IP pool using lower load share than other addresses by using ratio option (value in the range of 0 and 1 where 0 means that this IP is never used and 1 means that only this IP is used)

{
    pools: {
        default: [
            {name: 'host1.example.com', address: '1.2.3.1'},
            {name: 'host2.example.com', address: '1.2.3.2'},
            {name: 'host3.example.com', address: '1.2.3.3'},
            // the next address gets only 5% of the messages to handle
            {name: 'warmup.example.com', address: '1.2.3.4', ratio: 1/20}
        ]
    }
}
Once your IP address is warm enough then you can either increase the load ratio for it or remove the parameter entirely to share load evenly between all addresses. Be aware though that every time you change pool structure it mixes up the address resolving, so a message that is currently deferred for greylisting does not get the same IP address that it previously used and thus might get greylisted again.

So I tried that:

        zone: {
            connections: 1,
            connectionCache: {
                ttl: 5,
                reuseCount: 100
            },
            throttling: '60 messages/minute',            
            pools: {
                        ipWarm: [
                                    {name: 'my.first-fqdn.com', address: 'xxx.xxx.xxx.xx1'},
                                    {name: 'my.second-fqdn.com', address: 'xxx.xxx.xxx.xx2', ratio: 1/2}
                        ]
            }
            recipientDomains: [ 'zone.com', 'zone.be', 'zone.ca', 'zone.ch', 'zone.co', 'zone.co.in', 'zone.co.jp']
        },

I tried in the pools.toml file too like that:

ipWarm=[
    {name: 'my.first-fqdn.com', address: 'xxx.xxx.xxx.xx1'},
    {name: 'my.second-fqdn.com', address: 'xxx.xxx.xxx.xx2', ratio: 1/2}
    ]

Or like that:

[[ipWarm]]
address="xxx.xxx.xxx.xx1"
name="my.first-fqdn.com"

[[ipWarm]]
address="xxx.xxx.xxx.xx2"
name="my.second-fqdn.com"
ratio="1/2"

Maybe it's not possible to warmup for a specific zone ?

Thanks by advance

louis-lau commented 1 year ago

The example is a JavaScript object. 1/2 == 0.5. I don't think toml does math. Have you tried 0.5?

andris9 commented 1 year ago

The ratio needs to be a numeric value. In the javascript config file, you can use math, but in toml, you must provide final values

ratio = 0.5
pydubreucq commented 1 year ago

Thanks, that's work with:

[[ipWarm]]
address="xxx.xxx.xxx.xx1"
name="my.first-fqdn.com"

[[ipWarm]]
address="xxx.xxx.xxx.xx2"
name="my.second-fqdn.com"
ratio="0.5"
rjnz2023 commented 10 months ago

Hey guys! Quick question in relation to the above: if we were to change this every x hours, do we need to restart ZoneMTA, or is there a silent way to refresh ZoneMTA to use a newer config, or would it automatically use a new config anytime we change it without needing a restart? Thanks

louis-lau commented 10 months ago

For this value you'd need to restart I think. You could run 2 instances. One which is only a feeder and one which is only a sender. That way restarting the sender wouldn't interrupt anyone sending through your MTA. Just the sending itself.

rjnz2023 commented 10 months ago

Ahaaaa! Thanks for that. That sounds like what I want to do. How would we go about doing that? Because at the moment, I am using the service file to setup a systemd service like follows:

/usr/bin/node index.js --config="/zone-mta-template/config/zonemta.toml"

louis-lau commented 10 months ago

You can create a second service that uses another config. In one config disable the feeder SMTP config, in the other remove all the IP pools. You could use toml includes to share same configs between them if you want. Because of the shared database one instance will add to the queue, the other will pick up and send from the queue.

rjnz2023 commented 10 months ago

Ahhh yup!

So, I am guessing one of them would have zonemta.toml file containing

[smtpInterfaces]
@include "interfaces/*.toml"

And the other would have another toml file containing only

[queue]
@include "queue.toml"