Restart without downtime
Two proxies can listen on the same ports at once, Linux spreads new connections between them. To upgrade, start the
new version, then send SIGTERM to the old one: it stops accepting and finishes open connections within
PROXY_GRACEFUL_TIMEOUT.
- Both proxies run as the same user, else Linux refuses the port.
- The old proxy’s connections waiting to be accepted at the moment it stops are reset, clients retry them. With
net.ipv4.tcp_migrate_req=1they go to the new proxy instead, see Workers. - Connection limits, speed limits and quotas are shared by both proxies through Redis.
With PROXY_REUSE_PORT=false a second proxy on a taken port fails to start instead of taking a share of the
clients, see Configuration.
Docker
Section titled “Docker”It takes --network host, two containers can’t publish one port with -p, a database and Redis outside the
container, with PROXIUM_SERVICES=proxy. Both proxies must use the same Redis: with the bundled one each container
counts limits and quotas alone.
docker run -d --name proxium-new --network host -e PROXIUM_SERVICES=proxy \ -e DATABASE_URL=... -e REDIS_URL=... -e ENCRYPTION_KEY=... -e PROXY_LISTEN=... ikoldakov/proxium:NEWdocker stop --time 50 proxium-old--time is how long Docker waits before killing the old container. Leave it about 20 seconds over
PROXY_GRACEFUL_TIMEOUT: closing connections release their places in Redis, the last traffic goes to the database
and Redis, each Redis step up to the two Redis timeouts, and the proxy reports its stop to the admin.