Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
1934ff4
feat: implement lab01 devops info service
ffountainer Jan 28, 2026
031036d
Merge pull request #1 from ffountainer/lab01
ffountainer Feb 3, 2026
33ed523
feat: add lab2 application code updates
ffountainer Feb 5, 2026
d19953d
feat: add documentation for lab02
ffountainer Feb 5, 2026
d369334
feat: completed lab02
ffountainer Feb 9, 2026
26ee0ca
chore: add pytest dependency
ffountainer Feb 9, 2026
234c8bb
feat: add tests and ci pipeline
ffountainer Feb 10, 2026
ebfa918
fix: add branch description
ffountainer Feb 10, 2026
1645a9f
fix: change .github location
ffountainer Feb 10, 2026
9682b34
fix: remove branches specification
ffountainer Feb 10, 2026
5423ad8
fix: change events specification
ffountainer Feb 10, 2026
5180687
fix: try job again
ffountainer Feb 10, 2026
8fcec5f
fix: change runs-on to ubuntu
ffountainer Feb 10, 2026
dc3aea0
chore: fix dependencies
ffountainer Feb 10, 2026
30d85cb
chore: fix locations in yml
ffountainer Feb 10, 2026
e412da4
fix: meet linting requirements
ffountainer Feb 10, 2026
3d4f03e
feat: add build and security jobs
ffountainer Feb 10, 2026
265fe77
feat: add security check
ffountainer Feb 10, 2026
e36bf89
fix: change security test location
ffountainer Feb 10, 2026
b8c3063
fix: refactor yml
ffountainer Feb 10, 2026
31efc2f
fix: refactor yml
ffountainer Feb 10, 2026
4788dee
fix: refactor yml
ffountainer Feb 10, 2026
be96690
fix: refactor yml
ffountainer Feb 10, 2026
2b312cc
fix: change yml structure
ffountainer Feb 10, 2026
6a750a2
fix: change yml structure (again)
ffountainer Feb 10, 2026
2733232
feat: add docker layer caching
ffountainer Feb 10, 2026
ec806d9
feat: add docker layer caching (again)
ffountainer Feb 10, 2026
25c678e
feat: add docker layer caching (again again)
ffountainer Feb 10, 2026
36fb95e
feat: add calendar versioning
ffountainer Feb 10, 2026
006684c
feat: add calendar versioning
ffountainer Feb 10, 2026
fb7aa17
feat: add documentation for lab03
ffountainer Feb 11, 2026
a72fe9d
feat: complete lab03
ffountainer Feb 11, 2026
f2a95d6
feat: add terraform config
ffountainer Feb 18, 2026
42c2b61
feat: configured ssh access for terraform vm
ffountainer Feb 19, 2026
a413e69
feat: set up initial pulumi configuration
ffountainer Feb 19, 2026
0016f9d
feat: finished pulumi config
ffountainer Feb 19, 2026
7f9d39f
feat: add documentation for lab04
ffountainer Feb 19, 2026
d6511bc
finished lab04
ffountainer Feb 19, 2026
39c6458
feat: create directory for lab05
ffountainer Feb 23, 2026
2897379
fix: fix the ssh connection problem
ffountainer Feb 25, 2026
9f66ad3
feat: complete task 2
ffountainer Feb 26, 2026
b6d52c0
feat: start with task 3
ffountainer Feb 26, 2026
3d4e831
feat: add documentation for lab05
ffountainer Feb 26, 2026
85506b9
feat: finish lab05
ffountainer Feb 26, 2026
e9ff960
finished lab05
ffountainer Feb 26, 2026
83f7616
feat: finish task 1
ffountainer Mar 5, 2026
558012f
feat: task 2 for lab06 solved
ffountainer Mar 5, 2026
80c6916
feat: task 3 lab06 complete
ffountainer Mar 5, 2026
a2b7891
fix: add changes
ffountainer Mar 5, 2026
780ce35
chore: fix branches
ffountainer Mar 5, 2026
2c76e19
fix: fix ci
ffountainer Mar 5, 2026
86790d2
fix: follow linter rules and fix passing vault from the secrets
ffountainer Mar 6, 2026
13e66b9
temp
ffountainer Mar 6, 2026
fefb302
temp
ffountainer Mar 6, 2026
da951ca
temp
ffountainer Mar 6, 2026
5212a27
temp
ffountainer Mar 6, 2026
6402c87
temp
ffountainer Mar 6, 2026
b9ac0c6
temp
ffountainer Mar 6, 2026
dd17a5a
temp
ffountainer Mar 6, 2026
2175fc5
temp
ffountainer Mar 6, 2026
e3c0abf
temp
ffountainer Mar 6, 2026
62455b9
temp
ffountainer Mar 6, 2026
fd87342
temp
ffountainer Mar 6, 2026
4e1da19
fix hosts ini
ffountainer Mar 7, 2026
8eccd14
ci: put keys into a different file
ffountainer Mar 7, 2026
fb0c3cc
ci: do not set permissions for key file
ffountainer Mar 7, 2026
5cba7cb
ci: set key file permissions and output them to the terminal
ffountainer Mar 7, 2026
298ae99
ci: output encoded vm key
ffountainer Mar 7, 2026
f920a88
ci: output known hosts
ffountainer Mar 7, 2026
fe5d21b
ci: vm host output
ffountainer Mar 7, 2026
c591eee
ci: comment out unnecessary steps
ffountainer Mar 7, 2026
3ac4086
ci: put quotes around secrets to allow line breaks with echo
ffountainer Mar 7, 2026
018c204
ci: remove debugging statements
ffountainer Mar 7, 2026
74cb998
ci: do not hash usernames
ffountainer Mar 7, 2026
93d8067
ci: derive public key using ssh-keygen
ffountainer Mar 7, 2026
cdd1a51
ci: use public key from secrets
ffountainer Mar 7, 2026
02b3a34
ci: update public key file permissions
ffountainer Mar 7, 2026
24a06b4
ci: add vm connection check
ffountainer Mar 7, 2026
6c92945
ci: use printf to write private key
ffountainer Mar 7, 2026
29e284d
ci: store private key in base64
ffountainer Mar 7, 2026
fd8950b
ci: add ssh key password
ffountainer Mar 7, 2026
dd37feb
ci: simplify logic, because now we'll use a new passworless key
ffountainer Mar 7, 2026
11f44ac
ci: do not download when verifying with curl
ffountainer Mar 7, 2026
b1ae78a
ci: set correct app port in verification step
ffountainer Mar 7, 2026
dc75cbf
ci: make it so deploy requires lint
ffountainer Mar 7, 2026
fcb3c5a
feat: finalise documentation
ffountainer Mar 7, 2026
1a45e53
completed lab06
ffountainer Mar 7, 2026
73b3bc6
fix: update status badge
ffountainer Mar 7, 2026
8678745
Merge pull request #7 from ffountainer/lab06
ffountainer Mar 7, 2026
5b15dd8
feat: start solving task one and begin with documentation
ffountainer Mar 10, 2026
e2fa8fc
feat: finish task 1 in lab07
ffountainer Mar 11, 2026
a7c5020
feat: recreated vm with new ssh key
ffountainer Mar 11, 2026
1920f59
fix: fix linter issue
ffountainer Mar 11, 2026
5ab1bc7
feat: reconfigure all.yml vault file
ffountainer Mar 11, 2026
3a0bae8
feat: fix ci pipeline
ffountainer Mar 11, 2026
659bcf0
feat: configure logging
ffountainer Mar 12, 2026
9aa83c6
chore: change the build of the image to multiplatform
ffountainer Mar 12, 2026
e94355d
fix: lint for app.py
ffountainer Mar 12, 2026
8909396
feat: finish task 2 for lab07
ffountainer Mar 12, 2026
1ed9170
feat: finish task 3 from lab07
ffountainer Mar 12, 2026
758940d
feat: finish lab07
ffountainer Mar 12, 2026
7d62047
completed lab07
ffountainer Mar 12, 2026
cacc269
feat: lab8 finish task1
ffountainer Mar 19, 2026
09690d1
feat: lab08 finish task2
ffountainer Mar 19, 2026
f2f16da
feat: complete lab08
ffountainer Mar 19, 2026
18469d0
feat: complete lab08 + additional fixes
ffountainer Mar 19, 2026
cdbda43
complete lab08
ffountainer Mar 19, 2026
d2a4a02
feat: complete lab09
ffountainer Mar 25, 2026
8602bbe
feat: finish lab09 and pipeline update
ffountainer Mar 25, 2026
ae60958
complete lab09
ffountainer Mar 25, 2026
515b8a2
feat: lab10 complete task 2
ffountainer Apr 2, 2026
6ef3882
feat: lab10 complete task 3
ffountainer Apr 2, 2026
3b38379
feat: lab10 complete task 4
ffountainer Apr 2, 2026
ea90ac7
feat: lab10 complete documentation
ffountainer Apr 2, 2026
3bf9332
feat: complete lab10
ffountainer Apr 2, 2026
812b7b2
feat: lab11 finish task1
ffountainer Apr 7, 2026
02a810e
feat: lab11 finish task2
ffountainer Apr 7, 2026
df9808b
feat: complete lab11
ffountainer Apr 8, 2026
e46502e
finish lab 11
ffountainer Apr 8, 2026
7aef4b3
feat: start first task lab12
ffountainer Apr 14, 2026
0054d2e
feat: finish task1 for lab12
ffountainer Apr 16, 2026
1c5f306
feat: finish task2 for lab12
ffountainer Apr 16, 2026
81737a4
feat: finish task3 lab12
ffountainer Apr 16, 2026
58adb8a
feat: add documentation
ffountainer Apr 16, 2026
38b109c
fix: unit tests
ffountainer Apr 16, 2026
a0f7240
merge pull request #14 from ffountainer/lab12
ffountainer Apr 16, 2026
cc81bf9
feat: lab13 complete task1
ffountainer Apr 23, 2026
a97689d
feat: changed replica count in values.yaml
ffountainer Apr 23, 2026
b6d9710
feat: finish task2 in lab13
ffountainer Apr 23, 2026
7baf73a
feat: dev and prod
ffountainer Apr 23, 2026
27593a9
feat: finish task3 lab13
ffountainer Apr 23, 2026
57260b7
feat: finish task4 in lab13 and complete documentation
ffountainer Apr 23, 2026
733c16a
merge pull request #15 from ffountainer/lab13
ffountainer Apr 23, 2026
1cb4a61
feat: finish task1 lab14
ffountainer Apr 30, 2026
0952843
feat: finish task2 lab14
ffountainer Apr 30, 2026
1d2cd5e
feat: complete lab14
ffountainer Apr 30, 2026
3f877e9
merge pull request #16 from ffountainer/lab14
ffountainer Apr 30, 2026
54fd78b
feat: finish task1 lab15
ffountainer May 1, 2026
03d8dbe
feat: finish task2 lab15
ffountainer May 1, 2026
819c28b
feat: finish lab15
ffountainer May 1, 2026
f0495d4
merge pull request #17 from ffountainer/lab15
ffountainer May 1, 2026
5a66639
feat: finish task1 lab16
ffountainer May 2, 2026
0dae047
feat: lab16 finish task2
ffountainer May 9, 2026
85fb526
feat: finish lab16
ffountainer May 9, 2026
1ae7e91
merge pull request #18 from ffountainer/lab16
ffountainer May 9, 2026
fe0d528
feat: finish 1,2,3 tasks for lab17
ffountainer May 10, 2026
b70ef65
feat: complete task4 lab17
ffountainer May 10, 2026
dfded7c
feat: complete task5 lab17
ffountainer May 10, 2026
9077d62
feat: complete documentation lab17
ffountainer May 10, 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
90 changes: 90 additions & 0 deletions .github/workflows/ansible-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Ansible Deployment

on:
push:
branches: [ master, lab11 ]

pull_request:
branches: [ master ]
paths:
- 'app_python/ansible/**'

jobs:

lint:
name: Ansible Lint
runs-on: ubuntu-latest

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

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
pip install ansible ansible-lint

- name: Run ansible-lint
run: |
cd app_python/ansible
ansible-lint playbooks/*.yml


deploy:
name: Deploy Application
needs: lint
runs-on: ubuntu-latest

steps:

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

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Ansible
run: |
pip install ansible

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo Store the private key
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/devops-terraform-passwordless
chmod 600 ~/.ssh/devops-terraform-passwordless
echo check key validity
ssh-keygen -y -f ~/.ssh/devops-terraform-passwordless
echo Append vm ip to known hosts
ssh-keyscan "${{ secrets.VM_HOST }}" >> ~/.ssh/known_hosts

- name: Recreate group_vars/all.yml
run: |
mkdir -p app_python/ansible/group_vars
echo "${{ secrets.ANSIBLE_GROUP_VARS_ALL }}" | base64 --decode > app_python/ansible/group_vars/all.yml

- name: Run Ansible Playbook
run: |
ssh -i ~/.ssh/devops-terraform-passwordless ubuntu@${{ secrets.VM_HOST }} "echo connected"

echo '${{ secrets.ANSIBLE_VAULT_PASSWORD }}' > /tmp/vault_pass
cd app_python/ansible

ansible-playbook playbooks/deploy.yml \
-i inventory/hosts.ini \
--vault-password-file /tmp/vault_pass \
--extra-vars @./group_vars/all.yml

rm /tmp/vault_pass

- name: Verify Deployment
run: |
sleep 10
curl -f http://${{ secrets.VM_HOST }}:1999 || exit 1
curl -f http://${{ secrets.VM_HOST }}:1999/health || exit 1
69 changes: 69 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: My FLask App Testing

on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: './app_python/requirements.txt'
- name: Install dependencies
run: |
pip install -r ./app_python/requirements.txt
pip install pytest flake8
- name: Lint
run: flake8 ./app_python/app.py
- name: Test
run: pytest ./app_python/tests/
docker:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate version
run: echo "VERSION=$(date +%Y.%m.%d)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./app_python
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKER_USERNAME }}/my-app:latest
${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.VERSION }}
${{ secrets.DOCKER_USERNAME }}/my-app:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: './app_python/requirements.txt'
- name: Install dependencies
run: |
pip install -r app_python/requirements.txt
- name: Install Snyk CLI
run: npm install -g snyk
- name: Run Snyk
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
snyk test app_python \
--severity-threshold=high
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
test
# OS
.DS_Store

# Vault
app_python/ansible/group_vars/all.yml

# File for me
app_python/reminder.md

.vscode/settings.json

app_python/monitoring/.env

argocd_pass
6 changes: 6 additions & 0 deletions .wrangler/cache/wrangler-account.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"account": {
"id": "7a19bada09a97582626ff1817cab49ed",
"name": "V.levasheva@innopolis.university's Account"
}
}
29 changes: 29 additions & 0 deletions app_python/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Python
__pycache__/
*.py[cod]
venv/
*.log
.venv/

# Version control
.git
.gitignore

# IDE
.vscode/
.idea/

# OS
.DS_Store

# Secrets
.env
*.pem
secrets/

# Documentation
*.md
docs/

# Tests
tests/
16 changes: 16 additions & 0 deletions app_python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Python
__pycache__/
*.py[cod]
venv/
*.log

# IDE
.vscode/
.idea/

# OS
.DS_Store

# Vault
./ansible/group_vars/all.yml
~/.vault_pass.txt
1 change: 1 addition & 0 deletions app_python/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
devops
18 changes: 18 additions & 0 deletions app_python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.13-slim AS builder
WORKDIR /app_python
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY app.py .

FROM python:3.13-slim
ENV PORT="12345"
EXPOSE 12345
RUN apt update && apt install -y curl && rm -rf /var/lib/apt/lists/*
RUN useradd --create-home --shell /bin/bash newuser
WORKDIR /app
RUN mkdir -p /app/data && chown -R newuser:newuser /app
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=builder ./app_python .
USER newuser
CMD ["python", "app.py"]
109 changes: 109 additions & 0 deletions app_python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# User-facing documentation

## Overview

When acessed, this web service answers with information either about itself (path "/") or with its health status ("/health). The information includes fields with the details of the service, system, runtime, request and enpoints.

## Prerequisites

### Python version

Pyenv is used for the virtual environment managing. To install it refer to [this website](https://akrabat.com/creating-virtual-environments-with-pyenv/) for instructions.

Python version used: 3.12.9


### Python libraries:
- jsonify imported from Flask library
- request imported from Flask library
- platform
- socket
- datetime imported from datetime
- os
- logging

### Installation

```bash
pyenv virtualenv 3.12.9 webapp
pyenv activate webapp
pip install -r requirements.txt
```
### Running the Application
```bash
python app.py
PORT=8080 python app.py # if you want to use a custom port (the default is 5000)
```

### API Endpoints ###
- `GET /` - Service and system information
- `GET /health` - Health check
- `GET /visits` - See the number of times root directory was accessed
- `GET /ready` - Check if the application is ready to take requests
- `GET /health` - Check if the application is dead and should be reloaded

### Configuration ###

| № | Var name | Description
| ---| ----- | --------------------|
| #1 | HOST | Name of the host (defaults to socket.hostname first if available) |
| #2 | PORT | Port for the application access |
| #3 | DEBUG | Debug status |

### Docker container ###

#### Building the image locally ###

Use the command in format:
```bash
docker build -t your-docker-username/image-name:image-tag directory-with-dockerfile
```
Example:
```bash
docker build -t fountainer/my-app:1.1.0 .
```
#### Running a container ###

Use the command in format:
```bash
docker run -p host-port:container-port image-name:tag
```
Example:
```bash
docker run -p 12345:12345 fountainer/my-app:1.1.0
```
#### Pulling from Docker Hub ###

```bash
docker image pull image-name:image-tag
```

Example:
```bash
docker image pull app:1.0.0
```

### Testing ###

#### Workflow Badge

[![My FLask App Testing](https://github.com/ffountainer/DevOps-Core-Course/actions/workflows/python-ci.yml/badge.svg?branch=master)](https://github.com/ffountainer/DevOps-Core-Course/actions/workflows/python-ci.yml)

#### Unit testing ####

To test the ./ endpoint:

```bash
pytest ./app_python/tests/test_home_endpoint.py
```

To test the ./health endpoint:


```bash
pytest ./app_python/tests/test_health_endpoint.py
```

## Ansible deployment

[![Ansible Deployment](https://github.com/ffountainer/DevOps-Core-Course/actions/workflows/ansible-deploy.yml/badge.svg)](https://github.com/ffountainer/DevOps-Core-Course/actions/workflows/ansible-deploy.yml)
1 change: 1 addition & 0 deletions app_python/ansible/.vault_pass.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1967
12 changes: 12 additions & 0 deletions app_python/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[defaults]
inventory = inventory/hosts.ini
roles_path = roles
host_key_checking = False
remote_user = ubuntu
retry_files_enabled = False
vault_password_file = .vault_pass.txt

[privilege_escalation]
become = True
become_method = sudo
become_user = root
1 change: 1 addition & 0 deletions app_python/ansible/docs/LAB05.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!!!!!! real LAB05.md documentation lies in the app_python/docs/LAB05.md, since all prev labs documentation files were there, and I wanted to remain consistent. Please check this file, it has everything required by the task
1 change: 1 addition & 0 deletions app_python/ansible/docs/LAB06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!!!!!! real LAB06.md documentation lies in the app_python/docs/LAB06.md, since all prev labs documentation files were there, and I wanted to remain consistent. Please check this file, it has everything required by the task
Loading