Ruby and Rails OS environment documentation

I am new and looking for some documentation about the OS evironment
(variables) set and used by Ruby, Gems, and Rails. I want to understand
how to configure and troubleshoot installations and integrations with
other services HTTPD, SQL etc..

What Paths are required?
What other environment variable are required?
What are the environment vars used for/by?
Anatomy of an application (Runtime environment perspective)?

You all get the idea...

Thanks so much for your help

Best Regards

Dale Ackerman