Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
bda5c9d
Create AZ_README.md
Rinotrihanna Oct 20, 2024
8b295a0
Add files via upload
Rinotrihanna Oct 20, 2024
1fbded4
Add files via upload
Rinotrihanna Oct 20, 2024
21cfefc
Add files via upload
Rinotrihanna Oct 21, 2024
4050e0a
Add files via upload
Rinotrihanna Oct 21, 2024
b5c70aa
Merge branch 'Smagicom:main' into main
Rinotrihanna Oct 27, 2024
e84025a
Merge branch 'Smagicom:main' into main
Rinotrihanna Nov 16, 2024
c746822
Create answer.md
Rinotrihanna Nov 17, 2024
5641d88
Update answer.md
Rinotrihanna Nov 17, 2024
7893c9c
Update answer.md
Rinotrihanna Nov 17, 2024
d317e71
Update answer.md
Rinotrihanna Nov 17, 2024
9a033b9
Create answer.md
Rinotrihanna Nov 17, 2024
4780989
Create answer.md
Rinotrihanna Nov 17, 2024
5c27c30
Delete nginx/nginx-auth/answer.md
Rinotrihanna Nov 17, 2024
3fe86c6
Create answer.md
Rinotrihanna Nov 17, 2024
6455acc
Delete nginx/nginx-auth-theory/answer.md
Rinotrihanna Nov 17, 2024
db86d6c
Create answer.md
Rinotrihanna Nov 17, 2024
7e3778d
Create answer.md
Rinotrihanna Nov 17, 2024
2667496
Add files via upload
Rinotrihanna Nov 17, 2024
ebbbf17
Create answer.md
Rinotrihanna Nov 17, 2024
5b228ec
Create answer.md
Rinotrihanna Nov 17, 2024
6dd95bb
Update answer.md
Rinotrihanna Nov 17, 2024
3dd32fa
Update answer.md
Rinotrihanna Nov 17, 2024
a39f80f
Update answer.md
Rinotrihanna Nov 17, 2024
0129fee
Update answer.md
Rinotrihanna Nov 17, 2024
0659cac
Add files via upload
Rinotrihanna Nov 17, 2024
71b2fe0
Add files via upload
Rinotrihanna Nov 17, 2024
8ff42bf
Add files via upload
Rinotrihanna Nov 17, 2024
20d725b
Add files via upload
Rinotrihanna Nov 17, 2024
bab0101
Create jusan-fastapi-final
Rinotrihanna Nov 17, 2024
2a229f5
Delete docker/dockerize/jusan-fastapi-final
Rinotrihanna Nov 17, 2024
d0f6e8b
Create fastapi-final
Rinotrihanna Nov 17, 2024
34b5da1
Delete docker/dockerize/fastapi-final
Rinotrihanna Nov 17, 2024
c9aa0c2
Create txt.txt
Rinotrihanna Nov 17, 2024
3164065
Update txt.txt
Rinotrihanna Nov 17, 2024
bac45b7
Add files via upload
Rinotrihanna Nov 17, 2024
120b87a
Add files via upload
Rinotrihanna Nov 17, 2024
af8802f
Add files via upload
Rinotrihanna Nov 17, 2024
b53bbc4
Create answer.md
Rinotrihanna Nov 17, 2024
0d699c6
Add files via upload
Rinotrihanna Nov 17, 2024
a1f378f
Create jusan-docker-mount
Rinotrihanna Nov 17, 2024
5c652e4
Delete docker/docker-compose-final/jusan-docker-mount
Rinotrihanna Nov 17, 2024
cc62da9
Create txtt.txt
Rinotrihanna Nov 17, 2024
d3cb5d3
Add files via upload
Rinotrihanna Nov 17, 2024
f600dfa
Delete docker/docker-compose-final/jusan-docker-mount/txtt.txt
Rinotrihanna Nov 17, 2024
4b1b5e2
Merge branch 'Smagicom:main' into main
Rinotrihanna Nov 19, 2024
0cb26da
Create answer.md
Rinotrihanna Nov 19, 2024
25cb3ce
Create answer.md
Rinotrihanna Nov 19, 2024
ae8598f
Create answer.md
Rinotrihanna Nov 19, 2024
1c15476
Create answer.md
Rinotrihanna Nov 19, 2024
46b424c
Merge branch 'Smagicom:main' into main
Rinotrihanna Nov 25, 2024
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
18 changes: 18 additions & 0 deletions docker/docker-bind/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Запуск контейнера с указанными параметрами
docker run -d \
--name jusan-docker-bind \
-p 7777:80 \
-v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro \
nginx:mainline

# Проверка доступности сервера
curl http://localhost:7777

# Показ списка запущенных контейнеров
docker ps

# Вывод логов nginx
docker logs jusan-docker-bind

26 changes: 26 additions & 0 deletions docker/docker-compose-final/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.8'

services:
api:
image: jusan-fastapi-final:dockerized
container_name: jusan-compose-final
restart: always

nginx:
image: nginx:mainline
container_name: jusan-nginx-final
restart: always
depends_on:
- api
ports:
- "8787:80"
volumes:
- ./jusan-docker-mount.conf:/etc/nginx/conf.d/jusan-docker-mount.conf # Монтирование конфигурации
- ./jusan-docker-mount.zip:/usr/share/nginx/html/jusan-docker-mount.zip # Монтирование распакованного архива
- ./jusan-fastapi-final.conf:/etc/nginx/conf.d/jusan-fastapi-final.conf # Конфигурация для перенаправления запросов
networks:
- webnet

networks:
webnet:
driver: bridge
8 changes: 8 additions & 0 deletions docker/docker-compose-final/jusan-docker-mount.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;
server_name example.com;

location / {
root /var/www/example;
}
}
Binary file not shown.
1 change: 1 addition & 0 deletions docker/docker-compose-final/jusan-docker-mount/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Hello, from jusan-docker-mount</h1>
1 change: 1 addition & 0 deletions docker/docker-compose-final/jusan-docker-mount/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Singularity
1 change: 1 addition & 0 deletions docker/docker-compose-final/jusan-docker-mount/token
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jusan
12 changes: 12 additions & 0 deletions docker/docker-compose-final/jusan-fastapi-final.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;
server_name jusan.docker-compose;

location / {
proxy_pass http://jusan-compose-final:8080; # Перенаправление на API контейнер
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
6 changes: 6 additions & 0 deletions docker/docker-compose-final/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -O https://stepik.org/media/attachments/lesson/686238/jusan-docker-mount.conf
curl -O https://stepik.org/media/attachments/lesson/686238/jusan-docker-mount.zip
unzip jusan-docker-mount.zip -d jusan-docker-mount
docker-compose up -d
docker-compose ps

7 changes: 7 additions & 0 deletions docker/docker-compose/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<code>root@user-asus:/home/user/Documents/jusan-docker/docker-compose# docker-compose up -d
Creating network "docker-compose_default" with the default driver
Creating jusan-compose ... done
root@user-asus:/home/user/Documents/jusan-docker/docker-compose# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
786cae00cc10 jusan-fastapi-final:dockerized "uvicorn main:app --…" 14 seconds ago Restarting (1) 3 seconds ago jusan-compose
root@user-asus:/home/user/Documents/jusan-docker/docker-compose# </code>
9 changes: 9 additions & 0 deletions docker/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'

services:
api:
image: jusan-fastapi-final:dockerized
container_name: jusan-compose
ports:
- "8282:8080"
restart: always
30 changes: 30 additions & 0 deletions docker/docker-exec/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Запуск контейнера
docker run -d \
--name jusan-docker-exec \
-p 8181:80 \
nginx:mainline

# Вход в контейнер и создание нового конфигурационного файла
docker exec -it jusan-docker-exec bash -c "cat << EOF > /etc/nginx/conf.d/jusan-docker-exec.conf
server {
listen 80;
server_name jusan.singularity;

location / {return 200 'Hello, from jusan-docker-exec';}
location /home {return 201 'This is my home!';}
location /about {return 202 'I am just an exercise!';}
}
EOF"

# Перезагрузка nginx внутри контейнера
docker exec jusan-docker-exec nginx -s reload

# Проверка запросов с помощью curl
curl http://localhost:8181
curl http://localhost:8181/home
curl http://localhost:8181/about

# Просмотр логов nginx
docker logs jusan-docker-exec
17 changes: 17 additions & 0 deletions docker/docker-mount/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Запуск контейнера с указанными параметрами
docker run -d \
--name jusan-docker-mount \
-p 9999:80 \
-v $(pwd)/jusan-docker-mount.conf:/etc/nginx/conf.d/jusan-docker-mount.conf:ro \
-v $(pwd)/jusan-docker-mount:/usr/share/nginx/html:ro \
nginx:mainline

# Проверка запросов
curl http://localhost:9999
curl http://localhost:9999/test
curl http://localhost:9999/token

# Просмотр логов
docker logs jusan-docker-mount
4 changes: 4 additions & 0 deletions docker/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:mainline

COPY ./jusan-dockerfile.conf /etc/nginx/conf.d/jusan-dockerfile.conf
COPY ./jusan-dockerfile /var/www/jusan-dockerfile
12 changes: 12 additions & 0 deletions docker/dockerfile/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Скачать архив и распаковать
curl -o jusan-dockerfile.zip https://stepik.org/media/attachments/lesson/686238/jusan-dockerfile.zip
unzip jusan-dockerfile.zip -d jusan-files

# Скачать архив и распаковать конф
curl -O https://stepik.org/media/attachments/lesson/686238/jusan-dockerfile.conf
docker build -t nginx:jusan-dockerfile .

./tester-dockerfile.sh

18 changes: 18 additions & 0 deletions docker/dockerize/fastapi-final/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Используем официальный образ Python
FROM python:3.9-slim

# Устанавливаем рабочую директорию внутри контейнера
WORKDIR /app

# Копируем все файлы в рабочую директорию контейнера
COPY . /app

# Устанавливаем зависимости из requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Открываем порт 8080
EXPOSE 8080

# Команда для запуска FastAPI приложения (проверьте путь к вашему файлу, если нужно)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]

12 changes: 12 additions & 0 deletions docker/dockerize/fastapi-final/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
beautifulsoup4==4.10.0
click==8.1.7
colorama==0.4.6
fastapi==0.115.2
h11==0.14.0
idna==3.10
pydantic==2.9.2
pydantic_core==2.23.4
sniffio==1.3.1
starlette==0.40.0
typing_extensions==4.12.2
uvicorn==0.32.0
1 change: 1 addition & 0 deletions docker/dockerize/fastapi-final/txt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
что за прикол с созданием папок
6 changes: 6 additions & 0 deletions docker/dockerize/solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -O https://raw.githubusercontent.com/Rinotrihanna/TechOrda/main/docker/dockerize/fastapi-final/Dockerfile
curl -O https://raw.githubusercontent.com/Rinotrihanna/TechOrda/main/docker/dockerize/fastapi-final/requirements.txt
docker build -t jusan-fastapi-final:dockerized .
docker images
docker run -d -p 8080:8080 --name jusan-dockerize jusan-fastapi-final:dockerized

75 changes: 75 additions & 0 deletions nginx/nginx-auth/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
> root@user-asus:/etc/nginx# cat ./sites-available/default
server {
listen 8080;
server_name example.com;

location /secret_word {
# Возвращает строку jusan-nginx-ip со статусом 203
return 203 "jusan-nginx-ip";

# Разрешение доступа из диапазона 192.0.0.0/20, кроме 192.0.0.1
allow 192.0.0.0/20;
deny 192.0.0.1;

# Запрет для всех остальных
deny all;

# Установка заголовка Content-Type
add_header Content-Type text/plain;

}

location / {
root /var/www/html; # Путь к index.html
index index.html;
}

location /images {
auth_basic "Protected Area for Design";
auth_basic_user_file /etc/nginx/conf.d/passwd;
# Разархивируйте cats.zip в /var/www/html/cats
alias /var/www/html/cats;
autoindex on;
}

location /gifs {
auth_basic "Protected Area for Marketing";
auth_basic_user_file /etc/nginx/conf.d/passwd;
# Разархивируйте gifs.zip в /var/www/html/gifs
alias /var/www/html/gifs;
autoindex on;
}

# Запрет на доступ к другим путям для учетной записи design
location /restricted_design {
satisfy any;
deny all;
}

# Запрет на доступ к другим путям для учетной записи marketing
location /restricted_marketing {
satisfy any;
deny all;
}
}



> root@user-asus:/etc/nginx# nano ./sites-available/default
> root@user-asus:/etc/nginx# nginx -t
> nginx: [warn] conflicting server name "example.com" on 0.0.0.0:8080, ignored
> nginx: [warn] conflicting server name "jusan.kz" on 0.0.0.0:443, ignored
> nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
> nginx: configuration file /etc/nginx/nginx.conf test is successful
> root@user-asus:/etc/nginx# systemctl restart nginx
> root@user-asus:/etc/nginx# curl --user marketing:marketingP@ssword http://localhost:8080/gifs/
> <html>
> <head><title>Index of /gifs/</title></head>
> <body>
> <h1>Index of /gifs/</h1><hr><pre><a href="../">../</a>
> <a href="__MACOSX/">__MACOSX/</a> 27-Oct-2024 14:06 -
> <a href="dancing.gif">dancing.gif</a> 25-Mar-2022 11:20 253794
> <a href="jam.gif">jam.gif</a> 25-Mar-2022 11:20 471720
> <a href="sad.gif">sad.gif</a> 25-Mar-2022 11:21 3605836
> </pre><hr></body>
> </html>
2 changes: 2 additions & 0 deletions nginx/nginx-cert/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> root@user-asus:/etc/nginx# curl -H "Host: jusan.kz" -k https://localhost/secret_word
> jusan-nginx-certroot@user-asus:/etc/nginx#
9 changes: 9 additions & 0 deletions nginx/nginx-ip/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
> root@user-asus:/etc/nginx# curl -H "Host: example.com" -i http://localhost:8080/secret_word
> HTTP/1.1 203
> Server: nginx/1.18.0 (Ubuntu)
> Date: Sun, 17 Nov 2024 10:57:48 GMT
> Content-Type: application/octet-stream
> Content-Length: 14
> Connection: keep-alive

> jusan-nginx-iproot@user-asus:/etc/nginx#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions nginx/nginx-locations/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
jusan-nginx-iproot@user-asus:/etc/nginx# curl http://localhost:8080
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cats Page</title>
</head>

<body>
<p>
<h1>Cat with Flower</h1>
<img src="/images/flower.png" alt="flower">
</p>

<p>
<h1>Cat with Glasses</h1>
<img src="/images/glasses.png" alt="glasses">
</p>

<p>
<h1>Gray Cat</h1>
<img src="/images/gray-animal.jpeg" alt="gray-animal">
</p>

<p>
<h1>Cats mafia</h1>
<img src="/images/mafia.png" alt="mafia">
</p>

<p>
<h1>Sleepy Cat</h1>
<img src="/images/sleep.png" alt="sleep">
</p>
</body>

11 changes: 11 additions & 0 deletions nginx/nginx-proxy/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
location /api {
proxy_pass http://localhost:9090;
rewrite ^/api(/.*)?$ $1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header web-server 0;
}




25 changes: 25 additions & 0 deletions nginx/nginx-ufw/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<code>root@user-asus:/etc/nginx# ufw allow 80/tcp
Skipping adding existing rule
Skipping adding existing rule (v6)
root@user-asus:/etc/nginx# ufw allow 443/tcp
Skipping adding existing rule
Skipping adding existing rule (v6)
root@user-asus:/etc/nginx# ufw status
Status: active </code>
<code>
To Action From
-- ------ ----
22 ALLOW Anywhere
22/tcp ALLOW Anywhere
2222/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
2222/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
</code>



2 changes: 2 additions & 0 deletions postgres/sql-delete/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete from users
where name = 'serikbolat';
2 changes: 2 additions & 0 deletions postgres/sql-insert/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
insert into users (name, age, country, department)
values ('azatmukanov','40','GER','operations')
2 changes: 2 additions & 0 deletions postgres/sql-select/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
select name, age, department from users
where age < 30;
3 changes: 3 additions & 0 deletions postgres/sql-update/answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
update users
set department = 'sales', country = 'KZ'
where name ='azatmukanov';
Loading