1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

By default, we will now listen directly on various ports [breaking]

This allows us to avoid messing around with changes to iptables and generally makes installation easier for everyone.

If you have an instance of postal before this, you will need to do a couple of things to ensure your installation continues to work.

1. You will need to specify a `fast_server.bind_address` in your postal.yml configuration file. This is the IP that you dedicated to the fast server.
2. You will need to allow Ruby to listen on privileged ports (sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ruby2.3).
3. You will need to remove any iptables rules that you may have added previously to accomodate the older way of doing this.
هذا الالتزام موجود في:
Adam Cooke
2017-05-05 11:42:28 +01:00
الأصل f9b6485f22
التزام d4fd6b9925
4 ملفات معدلة مع 14 إضافات و11 حذوفات

عرض الملف

@@ -6,14 +6,19 @@ module Postal
class Server
def run
if Postal.config.fast_server.bind_address.blank?
Postal.logger_for(:fast_server).info "Cannot start fast server because no bind address has been specified"
exit 1
end
Thread.abort_on_exception = true
TrackCertificate
server_sockets = {
TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.ssl_port) => {:ssl => true},
TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.port) => {:ssl => false},
}
Postal.logger_for(:fast_server).info("Fast server started listening on HTTP port #{Postal.config.fast_server.port}")
Postal.logger_for(:fast_server).info("Fast server started listening on HTTPS port #{Postal.config.fast_server.ssl_port}")
Postal.logger_for(:fast_server).info("Fast server started listening on HTTP (#{Postal.config.fast_server.bind_address}:#{Postal.config.fast_server.port})")
Postal.logger_for(:fast_server).info("Fast server started listening on HTTPS port (#{Postal.config.fast_server.bind_address}:#{Postal.config.fast_server.ssl_port})")
loop do
client = nil
ios = select(server_sockets.keys, nil, nil, 1)

عرض الملف

@@ -7,7 +7,6 @@ module Postal
def initialize(options = {})
@options = options
@options[:ports] ||= Postal.config.smtp_server.ports
@options[:debug] ||= false
prepare_environment
end
@@ -49,7 +48,7 @@ module Postal
if ENV['SERVER_FD']
@server = TCPServer.for_fd(ENV['SERVER_FD'].to_i)
else
@server = TCPServer.open('::', @options[:ports].first)
@server = TCPServer.open('::', Postal.config.smtp_server.port)
end
@server.autoclose = false
@server.close_on_exec = false
@@ -62,7 +61,7 @@ module Postal
@server.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPCNT, 5)
end
ENV['SERVER_FD'] = @server.to_i.to_s
logger.info "Listening"
logger.info "Listening on port #{Postal.config.smtp_server.port}"
end
def unlisten