Trying to capture this graphically as things progress.? Attached JPG...
a) choose your battery and appropriate charging technology
b) isolate battery from mains supply of choice... (D1 and D2)
b.1) perhaps to further isolate the batteries and mains 'conflict'... apply multiple 'D1' in series - enough to establish the differential between their voltages so the batteries are not taking load (as their voltage is presented lower via D1(s)) when mains source is available
c) I'm not much in favor of the mains vs battery relay option...? prefer not dropping power to the rack gear and restoring in a cut-over if it can be avoided.? Depending on what's in the rack, some things don't recover well if at all - Pi-based devices for one.
d) not going to be perfect +/- either battery technology... preferably leave them out of circuit as much as possible unless/until needed and can 'gracefully' take the load, and otherwise not be over- or under-charged.? ? ?"hard floating" lead acid is/was probably OK if you have the budget and mindset to check and rotate them out.??
It's possible in my evolution of all this I give up on the LiFePo options and just do what I can with the remaining former data center UPS AGMs I have - at 97# a piece.