...
Question: When do I define service in common-services vs. stacks folders?
One would define services in the common-services folder if there is possibility of the service being used in multiple stacks. For example, almost all stacks would need the HDFS service - so instead of redefining HDFS in each stack, the one defined in common-services is referenced from multiple stack-versions. Likewise, if a service is going to be contained in only one stack and never going to be shared, it can be defined in the stacks folder. Basically services defined in stacks folder are by used containment, whereas the ones defined in common-services are used by reference.
Define Service
Shown below is how to define a service in common-services folder. The same approach can be taken when defining services in the stacks folder, which will be discussed in the Define Stack section.