<p>With the rise of containers, Kuberenetes, 12 Factor etc, it has become easier to replicate an identical environment across dev, staging and production. However, what there appears to be no common standard to domain name conventions.</p>

<p>As far as I can see it, there are two ways of doing it:</p>

<ul>
<li>Use subdomains:

<ul>
<li><code>*.dev.foobar.tld</code></li>
<li><code>*.staging.foobar.tld</code></li>
<li><code>*.foobar.tld</code></li>
</ul></li>
<li>Use separate domains:

<ul>
<li><code>*.foobar-dev.tld</code></li>
<li><code>*.foobar-staging.tld</code></li>
<li><code>*.foobar.tld</code></li>
</ul></li>
</ul>

<p>I can see up and downs with both approaches, but I'm curious what the common practise is.</p>

<p>As a side-note, Cloudflare will not issue you certificates for sub-sub domains (e.g. <code>*.stage.foobar.tld</code>).</p>

<blockquote>
  <p>There are only two hard things in Computer Science: cache invalidation
  and naming things.</p>
  
  <p>-- Phil Karlton</p>
</blockquote>

<p>Depends on the company size.</p>

<p>Small businesses usually go for dashes and get the wildcard certificate.
So they would have <code>dev.example.com, test.example.com</code></p>

<p>In larger enterprises they usually have a DNS infrastructure rolled out and the provisioning processes takes care of the assignment. It usually looks like</p>

<pre><code>aws-eu-central-1.appName.staging.[teamName].example.com
</code></pre>

<p>They would either use their own self-signed certs with the CA on all servers or have the money for the SANs.</p>

<p>For more inspiration:</p>

<p><a href="https://blog.serverdensity.com/server-naming-conventions-and-best-practices/" rel="noreferrer">https://blog.serverdensity.com/server-naming-conventions-and-best-practices/</a></p>

<p><a href="https://mnx.io/blog/a-proper-server-naming-scheme/" rel="noreferrer">https://mnx.io/blog/a-proper-server-naming-scheme/</a></p>

<p><a href="https://namingschemes.com/" rel="noreferrer">https://namingschemes.com/</a></p>
