Skip to content

Commit 3a84617

Browse files
committed
docs: Add comprehensive documentation and modernize workflows
Major updates: - Comprehensive architecture and deployment documentation - Environment configuration documentation - Analytics integration documentation - Simplified GitHub Actions workflows Documentation: - ARCHITECTURE.md: System design and component relationships - DEPLOYMENT.md: OpenShift deployment procedures - ENVIRONMENT_CONFIGURATION.md: Config endpoint and env vars - ANALYTICS_ARCHITECTURE.md: Penguin analytics integration - CONFIGURATION.md: Application configuration guide - MONGODB_44_UPGRADE_PLAN.md: Database upgrade procedures Deployment Modernization: - Renamed build_and_promote.yaml to deploy-to-dev.yaml - Simplified test/prod workflows - Use ci-latest tag for dev deployments - OpenShift CLI install in workflows - Consistent workflow patterns across environments Configuration Changes: - Default ANALYTICS_API_URL to /analytics - Documented all environment variables - Config endpoint returns runtime environment settings - Support for local, dev, test, prod environments Security: - Remove example passwords from documentation - Update CODEOWNERS to remove @marklise This establishes comprehensive documentation foundation for system architecture, deployment, and configuration.
1 parent 4dacb31 commit 3a84617

File tree

13 files changed

+4059
-173
lines changed

13 files changed

+4059
-173
lines changed

.github/workflows/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# These owners will be the default owners for everything in
22
# the repo. Unless a later match takes precedence,
33
# they will be requested for review when someone opens a pull request.
4-
* @marklise @tom0827 @Ckoelewyn @tolkamps1 @danieltruong
4+
* @tom0827 @Ckoelewyn @tolkamps1 @danieltruong

.github/workflows/build_and_promote.yaml

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# =============================================================================
2+
# Deploy to Dev
3+
# =============================================================================
4+
# Triggered on push to develop branch.
5+
# Builds Docker image using S2I, pushes to OpenShift registry, tags for dev.
6+
# =============================================================================
7+
8+
name: Deploy to Dev
9+
10+
on:
11+
push:
12+
branches:
13+
- develop
14+
15+
permissions: write-all
16+
17+
env:
18+
OPENSHIFT_NAMESPACE: 6cdc9e-tools
19+
OPENSHIFT_DEV_NAMESPACE: 6cdc9e-dev
20+
IMAGE_NAME: eagle-api
21+
22+
jobs:
23+
build:
24+
name: Build and Tag for Dev
25+
runs-on: ubuntu-24.04
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Get Short SHA
31+
id: short-sha
32+
run: echo "SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
33+
34+
- name: Login to OpenShift registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ secrets.OPENSHIFT_REPOSITORY }}
38+
username: ${{ secrets.OPENSHIFT_REPOSITORY_USERNAME }}
39+
password: ${{ secrets.OPENSHIFT_REPOSITORY_PASSWORD }}
40+
41+
- name: Build with S2I
42+
id: build_image
43+
uses: redhat-actions/s2i-build@v2
44+
with:
45+
path_context: '.'
46+
builder_image: ${{ secrets.OPENSHIFT_REPOSITORY }}/openshift/nodejs:16-ubi9
47+
image: ${{ secrets.OPENSHIFT_REPOSITORY }}/${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}
48+
tags: ${{ steps.short-sha.outputs.SHA }}
49+
50+
- name: Push and Tag Image
51+
run: |
52+
# Push the commit SHA tagged image
53+
docker push ${{ steps.build_image.outputs.image }}:${{ steps.short-sha.outputs.SHA }}
54+
55+
# Tag as ci-latest (watched by dev DeploymentConfig) and latest
56+
docker tag ${{ steps.build_image.outputs.image }}:${{ steps.short-sha.outputs.SHA }} \
57+
${{ steps.build_image.outputs.image }}:ci-latest
58+
docker tag ${{ steps.build_image.outputs.image }}:${{ steps.short-sha.outputs.SHA }} \
59+
${{ steps.build_image.outputs.image }}:dev
60+
docker tag ${{ steps.build_image.outputs.image }}:${{ steps.short-sha.outputs.SHA }} \
61+
${{ steps.build_image.outputs.image }}:latest
62+
63+
# Push tags
64+
docker push ${{ steps.build_image.outputs.image }}:ci-latest
65+
docker push ${{ steps.build_image.outputs.image }}:dev
66+
docker push ${{ steps.build_image.outputs.image }}:latest
67+
68+
- name: Install OpenShift CLI
69+
uses: redhat-actions/openshift-tools-installer@v1
70+
with:
71+
oc: "4.14"
72+
skip_cache: true
73+
74+
- name: Log into OpenShift
75+
uses: redhat-actions/oc-login@v1.3
76+
with:
77+
openshift_server_url: ${{ secrets.OPENSHIFT_URL }}
78+
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
79+
namespace: ${{ env.OPENSHIFT_DEV_NAMESPACE }}
80+
81+
- name: Tag image in OpenShift for Dev
82+
run: |
83+
# Tag for dev promotion (manual workflow can use this)
84+
oc tag ${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.short-sha.outputs.SHA }} \
85+
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:dev
86+
87+
# Tag as ci-latest (triggers automatic dev deployment)
88+
oc tag ${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.short-sha.outputs.SHA }} \
89+
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:ci-latest
90+
91+
- name: Verify Deployment
92+
run: |
93+
echo "Checking deployment status..."
94+
oc rollout status dc/eagle-api -n ${{ env.OPENSHIFT_DEV_NAMESPACE }} --timeout=300s || true
95+
96+
echo "Current deployment:"
97+
oc get dc/eagle-api -n ${{ env.OPENSHIFT_DEV_NAMESPACE }} -o jsonpath='{.spec.template.spec.containers[0].image}'
98+
99+
- name: Summary
100+
run: |
101+
echo "## 🚀 Build Summary" >> $GITHUB_STEP_SUMMARY
102+
echo "" >> $GITHUB_STEP_SUMMARY
103+
echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY
104+
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
105+
echo "| **Commit** | ${{ steps.short-sha.outputs.SHA }} |" >> $GITHUB_STEP_SUMMARY
106+
echo "| **Environment** | dev |" >> $GITHUB_STEP_SUMMARY
107+
echo "| **Image Tag** | ${{ steps.short-sha.outputs.SHA }} |" >> $GITHUB_STEP_SUMMARY
108+
echo "" >> $GITHUB_STEP_SUMMARY
109+
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
110+
echo "To deploy to Test, manually trigger the **Deploy to Test** workflow with image tag: \`${{ steps.short-sha.outputs.SHA }}\`" >> $GITHUB_STEP_SUMMARY
Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,92 @@
1+
# =============================================================================
2+
# Deploy to Production
3+
# =============================================================================
4+
# Manually triggered workflow to deploy to production environment.
5+
# Uses workflow_dispatch with optional image_tag input.
6+
# Defaults to promoting the 'test' tagged image.
7+
# =============================================================================
8+
19
name: Deploy to Prod
210

311
on:
4-
repository_dispatch:
5-
# Trigger from repository dispatch workflow in promotion/prod branch
6-
types: [trigger-prod-deploy]
12+
workflow_dispatch:
13+
inputs:
14+
image_tag:
15+
description: 'Image tag to deploy (commit SHA or "test")'
16+
required: false
17+
default: 'test'
18+
type: string
19+
20+
permissions: write-all
721

822
env:
923
OPENSHIFT_NAMESPACE: 6cdc9e-tools
24+
OPENSHIFT_PROD_NAMESPACE: 6cdc9e-prod
1025
IMAGE_NAME: eagle-api
1126

1227
jobs:
1328
deploy:
14-
name: Deploy to Prod
29+
name: Deploy to Production
1530
runs-on: ubuntu-24.04
16-
outputs:
17-
COMMIT_SHA: ${{ steps.read-hash.outputs.SHA }}
1831
steps:
1932
- name: Checkout repository
20-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
2134
with:
22-
ref: "promotion/prod"
23-
- name: Retrieve previous commit hash
24-
id: read-hash
25-
run: echo "SHA=`jq -r '.commit' state.json`" >> $GITHUB_OUTPUT
26-
- name: Install oc CLI
35+
ref: develop
36+
37+
- name: Set image tag
38+
id: image-tag
39+
run: |
40+
TAG="${{ github.event.inputs.image_tag }}"
41+
if [ -z "$TAG" ] || [ "$TAG" = "test" ]; then
42+
echo "Using 'test' tag"
43+
echo "TAG=test" >> $GITHUB_OUTPUT
44+
else
45+
echo "Using provided tag: $TAG"
46+
echo "TAG=$TAG" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Install OpenShift CLI
2750
uses: redhat-actions/openshift-tools-installer@v1
2851
with:
2952
oc: "4.14"
3053
skip_cache: true
54+
3155
- name: Log into OpenShift
32-
uses: redhat-actions/oc-login@v1
56+
uses: redhat-actions/oc-login@v1.3
3357
with:
3458
openshift_server_url: ${{ secrets.OPENSHIFT_URL }}
3559
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
3660
namespace: ${{ env.OPENSHIFT_NAMESPACE }}
37-
- name: Tag image
61+
62+
- name: Backup and Tag image for Prod
3863
run: |
39-
oc -n ${{ env.OPENSHIFT_NAMESPACE }} tag --reference-policy='local' ${{ env.IMAGE_NAME }}:prod ${{ env.IMAGE_NAME }}:prod-backup
40-
oc -n ${{ env.OPENSHIFT_NAMESPACE }} tag --reference-policy='local' ${{ env.IMAGE_NAME }}:test ${{ env.IMAGE_NAME }}:prod
41-
sync-main-branch:
42-
name: Rebase Prod
43-
needs: deploy
44-
runs-on: ubuntu-24.04
45-
steps:
46-
- name: Checkout repository
47-
uses: actions/checkout@v2
48-
with:
49-
ref: "main"
50-
- run: |
51-
git fetch origin test
52-
git rebase ${{needs.deploy.outputs.COMMIT_SHA}} main
53-
git push origin main
64+
# Backup current prod image
65+
echo "Backing up current prod image..."
66+
oc tag ${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:prod \
67+
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:prod-backup || true
68+
69+
# Tag new image for prod
70+
echo "Tagging image ${{ env.IMAGE_NAME }}:${{ steps.image-tag.outputs.TAG }} as 'prod'"
71+
oc tag ${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.image-tag.outputs.TAG }} \
72+
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.IMAGE_NAME }}:prod
73+
74+
- name: Verify Deployment
75+
run: |
76+
echo "Checking deployment status..."
77+
oc rollout status dc/eagle-api -n ${{ env.OPENSHIFT_PROD_NAMESPACE }} --timeout=300s || true
78+
79+
echo "Current deployment:"
80+
oc get dc/eagle-api -n ${{ env.OPENSHIFT_PROD_NAMESPACE }} -o jsonpath='{.spec.template.spec.containers[0].image}'
81+
82+
- name: Summary
83+
run: |
84+
echo "## 🚀 Production Deployment Summary" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY
87+
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
88+
echo "| **Environment** | production |" >> $GITHUB_STEP_SUMMARY
89+
echo "| **Image Tag** | ${{ steps.image-tag.outputs.TAG }} |" >> $GITHUB_STEP_SUMMARY
90+
echo "| **Triggered By** | ${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY
91+
echo "" >> $GITHUB_STEP_SUMMARY
92+
echo "✅ **Deployment Complete**" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)