Update nginx-upstream-config.sh for Task#9465

This commit is contained in:
kjg 2021-09-14 15:26:46 +02:00
parent 889640d064
commit 95da0f98b4

View file

@ -10,31 +10,32 @@ generate_upstream_block () {
if [ -n "$workers" ]; then
echo "upstream $name {"
for server in $workers; do
echo " server $server;"
done
if [ -n "$balancing_method" ]; then
echo "$balancing_method;"
fi
for server in $workers; do
echo " server $server;"
done
echo "}"
fi
}
# Inbound federation requests go to the same worker (based on IP).
generate_upstream_block inbound_federation_workers "$FEDERATION_WORKERS" ip_hash
#generate_upstream_block inbound_federation_workers "$FEDERATION_WORKERS" ip_hash
# For /sync and /initialSync requests it will be more efficient if all requests
# from a particular user are routed to a single instance. Extracting a user ID
# from the access token or Authorization header is a pain, so we just group by
# IP address: a specific user will use one address per client, but should not
# have too many clients...
generate_upstream_block sync_workers "$SYNC_WORKERS" ip_hash
#generate_upstream_block sync_workers "$SYNC_WORKERS" ip_hash
# Client, event seding and outbound federation are round-robin.
generate_upstream_block federation_workers "$FEDERATION_WORKERS"
generate_upstream_block client_workers "$CLIENT_WORKERS"
generate_upstream_block event_sending_workers "$EVENT_SENDING_WORKERS"
generate_upstream_block register_workers "$REGISTER_WORKERS"
generate_upstream_block generic_workers "$GENERIC_WORKERS"
#generate_upstream_block federation_workers "$FEDERATION_WORKERS"
#generate_upstream_block client_workers "$CLIENT_WORKERS"
#generate_upstream_block event_sending_workers "$EVENT_SENDING_WORKERS"
#generate_upstream_block register_workers "$REGISTER_WORKERS"
generate_upstream_block generic_worker_ih "$federation-worker" ip_hash
generate_upstream_block generic_worker_lc "$GENERIC_WORKERS" least_conn