Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprint2 #74

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
venv
venv
diagrams/.$task2_replica.drawio.bkp
diagrams/.$task2_cache.drawio.bkp
37 changes: 2 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,2 @@
# pymongo-api

## Как запустить

Запускаем mongodb и приложение

```shell
docker compose up -d
```

Заполняем mongodb данными

```shell
./scripts/mongo-init.sh
```

## Как проверить

### Если вы запускаете проект на локальной машине

Откройте в браузере http://localhost:8080

### Если вы запускаете проект на предоставленной виртуальной машине

Узнать белый ip виртуальной машины

```shell
curl --silent http://ifconfig.me
```

Откройте в браузере http://<ip виртуальной машины>:8080

## Доступные эндпоинты

Список доступных эндпоинтов, swagger http://<ip виртуальной машины>:8080/docs
Выполнить скрипт из папки /sharding-repl-cache/scripts/mongo-replica.sh
Финальная диаграма /diagrams/task5_cdn.drawio
35 changes: 35 additions & 0 deletions base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# pymongo-api

## Как запустить

Запускаем mongodb и приложение

```shell
docker compose up -d
```

Заполняем mongodb данными

```shell
./scripts/mongo-init.sh
```

## Как проверить

### Если вы запускаете проект на локальной машине

Откройте в браузере http://localhost:8080

### Если вы запускаете проект на предоставленной виртуальной машине

Узнать белый ip виртуальной машины

```shell
curl --silent http://ifconfig.me
```

Откройте в браузере http://<ip виртуальной машины>:8080

## Доступные эндпоинты

Список доступных эндпоинтов, swagger http://<ip виртуальной машины>:8080/docs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
165 changes: 165 additions & 0 deletions diagrams/.$task4_gate.drawio.bkp
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.2 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" version="25.0.2">
<diagram name="Page-1" id="-H_mtQnk-PTXWXPvYvuk">
<mxGraphModel dx="2459" dy="556" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ldAZnSqnsFahS3X7F4-J-9" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#A9C4EB;" parent="1" vertex="1">
<mxGeometry x="-370" y="10" width="1250" height="670" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="zA23MoTUsTF4_91t8viU-2" target="ldAZnSqnsFahS3X7F4-J-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zA23MoTUsTF4_91t8viU-2" value="configSrv" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#D4E1F5;" parent="1" vertex="1">
<mxGeometry x="650" y="304" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="zA23MoTUsTF4_91t8viU-3" value="pymongo-api" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="130" y="260" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zA23MoTUsTF4_91t8viU-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xM4dRxudCBXNGD_0VaCQ-2" target="ldAZnSqnsFahS3X7F4-J-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-1" target="ldAZnSqnsFahS3X7F4-J-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="ldAZnSqnsFahS3X7F4-J-1" target="ldAZnSqnsFahS3X7F4-J-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-1" value="mongos-router" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#C3ABD0;" parent="1" vertex="1">
<mxGeometry x="500" y="304" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-2" value="master&lt;br&gt;shard1" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#666666;" parent="1" vertex="1">
<mxGeometry x="500" y="430" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1;exitY=0.075;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-2" target="zA23MoTUsTF4_91t8viU-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.855;exitY=1;exitDx=0;exitDy=-4.35;exitPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-3" target="zA23MoTUsTF4_91t8viU-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-10" value="&lt;font style=&quot;font-size: 14px;&quot;&gt;Схема 4: Горизонтальное масштабирование API&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="-280" y="90" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-1" value="replica1" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#D5E8D4;" parent="1" vertex="1">
<mxGeometry x="370" y="500" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-2" value="replica2" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#D5E8D4;" parent="1" vertex="1">
<mxGeometry x="640" y="500" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-2" target="QaCJhuOAUpOFHOmXAA66-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-8" value="replication" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="QaCJhuOAUpOFHOmXAA66-3" vertex="1" connectable="0">
<mxGeometry x="-0.2711" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-2" target="QaCJhuOAUpOFHOmXAA66-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-7" value="replication" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="QaCJhuOAUpOFHOmXAA66-4" vertex="1" connectable="0">
<mxGeometry x="-0.3833" y="-3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-13" value="replica2" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#D5E8D4;" parent="1" vertex="1">
<mxGeometry x="590" y="100" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-14" value="replica1" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#D5E8D4;" parent="1" vertex="1">
<mxGeometry x="410" y="90" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.375;entryY=1.046;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-3" target="QaCJhuOAUpOFHOmXAA66-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-18" value="replication" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="QaCJhuOAUpOFHOmXAA66-15" vertex="1" connectable="0">
<mxGeometry x="-0.0573" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="ldAZnSqnsFahS3X7F4-J-3" target="QaCJhuOAUpOFHOmXAA66-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="QaCJhuOAUpOFHOmXAA66-17" value="replication" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="QaCJhuOAUpOFHOmXAA66-16" vertex="1" connectable="0">
<mxGeometry x="-0.2556" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ldAZnSqnsFahS3X7F4-J-3" value="master&lt;br&gt;shard2" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#666666;" parent="1" vertex="1">
<mxGeometry x="500" y="180" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="xM4dRxudCBXNGD_0VaCQ-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="zA23MoTUsTF4_91t8viU-3" target="xM4dRxudCBXNGD_0VaCQ-2" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="300" y="344" as="sourcePoint" />
<mxPoint x="500" y="344" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="xM4dRxudCBXNGD_0VaCQ-2" value="Redis" style="image;sketch=0;aspect=fixed;html=1;points=[];align=center;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;" parent="1" vertex="1">
<mxGeometry x="314.76" y="250" width="95.24" height="80" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="zToQ9waD5CxdV_l4G4co-1" target="zToQ9waD5CxdV_l4G4co-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-16" value="регистрация" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="zToQ9waD5CxdV_l4G4co-15" vertex="1" connectable="0">
<mxGeometry x="-0.4054" y="3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-1" value="pymongo-api" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="140" y="370" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="zToQ9waD5CxdV_l4G4co-3" target="zA23MoTUsTF4_91t8viU-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="zToQ9waD5CxdV_l4G4co-3" target="zToQ9waD5CxdV_l4G4co-1" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-280" y="450" />
<mxPoint x="200" y="450" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-3" value="APISIX gateway" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFFF99;" parent="1" vertex="1">
<mxGeometry x="-340" y="330" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FF0000;" parent="1" source="zToQ9waD5CxdV_l4G4co-4" target="zToQ9waD5CxdV_l4G4co-5" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-70" y="399" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-11" value="Получить список сервисов" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="zToQ9waD5CxdV_l4G4co-6" vertex="1" connectable="0">
<mxGeometry x="-0.0794" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-4" value="Consul-kv" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFFF99;" parent="1" vertex="1">
<mxGeometry x="-270" y="384" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-5" value="Consul" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFFF99;" parent="1" vertex="1">
<mxGeometry x="-130" y="290" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.25;entryDx=0;entryDy=0;" parent="1" source="zA23MoTUsTF4_91t8viU-3" target="zToQ9waD5CxdV_l4G4co-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zToQ9waD5CxdV_l4G4co-14" value="Регистрация" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="zToQ9waD5CxdV_l4G4co-12" vertex="1" connectable="0">
<mxGeometry x="-0.5283" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="FhT9d433LTxJO0WZvrI6-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zToQ9waD5CxdV_l4G4co-1" target="FhT9d433LTxJO0WZvrI6-1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="260" y="400" as="sourcePoint" />
<mxPoint x="378" y="345" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="FhT9d433LTxJO0WZvrI6-1" value="Redis" style="image;sketch=0;aspect=fixed;html=1;points=[];align=center;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;" vertex="1" parent="1">
<mxGeometry x="314.76" y="360" width="95.24" height="80" as="geometry" />
</mxCell>
<mxCell id="FhT9d433LTxJO0WZvrI6-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=1;entryDx=0;entryDy=-15;entryPerimeter=0;" edge="1" parent="1" source="FhT9d433LTxJO0WZvrI6-1" target="ldAZnSqnsFahS3X7F4-J-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading