Skip to content

Commit 05297cd

Browse files
devcontainer initial
0 parents  commit 05297cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1841
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "DevOps Toolkit",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
6+
"ghcr.io/devcontainers/features/terraform:1": {
7+
"version": "latest"
8+
},
9+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
10+
"version": "latest",
11+
"helm": "latest",
12+
"minikube": "latest"
13+
},
14+
"ghcr.io/devcontainers/features/aws-cli:1": {
15+
"version": "latest"
16+
},
17+
"ghcr.io/devcontainers/features/azure-cli:1": {
18+
"version": "latest"
19+
},
20+
"ghcr.io/devcontainers/features/python:1": {
21+
"version": "3.11"
22+
},
23+
"ghcr.io/devcontainers/features/node:1": {
24+
"version": "18"
25+
},
26+
"ghcr.io/devcontainers/features/git:1": {}
27+
},
28+
"customizations": {
29+
"vscode": {
30+
"extensions": [
31+
"ms-vscode.vscode-json",
32+
"redhat.vscode-yaml",
33+
"ms-python.python",
34+
"ms-azuretools.vscode-docker",
35+
"hashicorp.terraform",
36+
"redhat.ansible",
37+
"ms-kubernetes-tools.vscode-kubernetes-tools",
38+
"amazonwebservices.aws-toolkit-vscode",
39+
"ms-vscode.azure-account",
40+
"github.copilot",
41+
"github.copilot-chat"
42+
],
43+
"settings": {
44+
"terminal.integrated.defaultProfile.linux": "bash",
45+
"files.associations": {
46+
"*.tf": "terraform",
47+
"*.tfvars": "terraform",
48+
"*.yml": "yaml",
49+
"*.yaml": "yaml"
50+
}
51+
}
52+
}
53+
},
54+
"postCreateCommand": "bash .devcontainer/post-create.sh",
55+
"remoteUser": "vscode",
56+
"mounts": [
57+
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
58+
]
59+
}

.devcontainer/post-create.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# DevContainer Post-Create Script
4+
echo "🚀 Setting up DevOps development environment..."
5+
6+
# Update package lists
7+
sudo apt-get update
8+
9+
# Install additional tools
10+
sudo apt-get install -y \
11+
curl \
12+
wget \
13+
jq \
14+
tree \
15+
vim \
16+
htop \
17+
git-extras \
18+
shellcheck \
19+
yamllint
20+
21+
# Install Ansible
22+
python3 -m pip install --user ansible ansible-lint
23+
24+
# Install additional Python packages for DevOps
25+
python3 -m pip install --user \
26+
boto3 \
27+
pyyaml \
28+
requests \
29+
click \
30+
rich
31+
32+
# Install additional CLI tools
33+
# Install k9s for Kubernetes management
34+
curl -sS https://webi.sh/k9s | sh
35+
36+
# Install Helm diff plugin
37+
helm plugin install https://github.com/databus23/helm-diff
38+
39+
# Install tfenv for Terraform version management
40+
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
41+
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bashrc
42+
43+
# Install pre-commit
44+
python3 -m pip install --user pre-commit
45+
46+
# Make scripts executable
47+
chmod +x scripts/*.sh 2>/dev/null || true
48+
49+
echo "✅ DevOps environment setup complete!"
50+
echo "🔧 Available tools:"
51+
echo " - Terraform (tfenv for version management)"
52+
echo " - Ansible + ansible-lint"
53+
echo " - Docker + Docker Compose"
54+
echo " - Kubernetes (kubectl, helm, k9s, minikube)"
55+
echo " - AWS CLI"
56+
echo " - Azure CLI"
57+
echo " - Python 3.11 with DevOps packages"
58+
echo " - Node.js 18"
59+
echo " - Git with extras"
60+
echo " - pre-commit hooks"

.github/copilot-instructions.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- Use this file to provide workspace-specific custom instructions to Copilot. For more details, visit https://code.visualstudio.com/docs/copilot/copilot-customization#_use-a-githubcopilotinstructionsmd-file -->
2+
3+
# DevOps Project Instructions
4+
5+
This is a comprehensive DevOps project with infrastructure as code, configuration management, and automation tools.
6+
7+
## Project Context
8+
- Use Terraform for infrastructure provisioning
9+
- Use Ansible for configuration management
10+
- Follow HashiCorp Configuration Language (HCL) best practices for Terraform
11+
- Follow YAML best practices for Ansible playbooks and Kubernetes manifests
12+
- Use semantic versioning for releases
13+
- Follow GitOps principles for deployments
14+
15+
## Code Style Guidelines
16+
- Use consistent indentation (2 spaces for YAML, 2 spaces for Terraform)
17+
- Add meaningful comments to complex configurations
18+
- Use descriptive variable names
19+
- Group related resources together
20+
- Use modules for reusable components
21+
22+
## Security Considerations
23+
- Never hardcode secrets or credentials
24+
- Use environment variables or secret management systems
25+
- Follow principle of least privilege
26+
- Enable encryption for data at rest and in transit
27+
- Regularly update dependencies and base images
28+
29+
## Testing
30+
- Test Terraform configurations with `terraform plan`
31+
- Validate Ansible playbooks with `ansible-lint`
32+
- Test Docker images for vulnerabilities
33+
- Validate Kubernetes manifests before applying

.github/workflows/ci-cd.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
TERRAFORM_VERSION: 1.5.0
11+
ANSIBLE_VERSION: 2.15.0
12+
13+
jobs:
14+
lint-and-validate:
15+
name: Lint and Validate
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.11'
26+
27+
- name: Install dependencies
28+
run: |
29+
pip install ansible==${{ env.ANSIBLE_VERSION }} ansible-lint yamllint
30+
31+
- name: Setup Terraform
32+
uses: hashicorp/setup-terraform@v2
33+
with:
34+
terraform_version: ${{ env.TERRAFORM_VERSION }}
35+
36+
- name: Terraform Format Check
37+
run: |
38+
cd terraform
39+
terraform fmt -check -recursive
40+
41+
- name: Terraform Validate
42+
run: |
43+
cd terraform
44+
terraform init -backend=false
45+
terraform validate
46+
47+
- name: Ansible Lint
48+
run: |
49+
cd ansible
50+
ansible-lint playbooks/
51+
52+
- name: YAML Lint
53+
run: |
54+
yamllint kubernetes/manifests/
55+
yamllint ansible/
56+
57+
security-scan:
58+
name: Security Scan
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Run Checkov
66+
uses: bridgecrewio/checkov-action@master
67+
with:
68+
directory: .
69+
framework: terraform,kubernetes,dockerfile
70+
71+
- name: Run Trivy vulnerability scanner
72+
uses: aquasecurity/trivy-action@master
73+
with:
74+
scan-type: 'fs'
75+
scan-ref: '.'
76+
format: 'sarif'
77+
output: 'trivy-results.sarif'
78+
79+
- name: Upload Trivy scan results to GitHub Security tab
80+
uses: github/codeql-action/upload-sarif@v2
81+
if: always()
82+
with:
83+
sarif_file: 'trivy-results.sarif'
84+
85+
terraform-plan:
86+
name: Terraform Plan
87+
runs-on: ubuntu-latest
88+
needs: lint-and-validate
89+
if: github.event_name == 'pull_request'
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
95+
- name: Setup Terraform
96+
uses: hashicorp/setup-terraform@v2
97+
with:
98+
terraform_version: ${{ env.TERRAFORM_VERSION }}
99+
100+
- name: Terraform Init
101+
run: |
102+
cd terraform
103+
terraform init
104+
105+
- name: Terraform Plan
106+
run: |
107+
cd terraform
108+
terraform plan -out=tfplan
109+
110+
deploy-staging:
111+
name: Deploy to Staging
112+
runs-on: ubuntu-latest
113+
needs: [lint-and-validate, security-scan]
114+
if: github.ref == 'refs/heads/develop'
115+
environment: staging
116+
117+
steps:
118+
- name: Checkout code
119+
uses: actions/checkout@v4
120+
121+
- name: Deploy to staging
122+
run: |
123+
echo "Deploying to staging environment"
124+
# Add your deployment commands here
125+
126+
deploy-production:
127+
name: Deploy to Production
128+
runs-on: ubuntu-latest
129+
needs: [lint-and-validate, security-scan]
130+
if: github.ref == 'refs/heads/main'
131+
environment: production
132+
133+
steps:
134+
- name: Checkout code
135+
uses: actions/checkout@v4
136+
137+
- name: Deploy to production
138+
run: |
139+
echo "Deploying to production environment"
140+
# Add your deployment commands here

.gitignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# OS generated files
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
10+
# Editor files
11+
.vscode/settings.json
12+
.idea/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Terraform
18+
*.tfstate
19+
*.tfstate.*
20+
.terraform/
21+
.terraform.lock.hcl
22+
*.tfplan
23+
*.tfvars
24+
!*.tfvars.example
25+
26+
# Ansible
27+
*.retry
28+
.ansible/
29+
30+
# Docker
31+
.dockerignore
32+
33+
# Logs
34+
*.log
35+
logs/
36+
37+
# Environment variables
38+
.env
39+
.env.local
40+
.env.*.local
41+
42+
# Secrets
43+
secrets/
44+
*.pem
45+
*.key
46+
*.crt
47+
48+
# Backup files
49+
*.bak
50+
*.backup
51+
52+
# Node modules
53+
node_modules/
54+
55+
# Python
56+
__pycache__/
57+
*.py[cod]
58+
*$py.class
59+
*.so
60+
.Python
61+
env/
62+
venv/
63+
.env
64+
.venv
65+
66+
# Monitoring data
67+
monitoring/data/

0 commit comments

Comments
 (0)