Skip to content

Commit 5c482c0

Browse files
committed
feat: merge execution traceability feature to production
2 parents 1bd8998 + 023ba82 commit 5c482c0

30 files changed

+7277
-101
lines changed

.github/workflows/deploy.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build Docker Image
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, execution-traceability, 'preview/**']
66
schedule:
77
- cron: '0 2 * * 0' # Weekly rebuild (Sunday 2am UTC) for base image security patches
88
workflow_dispatch: # Manual trigger option
@@ -13,7 +13,7 @@ env:
1313

1414
# Prevent overlapping deployments
1515
concurrency:
16-
group: deploy-main
16+
group: deploy-${{ github.ref }}
1717
cancel-in-progress: true
1818

1919
jobs:
@@ -37,14 +37,39 @@ jobs:
3737
- name: Set up Docker Buildx
3838
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
3939

40+
- name: Determine image tag
41+
id: tag
42+
run: |
43+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
44+
TAG="latest"
45+
BRANCH_TAG="main-${{ github.sha }}"
46+
elif [[ "${{ github.ref }}" == "refs/heads/execution-traceability" ]]; then
47+
TAG="execution-traceability"
48+
BRANCH_TAG="execution-traceability-${{ github.sha }}"
49+
elif [[ "${{ github.ref }}" =~ ^refs/heads/preview/ ]]; then
50+
# Extract branch name from refs/heads/preview/feature-name -> feature-name
51+
BRANCH_NAME="${{ github.ref }}"
52+
BRANCH_NAME="${BRANCH_NAME#refs/heads/preview/}"
53+
TAG="preview-${BRANCH_NAME}"
54+
BRANCH_TAG="preview-${BRANCH_NAME}-${{ github.sha }}"
55+
else
56+
# For other branches (manual workflow_dispatch), use branch name
57+
BRANCH_NAME="${{ github.ref_name }}"
58+
TAG="${BRANCH_NAME}"
59+
BRANCH_TAG="${BRANCH_NAME}-${{ github.sha }}"
60+
fi
61+
62+
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
63+
echo "BRANCH_TAG=${BRANCH_TAG}" >> $GITHUB_OUTPUT
64+
4065
- name: Extract metadata
4166
id: meta
4267
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
4368
with:
4469
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4570
tags: |
46-
type=sha,prefix={{branch}}-
47-
type=raw,value=latest
71+
type=raw,value=${{ steps.tag.outputs.TAG }}
72+
type=raw,value=${{ steps.tag.outputs.BRANCH_TAG }}
4873
4974
- name: Build and push Docker image
5075
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
@@ -60,10 +85,15 @@ jobs:
6085
run: |
6186
echo "✅ Docker image built and pushed successfully"
6287
echo ""
63-
echo "📦 Image: ghcr.io/${{ github.repository }}:latest"
64-
echo ""
65-
echo "🚀 To deploy, run locally:"
66-
echo " ./scripts/deploy.sh"
88+
echo "📦 Images:"
89+
echo " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}"
90+
echo " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.BRANCH_TAG }}"
6791
echo ""
68-
echo "⚡ Or for quick deploy:"
69-
echo " ./scripts/quick-deploy.sh"
92+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
93+
echo "🚀 To deploy production, run:"
94+
echo " ./scripts/deploy.sh"
95+
else
96+
BRANCH_NAME="${{ github.ref_name }}"
97+
echo "🧪 To deploy preview, add to docker-compose.yml:"
98+
echo " image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}"
99+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ docker-config.json
109109
# Caddy data (volumes)
110110
caddy_data/
111111
caddy_config/
112+
data/backups/oews.db.*

Caddyfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
api.oews.bhavanaai.com {
2-
reverse_proxy oews-api:8000 {
3-
# 5 minute timeout for long-running queries
4-
timeout 5m
5-
}
6-
72
# Automatic HTTPS with Let's Encrypt
83
# Recommended: Add email for renewal notifications
94
105

11-
# Security headers
6+
# Security headers applied to all routes
127
header {
138
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
149
X-Frame-Options "DENY"
@@ -17,6 +12,19 @@ api.oews.bhavanaai.com {
1712
Referrer-Policy "no-referrer"
1813
}
1914

15+
# Route /trace/* to execution-traceability preview container
16+
handle /trace/* {
17+
uri strip_prefix /trace
18+
reverse_proxy oews-trace:8000 {
19+
header_up Host {http.request.host}
20+
}
21+
}
22+
23+
# Route all other requests to main API
24+
handle {
25+
reverse_proxy oews-api:8000
26+
}
27+
2028
# Access log to stdout (Docker log driver handles rotation)
2129
log {
2230
output stdout

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ services:
2020
max-size: "10m"
2121
max-file: "3"
2222

23+
oews-trace:
24+
image: ghcr.io/varunr89/oews:execution-traceability
25+
container_name: oews-trace
26+
restart: unless-stopped
27+
env_file:
28+
- .env
29+
volumes:
30+
- ./data-trace:/app/data # Separate data volume for preview
31+
healthcheck:
32+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
33+
interval: 30s
34+
timeout: 3s
35+
retries: 3
36+
start_period: 10s
37+
logging:
38+
driver: "json-file"
39+
options:
40+
max-size: "10m"
41+
max-file: "3"
42+
2343
caddy:
2444
image: caddy:2-alpine
2545
container_name: caddy

0 commit comments

Comments
 (0)