Deployment Process
The following section describes the deployment process of the application which ensures sufficient testing of the code and release to production with minimal impact/risk. Figure 1 shows an introductory overview, in the following description/instructions the GitHub branch is highlighted in bold the frontend/backend repos in italic
INFO
Yes, of course this process can be automated 🤓, using GitHub actions or at least an ansible script. But, being - perhaps overly - cautious the fine-grained (and in return error-prone) manual control is for now preferred.
---
title: Deployment Process
config:
look: handDrawn
---
flowchart TD
%% Definitions
classDef dev fill:#FFE082,stroke:#FFCA28,stroke-width:2px
classDef staging fill:#BBDEFB,stroke:#1E88E5,stroke-width:2px
classDef prod fill:#A5D6A7,stroke:#43A047,stroke-width:2px
%% DEV ENVIRONMENT
subgraph DEV ["🟡 Development"]
A["Start: Unit tested code <br/>on <strong>development</strong> Branch"]:::dev
end
style DEV fill:#FFECB3,stroke:#FFCA28,stroke-width:3px,color:#000
%% STAGING ENVIRONMENT
subgraph STAGING ["🔵 Staging Environment"]
subgraph SIT ["System Integration Test"]
B1["2️⃣ pull <em>frontend</em> <br> <strong>development</strong> branch"]:::staging
B2["1️⃣ pull <em>backend</em> <br> <strong>development</strong> branch"]:::staging
C1["2️⃣ Local <em>frontend</em> build"]:::staging
C2["1️⃣ Local <em>backend</em> build"]:::staging
D["3️⃣ Run tests against Website"]:::staging
E["4️⃣ Bugfix & Retest <br> until error free"]:::staging
end
style SIT fill:#90CAF9,stroke:#1E88E5,stroke-width:3px,color:#000
subgraph DEV2 ["Development"]
F["5️⃣ Squash Merge <strong>development</strong> <br> into <strong>production</strong> branch"]:::dev
end
style DEV2 fill:#FFECB3,stroke:#FFCA28,stroke-width:3px,color:#000
subgraph RTP ["Release to Production Test"]
G1["7️⃣ pull <em>frontend</em> <br> <strong>development</strong> branch"]:::staging
G2["6️⃣ pull <em>backend</em> <br> <strong>development</strong> branch"]:::staging
H1["7️⃣ Local <em>frontend</em> build"]:::staging
H2["6️⃣ Local <em>backend</em> build"]:::staging
I["8️⃣ Execute RTP Test using Test Template"]:::staging
J["9️⃣ Bugfix & Retest <br> until error free"]:::staging
end
style RTP fill:#90CAF9,stroke:#1E88E5,stroke-width:3px,color:#000
end
style STAGING fill:#90CAF9,stroke:#1E88E5,stroke-width:3px,color:#000
%% PROD ENVIRONMENT
subgraph PROD ["🟢 Production Environment"]
K1["1️⃣1️⃣ pull <em>frontend</em> <br> <strong>development</strong> branch"]:::prod
K2["🔟 pull <em>backend</em> <br> <strong>development</strong> branch"]:::prod
L1["1️⃣1️⃣ Local <em>frontend</em> build"]:::prod
L2["🔟 Local <em>backend</em> build"]:::prod
M["1️⃣2️⃣ Smoketest Production using Test Template"]:::prod
N["1️⃣3️⃣ Publish Release for Backend & Frontend and Close Issues"]:::prod
end
style PROD fill:#C8E6C9,stroke:#43A047,stroke-width:3px,color:#000
%% FLOW
A --> B1 & B2
B1 --> C1
B2 --> C2
C1 & C2 --> D
D --> E
E -- "If Bugs Found" --> A
E --> F
F --> G1 & G2
G1 --> H1
G2 --> H2
H1 & H2 --> I
I --> J
J -- "If Bugs Found" --> A
J --> K1 & K2
K1 --> L1
K2 --> L2
L1 & L2 --> M
M --> NFigure 1: Overview of the deployment process applied. Numbers relate to the text description below
Prepare System Integration Test on Staging environment
1️⃣ Update and deploy Backend/development repository:
# Change to development branch
git -C docker/strapi/app checkout development
# Pull latest version from origin
git -C docker/strapi/app pull
# Install new packages (optional: new packages added)
docker exec -it strapi yarn install
# Build admin panel (optional: changes to admin panel)
docker exec -it strapi yarn build
# Restart strapi container
docker restart strapi2️⃣ Update and deploy frontend/development repository:
# Change to development branch
git -C docker/frontend/app checkout development
# Pull latest version from origin
git -C docker/frontend/app pull
# Install new version
docker/frontend/frontend-build.sh
# Restart frontend container (optional)
docker restart frontend3️⃣ Test the development branch version using the test script here.
nohup ./run_tests.sh --env "staging" --group "staging:development,sit,frontend:v1.2.6,backend:v1.1.7" --suffix "System Integration Test" --projects "chrome,mobile,safari" --quiet &Using the following --group attributes conventions:
sit(for System Integration Testing)staging:development(testing against Staging server on development branch)frontend:vA.B.C(the current release prepared) for frontendbackend:vA.B.C(the current release prepared) for backend
After the test run finished, results can be reviewed here
4️⃣ Implement Bugfixes and retest on Development/Staging environment until error-free
Prepare production release
5️⃣ For both frontend and backend repositories on the development server do:
# Change to production branch
git checkout production
# Merge development into production
git merge --squash -X theirs development
# Commit production version
git commit -m "Squash commit for Release x.x.x"DON'T FORGET
Make sure before committing to production branch that necessary production settings are implemented (e.g., visibility of collections in Strapi)
Prepare RTP-Testing on Staging environment:
6️⃣ Update and deploy backend/production repository:
# Change to productin branch
git -C docker/strapi/app checkout production
# Pull latest version from origin
git -C docker/strapi/app pull
# Install new packages (optional: new packages added)
docker exec -it strapi yarn install
# Build admin panel (optional: changes to admin panel)
docker exec -it strapi yarn build
# Restart strapi container
docker restart strapi7️⃣ Update and deploy frontend/production repository:
# Change to production branch
git -C docker/frontend/app checkout production
# Pull latest version from origin
git -C docker/frontend/app pull
# Install new version
docker/frontend/frontend-build.sh
# Restart frontend container (optional)
docker restart frontend8️⃣ Execute Release-to-Production (RTP) test using the test script here.
nohup ./run_tests.sh --env "staging" --group "staging:production,rtp,frontend:v1.2.6,backend:v1.1.7" --suffix "Release-to-production Test" --projects "chrome,mobile,safari" --quiet &Using the following --group attributes conventions:
rtp(for Release-to-Production Test)staging:production(testing against Staging server on production branch)frontend:vA.B.C(the current release prepared) for frontendbackend:vA.B.C(the current release prepared) for backend
After the test run finished, results can be reviewed here
9️⃣ Bugfix and retest where required until error free
Release to Production on Production environment
🔟 Update and deploy Backend/production repository:
# Change to production branch
git -C docker/strapi/app checkout production
# Pull latest version from origin
git -C docker/strapi/app pull
# Install new packages (optional: new packages added)
docker exec -it strapi yarn install
# Build admin panel (optional: changes to admin panel)
docker exec -it strapi yarn build
# Restart strapi container
docker restart strapi1️⃣1️⃣ Update and deploy frontend/production repository:
# Change to production branch
git -C docker/frontend/app checkout production
# Pull latest version from origin
git -C docker/frontend/app pull
# Install new version
docker/frontend/frontend-build.sh
# Restart frontend container (optional)
docker restart frontend1️⃣2️⃣ Smoketest on Production environment - just click through the pages, seeing if everything works; the RTP on the Staging environment should be sufficiently close to Production
1️⃣3️⃣ Publish Release: Prepare and publish Release for both backend and frontend repositories and close release related issues. In the release title add the version number from the Website itself (timestamp in the footer)
