Answers: <p>You've picked the right time to ask these questions (well, I can see you asked a <em>long</em> time ago, but I figured people will find this question who are experiencing the same situation - sorry the answer comes a bit late for you!)</p>
  <p>Sorting out your deployment pipeline before you scale up makes it far easier to co-ordinate the required changes. Later on, you'd have to deal with different teams who grown their own deployment pipelines and might not want to change them.</p>
  <h2>The research</h2>
  <p><a href="https://www.devops-research.com/research.html" rel="nofollow noreferrer">The research</a> is on your side for most of your plans... it has found a strong predictive relationship between the following techniques and improved software delivery performance <em>and</em> stability.</p>
  <ol>
  <li>Work in small batches</li>
  <li>Integrate continuously into trunk</li>
  </ol>
  <p>You hare already identified that automated checks are vital to this. You need a five-minute build process that runs tests that catch problems early. If you have a longer set of tests that need to run on an environment, you should deploy to your &quot;edge&quot; environment automatically and kick off those long-running tests.</p>
  <p>The goal is to ensure no human even looks at a software version unless it passes these checks.</p>
  <h2>After the automation</h2>
  <p>If you have manual review of software versions, you may want to allow the people using that environment to pull new versions, so they can ensure an update doesn't occur in the middle of a test session.</p>
  <p>This should be a push-button operation that deploys the software to their test environment. Ideally, they should also have a push-button operation to reset their test data to a known state (it sounds like hard work, but the investment really pays off!)</p>
  <p>When they are done, one more push-button to say it's good to go.</p>
  <h2>Production</h2>
  <p>It is possible to set up a <a href="https://octopus.com/devops/continuous-delivery/what-is-continuous-deployment/" rel="nofollow noreferrer">continuous deployment</a> pipeline that runs off the automated checks and deploys to production after the checks complete successfully.</p>
  <p>Your organization may have <em>policy constraints</em> that mean a human has to approve the release. This is fine - you'll be in <a href="https://octopus.com/devops/continuous-delivery/continuous-delivery-capabilities/" rel="nofollow noreferrer">continuous delivery</a> mode. Continuous Delivery really has all the same automation as Continuous Deployment, but it also has additional &quot;manual intervension&quot; steps, such as sign-offs and approvals.</p>
  <p>In some rare cases, you may even want to schedule deployments to occur at specific times, so another manual intervention is needed - but the deployment itself should still be automated. You want the automated deployment process to be re-used for all environments as this makes deployments reliable and repeatable.</p>
  <p>You can use a deployment automation tool to manage environments, approvals, deployments, and the different varaibles you need to use for dev, test, and production. You should also be able to set up things like self-service deployments and operations runbooks in your deployment automation tool, so you could make it easy to reset test data, clear out caches, or empty log file folders.</p>
  <h2>Agile, Lean, and DevOps (oh my!)</h2>
  <p>DevOps as defined in the Accelerate State of DevOps report is the best way humanity has come up with to deliver software (up to now). It's worth keeping tabs on the annual report to see what comes up. You can use the DevOps capability model to get ideas for things that may improve your process (but don't try and adopt them all at once!)</p>
  <p>Hope this helps some folks!</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-03-22T11:57:11.147Z
Answers: 2023-03-22T11:57:11.147Z
Answers: Fenton
Body: <p>I'm spinning up a production site and wanted to get advice on the latest best practices to manage and deploy multiple environments. At a high level, I'd like to have a good balance between keeping prod from being broken vs dev speed.</p>
  <p>This is my best high-level guess at what I should strive for:</p>
  <ol>
  <li><p>Have devs try to ship small changes + small branches into trunk branches to avoid overhead.</p>
  </li>
  <li><p>Have multiple environments aside from prod, say a &quot;dev&quot; environment.</p>
  </li>
  <li><p>Have the &quot;dev&quot; environment use CI/CD so that whenever branches merge into trunk, the &quot;dev&quot; environment will build and deploy the latest trunk</p>
  </li>
  <li><p>Dogfood / QA &quot;dev&quot; environment frequently, and whenever we feel good about it and want to ship to prod new features that made into &quot;dev&quot;, we manually deploy the current trunk to &quot;prod&quot; environment.</p>
  </li>
  </ol>
  <p>Thoughts on this approach? If this seems reasonable, I was wondering about tips on the details:</p>
  <ul>
  <li>To prevent bad trunk merges from breaking prod, does this imply deploying to &quot;prod&quot; environments is entirely manual w/o any CI / CD? Is this a common practice?</li>
  <li>We're using github. Would it make sense for both &quot;prod&quot; and &quot;dev&quot; environments to deploy from the master branch (aka trunk branch), one automatically vs one manually? Or would it make more sense for a separate prod release branches like &quot;prod-release-v1&quot;, &quot;prod-release-v2&quot;, etc. where we just cut from from the right commit in trunk branch whenever we want to deploy to prod?</li>
  </ul>
  <p>Other context:</p>
  <ul>
  <li>We're a lean startup, 10 people atm, and looking to scale a bit more.</li>
  <li>We have prod website up and running and enough customers that it's worth investing in this to avoid too much breakage.</li>
  <li>AWS is most of our stack, but also comfortable with adding any other devops tech that's well recommended in the industry.</li>
  </ul>
  <p>Appreciate any help or pointers I can get as a noob devops eng! Thank you!</p>
  
Tags: <continuous-integration><deployment><continuous-deployment><github>
Title: What's the best practice for managing / deploying multi-environments in production app?
UserDisplayName: user30768
ThreadText: # What's the best practice for managing / deploying multi-environments in production app?
  
  (Asked by: username_0 on 2021-09-21)
  
  I'm spinning up a production site and wanted to get advice on the latest best practices to manage and deploy multiple environments. At a high level, I'd like to have a good balance between keeping prod from being broken vs dev speed.
  
  This is my best high-level guess at what I should strive for:
  
  1. Have devs try to ship small changes + small branches into trunk branches to avoid overhead.
  2. Have multiple environments aside from prod, say a "dev" environment.
  3. Have the "dev" environment use CI/CD so that whenever branches merge into trunk, the "dev" environment will build and deploy the latest trunk
  4. Dogfood / QA "dev" environment frequently, and whenever we feel good about it and want to ship to prod new features that made into "dev", we manually deploy the current trunk to "prod" environment.
  
  Thoughts on this approach? If this seems reasonable, I was wondering about tips on the details:
  
  * To prevent bad trunk merges from breaking prod, does this imply deploying to "prod" environments is entirely manual w/o any CI / CD? Is this a common practice?
  * We're using github. Would it make sense for both "prod" and "dev" environments to deploy from the master branch (aka trunk branch), one automatically vs one manually? Or would it make more sense for a separate prod release branches like "prod-release-v1", "prod-release-v2", etc. where we just cut from from the right commit in trunk branch whenever we want to deploy to prod?
  
  Other context:
  
  * We're a lean startup, 10 people atm, and looking to scale a bit more.
  * We have prod website up and running and enough customers that it's worth investing in this to avoid too much breakage.
  * AWS is most of our stack, but also comfortable with adding any other devops tech that's well recommended in the industry.
  
  Appreciate any help or pointers I can get as a noob devops eng! Thank you!
  
  **Tags:** continuous-integration, deployment, continuous-deployment, github
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-22. Score: 1
  
  You've picked the right time to ask these questions (well, I can see you asked a *long* time ago, but I figured people will find this question who are experiencing the same situation - sorry the answer comes a bit late for you!)
  
  Sorting out your deployment pipeline before you scale up makes it far easier to co-ordinate the required changes. Later on, you'd have to deal with different teams who grown their own deployment pipelines and might not want to change them.
  
  ## The research
  
  [The research](https://www.devops-research.com/research.html) is on your side for most of your plans... it has found a strong predictive relationship between the following techniques and improved software delivery performance *and* stability.
  
  1. Work in small batches
  2. Integrate continuously into trunk
  
  You hare already identified that automated checks are vital to this. You need a five-minute build process that runs tests that catch problems early. If you have a longer set of tests that need to run on an environment, you should deploy to your "edge" environment automatically and kick off those long-running tests.
  
  The goal is to ensure no human even looks at a software version unless it passes these checks.
  
  ## After the automation
  
  If you have manual review of software versions, you may want to allow the people using that environment to pull new versions, so they can ensure an update doesn't occur in the middle of a test session.
  
  This should be a push-button operation that deploys the software to their test environment. Ideally, they should also have a push-button operation to reset their test data to a known state (it sounds like hard work, but the investment really pays off!)
  
  When they are done, one more push-button to say it's good to go.
  
  ## Production
  
  It is possible to set up a [continuous deployment](https://octopus.com/devops/continuous-delivery/what-is-continuous-deployment/) pipeline that runs off the automated checks and deploys to production after the checks complete successfully.
  
  Your organization may have *policy constraints* that mean a human has to approve the release. This is fine - you'll be in [continuous delivery](https://octopus.com/devops/continuous-delivery/continuous-delivery-capabilities/) mode. Continuous Delivery really has all the same automation as Continuous Deployment, but it also has additional "manual intervension" steps, such as sign-offs and approvals.
  
  In some rare cases, you may even want to schedule deployments to occur at specific times, so another manual intervention is needed - but the deployment itself should still be automated. You want the automated deployment process to be re-used for all environments as this makes deployments reliable and repeatable.
  
  You can use a deployment automation tool to manage environments, approvals, deployments, and the different varaibles you need to use for dev, test, and production. You should also be able to set up things like self-service deployments and operations runbooks in your deployment automation tool, so you could make it easy to reset test data, clear out caches, or empty log file folders.
  
  ## Agile, Lean, and DevOps (oh my!)
  
  DevOps as defined in the Accelerate State of DevOps report is the best way humanity has come up with to deliver software (up to now). It's worth keeping tabs on the annual report to see what comes up. You can use the DevOps capability model to get ideas for things that may improve your process (but don't try and adopt them all at once!)
  
  Hope this helps some folks!
  
  
  ---
  
  