# Staging and Prod

# Why

A Staging environment is important because we can test the website in a productive environment without interacting with the real productive system.

# Dos

# Testing environment

Staging is for testing the site in a productive way where the page is not online.

# Content preparation

Staging helps for adding content whitout changing content on the productive website.

# Don'ts

# DON’T UNDERPROVISION STAGING

This also means staging should run on the same hardware or cloud instances as production. Don’t run staging on out-of-warranty commodity boxes when production is on next-gen specs.

# DON’T TREAT STAGING AS PRECIOUS

Consider having tooling that gives anyone the ability to roll back the last deploy, no matter what team it came from, so no one’s work is blocked by someone else’s bug.

# DON’T BECOME DOG FOOD

If you are a monitoring platform, don’t monitor production with staging. Again, doing so may make sense at first—but now you don’t have a staging environment. You have a monitoring environment that is crucial to the health of production. This means you can’t break staging, and you now have on-call rotations for non-production services.

# Idea for us

Development setup is local. Staging and prod runs on the same server with different subdomains. With the Bitbucket pipelines we can ensure that everything which is in develop branch will be deployed to staging and everything in the master branch will be deployed to production.

Here is an example pipeline.

pipelines:
  branches:
# This pipeline runs when a new commit is pushed or merged to the master branch.
    master:
      - step:
          name: Deploy to Production
          deployment: production
          script:
            - ./deploy-to-production

# This pipeline runs when a new commit is pushed or merged to the develop branch.
    develop:
      - step:
          name: Deploy to Staging
          deployment: production
          script:
            - ./deploy-to-staging

# This pipeline runs for any branch that is prefixed with "feature/".
# This is where developers do the actual work - e.g. feature/DEV-30
    feature/*:
      - step:
          name: Build and Test
          script:
            - npm install
            - npm run build
            - npm run test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

# Quellen

Increment (opens new window)