Skip to content
Open

Lab18 #4371

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3442a1f
feat: implement lab01 devops info service
Woolfer0097 Jan 28, 2026
c17561d
Merge pull request #1 from Woolfer0097/lab1
Woolfer0097 Feb 2, 2026
1726dbb
feat: lab2 complete with bonus task
Woolfer0097 Feb 4, 2026
4e7ed8c
chore: add screenshots
Woolfer0097 Feb 4, 2026
7a2107f
Merge pull request #2 from Woolfer0097/lab2
Woolfer0097 Feb 9, 2026
5d2f37a
Add Semgrep CI
semgrep-bot Feb 9, 2026
534d65c
feat: enhance CI for python
Woolfer0097 Feb 9, 2026
bf4ab0d
Merge pull request #3 from Woolfer0097/lab3
Woolfer0097 Feb 9, 2026
2275720
fix: py ci
Woolfer0097 Feb 9, 2026
a72fffb
feat: ci for go app and badges and some optimizations
Woolfer0097 Feb 9, 2026
ee30838
fix: go ling errors
Woolfer0097 Feb 11, 2026
9a335c3
Merge pull request #4 from Woolfer0097/lab3
Woolfer0097 Feb 19, 2026
3910a81
feat: lab4
Woolfer0097 Feb 19, 2026
4310c8d
Merge pull request #5 from Woolfer0097/lab4
Woolfer0097 Feb 24, 2026
74fd8c2
feat: lab5 complete
Woolfer0097 Feb 24, 2026
b235f20
Merge pull request #6 from Woolfer0097/lab5
Woolfer0097 Mar 3, 2026
1224eef
feat: ansible best practices lab 6 complete
Woolfer0097 Mar 4, 2026
105f740
fix: for test
Woolfer0097 Mar 4, 2026
780d92d
fix: vault pass
Woolfer0097 Mar 4, 2026
e180ebf
fix: lint
Woolfer0097 Mar 4, 2026
a78d7f2
fix: lint
Woolfer0097 Mar 4, 2026
375dad7
fix: lint
Woolfer0097 Mar 4, 2026
6016976
fix: deploy port check
Woolfer0097 Mar 4, 2026
11c4d73
fix: app port
Woolfer0097 Mar 4, 2026
7fdfb1a
fix: image name
Woolfer0097 Mar 4, 2026
1c273c8
fix: image name
Woolfer0097 Mar 4, 2026
82a8145
fix: port
Woolfer0097 Mar 4, 2026
433959f
fix: revert
Woolfer0097 Mar 4, 2026
6991729
fix: internal port
Woolfer0097 Mar 4, 2026
850a972
fix: verification method via ssh
Woolfer0097 Mar 4, 2026
2447935
feat: screenshot cicd verification
Woolfer0097 Mar 5, 2026
53324f2
Merge pull request #7 from Woolfer0097/lab6
Woolfer0097 Mar 11, 2026
f55f6bf
feat: lab7 done (monitoring)
Woolfer0097 Mar 11, 2026
3cbd519
fix: bugs
Woolfer0097 Mar 11, 2026
95b3056
Merge pull request #8 from Woolfer0097/lab7
Woolfer0097 Mar 19, 2026
3190bf0
lab8: complete
Woolfer0097 Mar 19, 2026
dbaa884
Merge pull request #9 from Woolfer0097/lab8
Woolfer0097 Mar 26, 2026
3fb8f26
lab: complete
Woolfer0097 Mar 26, 2026
77311c5
Merge pull request #10 from Woolfer0097/lab9
Woolfer0097 Apr 1, 2026
2ea2a8c
lab: done
Woolfer0097 Apr 2, 2026
53dded6
Merge pull request #11 from Woolfer0097/lab10
Woolfer0097 Apr 9, 2026
cdced57
feat: lab11
Woolfer0097 Apr 9, 2026
1a8f734
Merge pull request #12 from Woolfer0097/lab11
Woolfer0097 Apr 16, 2026
4dab638
lab12: done
Woolfer0097 Apr 16, 2026
9f67875
Merge pull request #13 from Woolfer0097/lab12
Woolfer0097 Apr 23, 2026
4f3873d
Use NodePort for prod in kind
Woolfer0097 Apr 23, 2026
e9e320b
lab 13: done
Woolfer0097 Apr 23, 2026
50195e3
Merge pull request #14 from Woolfer0097/lab13
Woolfer0097 Apr 30, 2026
2c99900
lab done
Woolfer0097 Apr 30, 2026
d426e08
Merge pull request #15 from Woolfer0097/lab14
Woolfer0097 May 7, 2026
b879331
lab 15: done
Woolfer0097 May 7, 2026
f865265
Merge pull request #16 from Woolfer0097/lab15
Woolfer0097 May 7, 2026
b12af09
lab16 monitoring
Woolfer0097 May 7, 2026
35c25eb
Merge pull request #17 from Woolfer0097/lab16
Woolfer0097 May 7, 2026
29f9e59
lab complete
Woolfer0097 May 13, 2026
7a96e38
feat: add screens
Woolfer0097 May 13, 2026
68ef4bd
Merge pull request #18 from Woolfer0097/lab17
Woolfer0097 May 13, 2026
bbd05ec
feat: lab done
Woolfer0097 May 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/ansible-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Ansible Deployment

on:
push:
branches: [ main, master, lab6 ]
paths:
- 'ansible/**'
- '.github/workflows/ansible-deploy.yml'
pull_request:
branches: [ main, master ]
paths:
- 'ansible/**'
- '.github/workflows/ansible-deploy.yml'

env:
WORKING_DIR: ./ansible

jobs:
lint:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible ansible-lint
ansible-galaxy collection install community.docker

- name: Create vault password file
working-directory: ./ansible
env:
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
run: |
echo "$ANSIBLE_VAULT_PASSWORD" > .vault_pass

- name: Run ansible-lint
working-directory: ${{ env.WORKING_DIR }}
run: |
ansible-lint playbooks/*.yml

deploy:
name: Deploy Application
needs: lint
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install Ansible
run: |
python -m pip install --upgrade pip
pip install ansible
ansible-galaxy collection install community.docker

- name: Setup SSH
env:
VM_HOST: ${{ secrets.VM_HOST }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$VM_HOST" >> ~/.ssh/known_hosts

- name: Prepare inventory and vault password
env:
VM_HOST: ${{ secrets.VM_HOST }}
VM_USER: ${{ secrets.VM_USER }}
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
run: |
printf "[webservers]\nwoolfer-vm ansible_host=%s ansible_user=%s\n" "$VM_HOST" "$VM_USER" > "${{ env.WORKING_DIR }}/inventory/hosts.ini"
echo "$ANSIBLE_VAULT_PASSWORD" > "${{ env.WORKING_DIR }}/.vault_pass"

- name: Deploy with Ansible
working-directory: ${{ env.WORKING_DIR }}
run: |
ansible-playbook playbooks/deploy.yml --tags "app_deploy"
rm -f .vault_pass

- name: Verify Deployment via SSH tunnel
env:
VM_HOST: ${{ secrets.VM_HOST }}
VM_USER: ${{ secrets.VM_USER }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
APP_PORT: ${{ secrets.APP_PORT }}
HEALTHCHECK_PATH: ${{ secrets.HEALTHCHECK_PATH }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$VM_HOST" >> ~/.ssh/known_hosts

APP_PORT="${APP_PORT:-8000}"
HEALTHCHECK_PATH="${HEALTHCHECK_PATH:-/health}"

ssh -f -N -L 8000:localhost:${APP_PORT} ${VM_USER}@${VM_HOST}

curl -fsS "http://localhost:${APP_PORT}${HEALTHCHECK_PATH}"

120 changes: 120 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Go CI

on:
push:
branches: [ main, master, lab03 ]
paths:
- 'app_go/**'
- '.github/workflows/go-ci.yml'
pull_request:
branches: [ main, master ]
paths:
- 'app_go/**'
- '.github/workflows/go-ci.yml'

env:
GO_VERSION: '1.22'
WORKING_DIR: ./app_go

jobs:
test:
name: Test & Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: app_go/go.mod

- name: Install dependencies
working-directory: ${{ env.WORKING_DIR }}
run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: ${{ env.WORKING_DIR }}
args: --timeout=5m

- name: Run tests with coverage
working-directory: ${{ env.WORKING_DIR }}
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out

- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
file: ./app_go/coverage.out
flags: go-unittests
name: codecov-go
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

security:
name: Security Scan (Semgrep)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Semgrep
uses: semgrep/semgrep-action@v1
with:
config: >-
p/security-audit
p/golang
p/docker
p/ci
# Run locally without Semgrep Cloud (no token needed)

docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: [test, security]
if: github.event_name == 'push'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/devops-info-go
tags: |
type=raw,value={{date 'YYYY.MM'}},enable={{is_default_branch}}
type=raw,value={{date 'YYYY.MM.DD'}},enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix={{date 'YYYY.MM.DD'}}-
flavor: |
latest=false

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./app_go
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
117 changes: 117 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Python CI

on:
push:
branches: [ main, master, lab03 ]
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'
pull_request:
branches: [ main, master ]
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'

env:
PYTHON_VERSION: '3.13'
WORKING_DIR: ./app_python

jobs:
test:
name: Test & Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: app_python/requirements-dev.txt

- name: Install dependencies
working-directory: ${{ env.WORKING_DIR }}
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run linter (Ruff)
working-directory: ${{ env.WORKING_DIR }}
run: |
ruff check . --output-format=github

- name: Run tests with coverage
working-directory: ${{ env.WORKING_DIR }}
run: |
pytest --cov=. --cov-report=term --cov-report=xml

- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
file: ./app_python/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

security:
name: Security Scan (Semgrep)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Semgrep
uses: semgrep/semgrep-action@v1
with:
config: >-
p/security-audit
p/python
p/docker
p/ci

docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: [test, security]
if: github.event_name == 'push'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/devops-info-python
tags: |
type=raw,value={{date 'YYYY.MM'}},enable={{is_default_branch}}
type=raw,value={{date 'YYYY.MM.DD'}},enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix={{date 'YYYY.MM.DD'}}-
flavor: |
latest=false

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./app_python
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
26 changes: 26 additions & 0 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- main
- master
paths:
- .github/workflows/semgrep.yml
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: 44 0 * * *
name: Semgrep
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-latest
permissions:
contents: read
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
container:
image: semgrep/semgrep
steps:
- uses: actions/checkout@v4
- run: semgrep ci
Loading