Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
68856d9
testing
tjann7 Jan 27, 2025
c11b688
Lab1 10/12.5
tjann7 Jan 28, 2025
6a2fbbd
Fix lab1
tjann7 Jan 29, 2025
41c4f8e
lab1 bonus done
tjann7 Jan 30, 2025
1b266a5
lab1 some typos
tjann7 Jan 30, 2025
12c2c39
Merge pull request #1 from tjann7/second
tjann7 Jan 30, 2025
501153f
lab02 10/12.5
tjann7 Jan 30, 2025
5d03105
lab02 10/12.5
tjann7 Jan 30, 2025
45a5a5f
Lab02 10.5/12.5
tjann7 Jan 30, 2025
4e01037
10.5/12.5 LAb02
tjann7 Jan 30, 2025
e8298e4
dude
tjann7 Jan 30, 2025
b7bd941
Merge pull request #2 from tjann7/second
tjann7 Jan 30, 2025
d4971b2
Create python-app.yml
tjann7 Feb 6, 2025
b572f9a
markdown updates
tjann7 Feb 6, 2025
be1f7ca
GitHub CI
tjann7 Feb 6, 2025
b50fb6a
some files missing
tjann7 Feb 6, 2025
f94683b
workflows
tjann7 Feb 6, 2025
5a3a9d9
Lab03 10/12.5
tjann7 Feb 6, 2025
309c2e8
Lab03 10/12.5
tjann7 Feb 6, 2025
9f830c5
some readme typos
tjann7 Feb 6, 2025
cbd97de
Merge branch 'master' into lab03
tjann7 Feb 6, 2025
88ad7a0
Merge pull request #3 from tjann7/lab03
tjann7 Feb 6, 2025
f2c3888
Lab4 6/10
tjann7 Feb 6, 2025
eca3bc3
Merge pull request #4 from tjann7/lab04
tjann7 Feb 14, 2025
c33336d
Merge branch 'master' of github.com:inno-devops-labs/S25-core-course-…
tjann7 Feb 14, 2025
8116a05
Merge branch 'master' of https://github.com/inno-devops-labs/S25-core…
Feb 16, 2025
354f985
checkpoint
tjann7 Feb 18, 2025
910e9f5
Merge branch 'master' of github.com:tjann7/DevOps-Course into lab05
tjann7 Feb 18, 2025
b06d89f
Lab05 6/10
tjann7 Feb 18, 2025
28bd2d4
readme+
tjann7 Feb 19, 2025
2717bbb
Merge pull request #5 from tjann7/lab05
tjann7 Feb 19, 2025
b3ddb85
Merge branch 'master' of github.com:tjann7/DevOps-Course
tjann7 Feb 19, 2025
8a5537f
lab07 should work but did not figure how to get webpage to log at lea…
tjann7 Feb 20, 2025
141377a
still trying to get at least some label filters in query
tjann7 Feb 21, 2025
55f7232
lab07 6/10 still permission denied for loki
Feb 23, 2025
cf438e2
lab08 not working
Feb 23, 2025
26ccf6c
Merge pull request #6 from tjann7/lab07
tjann7 Feb 23, 2025
3aa6b91
Merge pull request #7 from tjann7/lab08
tjann7 Feb 23, 2025
94d86e1
Merge branch 'master' of https://github.com/inno-devops-labs/S25-core…
Feb 24, 2025
6ff22f5
Merge branch 'master' of https://github.com/inno-devops-labs/S25-core…
Feb 24, 2025
bd0ce7e
Merge branch 'master' of https://github.com/inno-devops-labs/S25-core…
Mar 7, 2025
e1c743a
lab4 yandex cloud connected, but vm grant is out
tjann7 Apr 3, 2025
f498b3a
finally yandex works
tjann7 Apr 4, 2025
b9cfdfd
tfstates removed
tjann7 Apr 4, 2025
a8dcf74
ignore
Apr 4, 2025
d5304df
Lab5 checkpoint
Apr 7, 2025
0d83e0f
Lab5 checkpoint
Apr 7, 2025
18e7d70
lab5 ansible docker role done
tjann7 Apr 7, 2025
20623ce
Merge branch 'master' into lab05
tjann7 Apr 7, 2025
de6c32e
Merge pull request #8 from tjann7/lab05
tjann7 Apr 7, 2025
ad64963
lab06 done
tjann7 Apr 7, 2025
5b0c0ff
Merge pull request #9 from tjann7/lab06
tjann7 Apr 7, 2025
a7e0ea8
no pipeline
tjann7 Apr 9, 2025
aa7e9ae
almost showing container logs
tjann7 Apr 15, 2025
ec6da2e
Merge branch 'lab07' into lab08
Apr 23, 2025
f9400ea
finally
Apr 24, 2025
adc4f9f
Merge pull request #10 from tjann7/lab08
tjann7 Apr 24, 2025
0d476ee
lab09 done
Apr 24, 2025
102a12c
Merge pull request #11 from tjann7/lab09
tjann7 Apr 24, 2025
5aa5f1a
lab10 done
Apr 25, 2025
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
183 changes: 183 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
key.json
.terraform*
terraform.tfstate*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc
terraform/yandex_cloud/key.json
terraform/yandex_cloud/terraform.rc
ansible/roles/web_app/vars/main.yml
ansible/ansible.builtin.env
terraform/yandex_cloud/authorized_key.json
64 changes: 64 additions & 0 deletions ansible/ANSIBLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Ansible Playbook Execution:

```bash
tjann@fedora:~/DevOps-Course/ansible$ ansible-playbook playbooks/dev/main.yaml

PLAY [Deploy Python Container] *****************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************
[WARNING]: Platform linux on host yandex_vm is using the discovered Python interpreter at /usr/bin/python3.10, but future installation of another Python interpreter could change
the meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information.
ok: [yandex_vm]

TASK [web_app : Include wipe tasks] ************************************************************************************************************************************************
included: /home/tjann/DevOps-Course/ansible/roles/web_app/tasks/0-wipe.yml for yandex_vm

TASK [web_app : Stop and remove containers] ****************************************************************************************************************************************
[WARNING]: Cannot parse event from non-JSON line: b'WARNING: Error parsing config file (/root/.docker/config.json): Invalid auth configuration file'. Please report this at
https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
[WARNING]: Docker compose: unknown None: /opt/python-app/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
ok: [yandex_vm]

TASK [web_app : Remove application directory] **************************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Remove Docker image] ***********************************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Create application directory] **************************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Template docker-compose.yml] ***************************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Create Docker config directory] ************************************************************************************************************************************
ok: [yandex_vm]

TASK [web_app : Configure Docker credentials] **************************************************************************************************************************************
ok: [yandex_vm]

TASK [web_app : Wait for Docker daemon] ********************************************************************************************************************************************
ok: [yandex_vm]

TASK [web_app : Pull application image] ********************************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Create deployment directory for web_app] ***************************************************************************************************************************
changed: [yandex_vm]

TASK [web_app : Start the application container using Docker Compose] **************************************************************************************************************
changed: [yandex_vm]

PLAY RECAP *************************************************************************************************************************************************************************
yandex_vm : ok=13 changed=7 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```

Afterwards, the user can request the port via VM's terminal:

```bash
tjann@fhmm5i5qjoo0bl0si2gd:~$ curl localhost:5005
<!DOCTYPE html>
<h1>Moscow Time: 23:12:00 Moscow</h1>
<h2>Your Timezone: 20:12:00 </h2>
```

4 changes: 4 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[defaults]
inventory = inventory/
playbook_dir = playbooks/
roles_path = roles/
8 changes: 8 additions & 0 deletions ansible/inventory/default_aws_ec2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

---
all:
hosts:
yandex_vm:
ansible_host: 158.160.102.173
ansible_user: tjann
ansible_ssh_private_key_file: ~/.ssh/yandex_vm
7 changes: 7 additions & 0 deletions ansible/playbooks/dev/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

---
- name: Deploy Python Container
hosts: all
become: true
roles:
- role: web_app
44 changes: 44 additions & 0 deletions ansible/roles/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Docker Role


This role installs and configures Docker and Docker Compose.

## Requirements

- Ansible 2.10+
- Ubuntu 22.04
- 'sudo' privileges on the target machine

## Role Variables

- `docker_version`: The version of Docker to install (default: `latest`).
- `docker_compose_version`: The version of Docker Compose to install (default: `1.29.2`).

## Example Playbook

```yaml
- name: install Docker
hosts: all
roles:
- role: docker
```

## Configured Tasks

1. Dependencies installation
2. Docker repository adding
3. Docker installation
4. Docker compose installation
5. Enabling Docker autolaunching (systemctl enable docker)
6. User adding to the 'docker' group
7. Install completion check


## Playbook Instance

```yaml
- hosts: all

roles:
- roles/docker
```
68 changes: 68 additions & 0 deletions ansible/roles/docker/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
docker_edition: 'ce'
docker_packages:
- "docker-{{ docker_edition }}"
- "docker-{{ docker_edition }}-cli"
- "docker-{{ docker_edition }}-rootless-extras"
- "containerd.io"
- docker-buildx-plugin
docker_packages_state: present
docker_obsolete_packages:
- docker
- docker.io
- docker-engine
- docker-doc
- docker-compose
- docker-compose-v2
- podman-docker
- containerd
- runc

# Service options.
docker_service_manage: true
docker_service_state: started
docker_service_enabled: true
docker_restart_handler_state: restarted

# Docker Compose Plugin options.
docker_install_compose_plugin: true
docker_compose_package: docker-compose-plugin
docker_compose_package_state: present

# Docker Compose options.
docker_install_compose: false
docker_compose_version: "v2.32.1"
docker_compose_arch: "{{ ansible_architecture }}"
docker_compose_url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-linux-{{ docker_compose_arch }}"
docker_compose_path: /usr/local/bin/docker-compose

# Enable repo setup
docker_add_repo: true

# Docker repo URL.
docker_repo_url: https://download.docker.com/linux

# Used only for Debian/Ubuntu/Pop!_OS/Linux Mint. Switch 'stable' to 'nightly' if needed.
docker_apt_release_channel: stable
# docker_apt_ansible_distribution is a workaround for Ubuntu variants which can't be identified as such by Ansible,
# and is only necessary until Docker officially supports them.
docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}"
docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'armhf' if ansible_architecture == 'armv7l' else 'amd64' }}"
docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/keyrings/docker.asc] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
docker_apt_ignore_key_error: true
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg"
docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
docker_apt_filename: "docker"

# Used only for RedHat/CentOS/Fedora.
docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo"
docker_yum_repo_enable_nightly: '0'
docker_yum_repo_enable_test: '0'
docker_yum_gpg_key: "{{ docker_repo_url }}/centos/gpg"

# A list of users who will be added to the docker group.
docker_users: []

# Docker daemon options as a dict
docker_daemon_options: {}
Empty file.
5 changes: 5 additions & 0 deletions ansible/roles/docker/tasks/install_compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

- name: Install Docker Compose
ansible.builtin.apt:
name: "docker-compose-plugin"
state: present
Loading