I am kind of new to Salesforce DX and it is very exciting to me. From what I have learned and experienced, Salesforce DX seem to be all positive. So my question is, should Salesforce DX/Dev Hub be enabled in every org if we need to develop anything? Are there any considerations for that?
Let's break that down.
First off, the supported editions for Dev Hubs are Enterprise and Unlimited Editions. So for Developer Edition orgs and Professional Edition and lower editions, you need not be concerned.
Most customers use Salesforce from a single org. In that instance, and in the case of Enterprise Edition and above, I'd suggest that those customers enable Dev Hub and use that going forward. Even if a customer does not jump into the full CI/CD swimming pool with both feet, there are a lot of features both developers and admins can take advantage of piecemeal. Data management is particularly cool. And even trying out a recently released feature in a scratch org can be quite nice instead of firing up a new Developer edition.
What about customers with a multi-org strategy? There are customers with 5, 10, or even more orgs out there. In this case, you'll want to sit down and map out a strategy to define which orgs will be the dev hub. They don't all need to be. If there were a master org for a company, for instance, that could be the dev hub, and none of the others.
Alternatively, if you have a lot of concurrent projects you may find you're running into the max number of active scratch orgs limit. In that case, you could enable dev hub in one or more other orgs.
Having multiple dev hubs will require planning to manage, especially if there are developers that work in several of these. Setting your
defaultdevhubusername parameter locally in each new project directory will help developers manage which devhub is being used when. To be explicit about ensuring a dev hub is local versus global, the most clear way to do this is using the
force:config:set command in the Salesforce CLI.
For a local dev hub, run this command in the DX project folder:
sfdx force:config:set firstname.lastname@example.org
sfdx force:config:set defaultdevhubusername=MyHubOrgAlias
To set a hub org as global you do the same, only with the
sfdx force:config:set defaultdevhubusername=MyHubOrgAlias -g
I could see certain circumstances where a developer might choose to not even use a global hub org, and only use project-specific ones
To sum all of that up. I would state the following:
Every Enterprise and Unlimited Edition customer should enable dev hub in at least one of their orgs to take advantage of the Salesforce DX toolset.
For more details about a lot of this and to add some color to the DX developer docs, I'd highly recommend spending some time reading the developer blog posts on adopting Salesforce DX.
Yes, you should enable it if you plan on using DX at all. It's a very handy feature that has no downsides. You will also probably want to enable 2GP (Second Generation Packaging) and learn how to use those to organize your metadata. Keep in mind that enabling Dev Hub does not grant any extra permissions to users; they must still be assigned special permissions to use the Scratch Org feature or create, upgrade, or remove 2GP.