Skip to content

Commit 235284d

Browse files
more work. split dev and prod runs
Signed-off-by: Elena Kolevska <elena@kolevska.com>
1 parent fc1b743 commit 235284d

36 files changed

+2651
-2093
lines changed

.env.local

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Local Development Environment Configuration
2+
# Copy this to .env for local development
3+
4+
# Redis Configuration (connects to local Docker Redis)
5+
REDIS_HOST=localhost
6+
REDIS_PORT=6379
7+
REDIS_PASSWORD=
8+
REDIS_DB=0
9+
REDIS_CLUSTER=false
10+
REDIS_SSL=false
11+
REDIS_MAX_CONNECTIONS=50
12+
13+
# Test Configuration
14+
TEST_CLIENT_INSTANCES=1
15+
TEST_CONNECTIONS_PER_CLIENT=5
16+
TEST_THREADS_PER_CLIENT=2
17+
TEST_DURATION=
18+
TEST_WORKLOAD_PROFILE=basic_rw
19+
20+
# OpenTelemetry Configuration (connects to local Docker OTEL Collector)
21+
OTEL_ENABLED=true
22+
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
23+
OTEL_SERVICE_NAME=redis-py-test-app
24+
OTEL_EXPORT_INTERVAL=5000
25+
26+
# Application Identification
27+
APP_NAME=python-local
28+
INSTANCE_ID=local-dev-1
29+
VERSION=dev
30+
31+
# Logging
32+
LOG_LEVEL=INFO
33+
LOG_FILE=
34+
QUIET=false
35+
36+
# Metrics
37+
METRICS_ENABLED=true
38+
METRICS_PORT=8000
39+
METRICS_INTERVAL=5

.github/workflows/ci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
services:
18+
redis:
19+
image: redis:8.2-m01
20+
ports:
21+
- 6379:6379
22+
options: >-
23+
--health-cmd "redis-cli ping"
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: '3.11'
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install -r requirements.txt
40+
pip install pytest flake8
41+
42+
- name: Lint with flake8
43+
run: |
44+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
45+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
46+
47+
- name: Test Redis connection
48+
run: |
49+
python main.py test-connection --host localhost --port 6379
50+
51+
- name: Run short integration test
52+
run: |
53+
python main.py run --workload-profile basic_rw --duration 10 --host localhost --quiet
54+
55+
build:
56+
needs: test
57+
runs-on: ubuntu-latest
58+
if: github.event_name == 'push'
59+
60+
permissions:
61+
contents: read
62+
packages: write
63+
64+
strategy:
65+
matrix:
66+
workload: [basic-rw, high-throughput, list-ops, async-mixed]
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Log in to Container Registry
75+
uses: docker/login-action@v3
76+
with:
77+
registry: ${{ env.REGISTRY }}
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Extract metadata
82+
id: meta
83+
uses: docker/metadata-action@v5
84+
with:
85+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/redis-test-${{ matrix.workload }}
86+
tags: |
87+
type=ref,event=branch
88+
type=ref,event=pr
89+
type=sha,prefix={{branch}}-
90+
type=raw,value=latest,enable={{is_default_branch}}
91+
92+
- name: Build and push Docker image
93+
uses: docker/build-push-action@v5
94+
with:
95+
context: .
96+
push: true
97+
tags: ${{ steps.meta.outputs.tags }}
98+
labels: ${{ steps.meta.outputs.labels }}
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max
101+
102+
deploy-dev:
103+
needs: build
104+
runs-on: ubuntu-latest
105+
if: github.ref == 'refs/heads/develop'
106+
environment: development
107+
108+
steps:
109+
- uses: actions/checkout@v4
110+
111+
- name: Deploy to Development
112+
run: |
113+
echo "🚀 Deploying to development environment..."
114+
# Add your deployment commands here
115+
# Examples:
116+
# - kubectl apply -f k8s/dev/
117+
# - helm upgrade --install redis-test-dev ./helm-chart
118+
# - docker-compose -f docker-compose.prod.yml up -d
119+
120+
deploy-prod:
121+
needs: build
122+
runs-on: ubuntu-latest
123+
if: github.ref == 'refs/heads/main'
124+
environment: production
125+
126+
steps:
127+
- uses: actions/checkout@v4
128+
129+
- name: Deploy to Production
130+
run: |
131+
echo "🚀 Deploying to production environment..."
132+
# Add your production deployment commands here

.gitignore

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
1-
/__pycache__
2-
/.env
3-
/.env.docker
4-
.idea
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual environments
24+
venv/
25+
env/
26+
ENV/
27+
28+
# Environment files
29+
.env
30+
.env.local
31+
.env.docker
32+
.env.production
33+
34+
# IDE
35+
.idea/
36+
.vscode/
37+
*.swp
38+
*.swo
39+
*~
40+
41+
# OS
42+
.DS_Store
43+
.DS_Store?
44+
._*
45+
.Spotlight-V100
46+
.Trashes
47+
ehthumbs.db
48+
Thumbs.db
49+
50+
# Logs
51+
logs/
52+
*.log
53+
54+
# Data
55+
data/
56+
57+
# Docker
58+
.dockerignore
59+
60+
# Temporary files
61+
tmp/
62+
temp/
63+
64+
# Other projects
565
/lettuce-test-app

0 commit comments

Comments
 (0)