Skip to content

Commit cd2a7f4

Browse files
committed
fix: address all critical issues in PR #411
- Fix IBM Code Engine volume mounting (remove non-functional persistent volumes) - Add comprehensive warnings about ephemeral storage limitations - Remove hardcoded credentials and add password validation - Fix Terraform backend DynamoDB issue for IBM Cloud - Complete Ansible requirements.yml file - Add missing inventory files for all cloud providers - Add health checks for all infrastructure services - Create CI validation workflow for Terraform/Ansible - Make backup scripts executable - Update documentation with storage limitations Resolves critical issues identified in PR review: - Missing data persistence (now documented as limitation) - Hardcoded credentials (removed, added validation) - Terraform backend issues (fixed for IBM Cloud) - Missing files (added inventory files and CI validation) - Health checks (added for all infrastructure services)
1 parent 1064bd4 commit cd2a7f4

File tree

8 files changed

+624
-131
lines changed

8 files changed

+624
-131
lines changed
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
# =============================================================================
2+
# GitHub Actions Workflow: Terraform and Ansible Validation
3+
# =============================================================================
4+
# Description: Validates Terraform configurations and Ansible playbooks
5+
# for syntax, security, and best practices.
6+
#
7+
# Author: RAG Modulo Team
8+
# Last Updated: 2025-01-13
9+
# Version: 1.0
10+
#
11+
# Triggers:
12+
# - Pull requests to main branch
13+
# - Push to main branch
14+
# - Manual trigger
15+
#
16+
# =============================================================================
17+
18+
name: "Terraform & Ansible Validation"
19+
20+
on:
21+
push:
22+
branches: [ main ]
23+
paths:
24+
- 'deployment/**'
25+
- '.github/workflows/terraform-ansible-validation.yml'
26+
pull_request:
27+
branches: [ main ]
28+
paths:
29+
- 'deployment/**'
30+
- '.github/workflows/terraform-ansible-validation.yml'
31+
workflow_dispatch:
32+
33+
env:
34+
TF_VERSION: "1.6.0"
35+
ANSIBLE_VERSION: "8.0.0"
36+
37+
jobs:
38+
# ==========================================================================
39+
# TERRAFORM VALIDATION
40+
# ==========================================================================
41+
42+
terraform-validate:
43+
name: "🔍 Terraform Validation"
44+
runs-on: ubuntu-latest
45+
defaults:
46+
run:
47+
working-directory: ./deployment/terraform
48+
49+
steps:
50+
- name: "📥 Checkout code"
51+
uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
55+
- name: "📦 Setup Terraform"
56+
uses: hashicorp/setup-terraform@v3
57+
with:
58+
terraform_version: ${{ env.TF_VERSION }}
59+
60+
- name: "🔍 Terraform Format Check"
61+
run: |
62+
echo "Checking Terraform formatting..."
63+
terraform fmt -check -recursive
64+
echo "✅ Terraform formatting is correct"
65+
66+
- name: "🔍 Terraform Init"
67+
run: |
68+
echo "Initializing Terraform..."
69+
terraform init -backend=false
70+
echo "✅ Terraform initialized successfully"
71+
72+
- name: "🔍 Terraform Validate"
73+
run: |
74+
echo "Validating Terraform configurations..."
75+
terraform validate
76+
echo "✅ Terraform validation passed"
77+
78+
- name: "🔍 Terraform Plan (Dry Run)"
79+
run: |
80+
echo "Running Terraform plan (dry run)..."
81+
terraform plan -var-file="environments/ibm/dev.tfvars" -out=tfplan
82+
echo "✅ Terraform plan completed successfully"
83+
env:
84+
TF_VAR_ibmcloud_api_key: "dummy-key-for-validation"
85+
TF_VAR_container_registry_password: "dummy-password-for-validation"
86+
TF_VAR_database_password: "dummy-database-password-for-validation"
87+
TF_VAR_minio_password: "dummy-minio-password-for-validation"
88+
89+
- name: "🔍 Security Scan (tfsec)"
90+
uses: aquasecurity/tfsec-action@v1.0.3
91+
with:
92+
working_directory: ./deployment/terraform
93+
soft_fail: true
94+
95+
- name: "🔍 Security Scan (checkov)"
96+
uses: bridgecrewio/checkov-action@master
97+
with:
98+
directory: ./deployment/terraform
99+
framework: terraform
100+
soft_fail: true
101+
102+
# ==========================================================================
103+
# ANSIBLE VALIDATION
104+
# ==========================================================================
105+
106+
ansible-validate:
107+
name: "🔍 Ansible Validation"
108+
runs-on: ubuntu-latest
109+
defaults:
110+
run:
111+
working-directory: ./deployment/ansible
112+
113+
steps:
114+
- name: "📥 Checkout code"
115+
uses: actions/checkout@v4
116+
with:
117+
fetch-depth: 0
118+
119+
- name: "📦 Setup Python"
120+
uses: actions/setup-python@v4
121+
with:
122+
python-version: "3.11"
123+
124+
- name: "📦 Install Ansible"
125+
run: |
126+
echo "Installing Ansible..."
127+
pip install ansible==${{ env.ANSIBLE_VERSION }}
128+
ansible --version
129+
echo "✅ Ansible installed successfully"
130+
131+
- name: "📦 Install Ansible Collections"
132+
run: |
133+
echo "Installing Ansible collections..."
134+
ansible-galaxy collection install -r requirements.yml
135+
echo "✅ Ansible collections installed successfully"
136+
137+
- name: "🔍 Ansible Syntax Check"
138+
run: |
139+
echo "Checking Ansible playbook syntax..."
140+
ansible-playbook --syntax-check playbooks/deploy-rag-modulo.yml
141+
ansible-playbook --syntax-check playbooks/backup-rag-modulo.yml
142+
echo "✅ Ansible syntax check passed"
143+
144+
- name: "🔍 Ansible Lint"
145+
run: |
146+
echo "Installing ansible-lint..."
147+
pip install ansible-lint
148+
149+
echo "Running ansible-lint..."
150+
ansible-lint playbooks/deploy-rag-modulo.yml
151+
ansible-lint playbooks/backup-rag-modulo.yml
152+
echo "✅ Ansible lint check passed"
153+
154+
- name: "🔍 Ansible Dry Run"
155+
run: |
156+
echo "Running Ansible dry run..."
157+
ansible-playbook --check --diff playbooks/deploy-rag-modulo.yml -i inventories/ibm/hosts.yml
158+
echo "✅ Ansible dry run completed successfully"
159+
160+
# ==========================================================================
161+
# DOCUMENTATION VALIDATION
162+
# ==========================================================================
163+
164+
docs-validate:
165+
name: "📚 Documentation Validation"
166+
runs-on: ubuntu-latest
167+
168+
steps:
169+
- name: "📥 Checkout code"
170+
uses: actions/checkout@v4
171+
with:
172+
fetch-depth: 0
173+
174+
- name: "📦 Setup Python"
175+
uses: actions/setup-python@v4
176+
with:
177+
python-version: "3.11"
178+
179+
- name: "📦 Install MkDocs"
180+
run: |
181+
echo "Installing MkDocs and plugins..."
182+
pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
183+
echo "✅ MkDocs installed successfully"
184+
185+
- name: "🔍 MkDocs Build"
186+
run: |
187+
echo "Building documentation..."
188+
mkdocs build --strict
189+
echo "✅ Documentation build completed successfully"
190+
191+
- name: "🔍 MkDocs Lint"
192+
run: |
193+
echo "Installing mkdocs-lint..."
194+
pip install mkdocs-lint
195+
196+
echo "Running mkdocs-lint..."
197+
mkdocs-lint
198+
echo "✅ MkDocs lint check passed"
199+
200+
# ==========================================================================
201+
# INTEGRATION VALIDATION
202+
# ==========================================================================
203+
204+
integration-validate:
205+
name: "🔗 Integration Validation"
206+
runs-on: ubuntu-latest
207+
needs: [terraform-validate, ansible-validate, docs-validate]
208+
209+
steps:
210+
- name: "📥 Checkout code"
211+
uses: actions/checkout@v4
212+
with:
213+
fetch-depth: 0
214+
215+
- name: "🔍 Validate File Structure"
216+
run: |
217+
echo "Validating deployment file structure..."
218+
219+
# Check required directories exist
220+
test -d "deployment/terraform/modules/ibm-cloud/code-engine" || exit 1
221+
test -d "deployment/terraform/environments/ibm" || exit 1
222+
test -d "deployment/ansible/playbooks" || exit 1
223+
test -d "deployment/ansible/inventories" || exit 1
224+
test -d "deployment/scripts" || exit 1
225+
226+
# Check required files exist
227+
test -f "deployment/terraform/modules/ibm-cloud/code-engine/main.tf" || exit 1
228+
test -f "deployment/terraform/modules/ibm-cloud/code-engine/variables.tf" || exit 1
229+
test -f "deployment/terraform/environments/ibm/main.tf" || exit 1
230+
test -f "deployment/terraform/environments/ibm/dev.tfvars" || exit 1
231+
test -f "deployment/ansible/playbooks/deploy-rag-modulo.yml" || exit 1
232+
test -f "deployment/ansible/playbooks/backup-rag-modulo.yml" || exit 1
233+
test -f "deployment/ansible/requirements.yml" || exit 1
234+
test -f "deployment/scripts/backup-rag-modulo.sh" || exit 1
235+
test -f "deployment/scripts/restore-rag-modulo.sh" || exit 1
236+
237+
# Check inventory files exist
238+
test -f "deployment/ansible/inventories/ibm/hosts.yml" || exit 1
239+
test -f "deployment/ansible/inventories/aws/hosts.yml" || exit 1
240+
test -f "deployment/ansible/inventories/azure/hosts.yml" || exit 1
241+
test -f "deployment/ansible/inventories/gcp/hosts.yml" || exit 1
242+
243+
echo "✅ File structure validation passed"
244+
245+
- name: "🔍 Validate Script Permissions"
246+
run: |
247+
echo "Validating script permissions..."
248+
249+
# Check scripts are executable
250+
test -x "deployment/scripts/backup-rag-modulo.sh" || exit 1
251+
test -x "deployment/scripts/restore-rag-modulo.sh" || exit 1
252+
253+
echo "✅ Script permissions validation passed"
254+
255+
- name: "🔍 Validate Documentation Links"
256+
run: |
257+
echo "Validating documentation links..."
258+
259+
# Check if referenced documentation exists
260+
if [ -f "docs/deployment/terraform-ansible-architecture.md" ]; then
261+
echo "✅ Main documentation exists"
262+
else
263+
echo "⚠️ Main documentation missing"
264+
fi
265+
266+
echo "✅ Documentation validation completed"
267+
268+
- name: "📊 Validation Summary"
269+
run: |
270+
echo "🎉 All validation checks completed successfully!"
271+
echo ""
272+
echo "✅ Terraform validation passed"
273+
echo "✅ Ansible validation passed"
274+
echo "✅ Documentation validation passed"
275+
echo "✅ Integration validation passed"
276+
echo ""
277+
echo "🚀 Deployment configuration is ready for use!"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# =============================================================================
2+
# Ansible Inventory: AWS Environment
3+
# =============================================================================
4+
# Description: Inventory file for AWS EKS deployment
5+
#
6+
# Author: RAG Modulo Team
7+
# Last Updated: 2025-01-13
8+
# Version: 1.0
9+
#
10+
# Usage:
11+
# ansible-playbook -i inventories/aws/hosts.yml playbooks/deploy-rag-modulo.yml
12+
#
13+
# =============================================================================
14+
15+
all:
16+
children:
17+
aws_cloud:
18+
hosts:
19+
localhost:
20+
ansible_connection: local
21+
ansible_python_interpreter: "{{ ansible_playbook_python }}"
22+
23+
# AWS Configuration
24+
cloud_provider: aws
25+
region: us-east-1
26+
availability_zones: ["us-east-1a", "us-east-1b", "us-east-1c"]
27+
28+
# EKS Configuration
29+
cluster_name: rag-modulo-cluster
30+
node_group_name: rag-modulo-nodes
31+
node_instance_type: t3.medium
32+
node_desired_size: 2
33+
node_max_size: 5
34+
node_min_size: 1
35+
36+
# Application Configuration
37+
app_name: rag-modulo
38+
environment: dev
39+
namespace: rag-modulo
40+
41+
# Deployment Configuration
42+
terraform_state_path: "deployment/terraform/environments/aws/terraform.tfstate"
43+
deployment_scripts_path: "deployment/scripts"
44+
45+
# Health Check URLs (will be set dynamically)
46+
backend_health_url: ""
47+
frontend_health_url: ""
48+
backend_url: ""
49+
frontend_url: ""
50+
51+
# Backup Configuration
52+
backup_enabled: true
53+
backup_retention_days: 30
54+
backup_compression: gzip
55+
s3_backup_bucket: rag-modulo-backups
56+
57+
# Notification Configuration
58+
notification_enabled: false
59+
slack_webhook: ""
60+
email_notifications: ""
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# =============================================================================
2+
# Ansible Inventory: Azure Environment
3+
# =============================================================================
4+
# Description: Inventory file for Azure AKS deployment
5+
#
6+
# Author: RAG Modulo Team
7+
# Last Updated: 2025-01-13
8+
# Version: 1.0
9+
#
10+
# Usage:
11+
# ansible-playbook -i inventories/azure/hosts.yml playbooks/deploy-rag-modulo.yml
12+
#
13+
# =============================================================================
14+
15+
all:
16+
children:
17+
azure_cloud:
18+
hosts:
19+
localhost:
20+
ansible_connection: local
21+
ansible_python_interpreter: "{{ ansible_playbook_python }}"
22+
23+
# Azure Configuration
24+
cloud_provider: azure
25+
location: East US
26+
resource_group: rag-modulo-rg
27+
28+
# AKS Configuration
29+
cluster_name: rag-modulo-aks
30+
node_count: 2
31+
vm_size: Standard_B2s
32+
kubernetes_version: "1.28"
33+
34+
# Application Configuration
35+
app_name: rag-modulo
36+
environment: dev
37+
namespace: rag-modulo
38+
39+
# Deployment Configuration
40+
terraform_state_path: "deployment/terraform/environments/azure/terraform.tfstate"
41+
deployment_scripts_path: "deployment/scripts"
42+
43+
# Health Check URLs (will be set dynamically)
44+
backend_health_url: ""
45+
frontend_health_url: ""
46+
backend_url: ""
47+
frontend_url: ""
48+
49+
# Backup Configuration
50+
backup_enabled: true
51+
backup_retention_days: 30
52+
backup_compression: gzip
53+
storage_account: ragmodulobackups
54+
container_name: rag-modulo-backups
55+
56+
# Notification Configuration
57+
notification_enabled: false
58+
slack_webhook: ""
59+
email_notifications: ""

0 commit comments

Comments
 (0)