@ -0,0 +1,298 @@ |
|||
# এনভায়রনমেন্ট ভেরিয়েবলস |
|||
|
|||
/// tip |
|||
|
|||
আপনি যদি "এনভায়রনমেন্ট ভেরিয়েবলস" কী এবং সেগুলো কীভাবে ব্যবহার করতে হয় সেটা জানেন, তাহলে এই অংশটি স্কিপ করে যেতে পারেন। |
|||
|
|||
/// |
|||
|
|||
এনভায়রনমেন্ট ভেরিয়েবল (সংক্ষেপে "**env var**" নামেও পরিচিত) হলো এমন একটি ভেরিয়েবল যা পাইথন কোডের **বাইরে**, **অপারেটিং সিস্টেমে** থাকে এবং আপনার পাইথন কোড (বা অন্যান্য প্রোগ্রাম) দ্বারা যাকে রিড করা যায়। |
|||
|
|||
এনভায়রনমেন্ট ভেরিয়েবলস অ্যাপ্লিকেশনের **সেটিংস** পরিচালনা করতে, পাইথনের **ইনস্টলেশন** প্রক্রিয়ার অংশ হিসেবে, ইত্যাদি কাজে উপযোগী হতে পারে। |
|||
|
|||
## Env Vars তৈরী এবং ব্যবহার |
|||
|
|||
আপনি **শেল (টার্মিনাল)**-এ, পাইথনের প্রয়োজন ছাড়াই, এনভায়রনমেন্ট ভেরিয়েবলস **তৈরি** এবং ব্যবহার করতে পারবেনঃ |
|||
|
|||
//// tab | লিনাক্স, ম্যাকওএস, উইন্ডোজ Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// আপনি চাইলে MY_NAME নামে একটি env var তৈরি করতে পারেন |
|||
$ export MY_NAME="Wade Wilson" |
|||
|
|||
// তারপরে এটিকে চাইলে অন্যান্য প্রোগ্রামে ব্যবহার করতে পারেন |
|||
$ echo "Hello $MY_NAME" |
|||
|
|||
Hello Wade Wilson |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | উইন্ডোজ পাওয়ারশেল |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// MY_NAME নামে env var তৈরি |
|||
$ $Env:MY_NAME = "Wade Wilson" |
|||
|
|||
// অন্যান্য প্রোগ্রামে এটিকে ব্যবহার |
|||
$ echo "Hello $Env:MY_NAME" |
|||
|
|||
Hello Wade Wilson |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
## পাইথনে env vars রিড করা |
|||
|
|||
আপনি চাইলে পাইথনের **বাইরে**, টার্মিনালে (বা অন্য কোনো উপায়ে) এনভায়রনমেন্ট ভেরিয়েবলস তৈরি করতে পারেন, এবং পরে সেগুলো **পাইথনে রিড** (অ্যাক্সেস করতে) পারেন। |
|||
|
|||
উদাহরণস্বরূপ, আপনার `main.py` নামে একটি ফাইল থাকতে পারেঃ |
|||
|
|||
```Python hl_lines="3" |
|||
import os |
|||
|
|||
name = os.getenv("MY_NAME", "World") |
|||
print(f"Hello {name} from Python") |
|||
``` |
|||
|
|||
/// tip |
|||
|
|||
<a href="https://docs.python.org/3.8/library/os.html#os.getenv" class="external-link" target="_blank">`os.getenv()`</a> এর দ্বিতীয় আর্গুমেন্টটি হলো এর ডিফল্ট ভ্যালু যা রিটার্ন করা হবে। |
|||
|
|||
যদি এটি দেওয়া না হয়, ডিফল্টভাবে `None` ব্যবহৃত হবে, এখানে আমরা ডিফল্ট ভ্যালু হিসেবে `"World"` ব্যবহার করেছি। |
|||
|
|||
/// |
|||
|
|||
তারপরে পাইথন প্রোগ্রামটিকে নিম্নোক্তভাবে কল করা যাবেঃ |
|||
|
|||
//// tab | লিনাক্স, ম্যাকওএস, উইন্ডোজ Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// এখনো আমরা এনভায়রনমেন্ট ভেরিয়েবল সেট করিনি |
|||
$ python main.py |
|||
|
|||
// যেহেতু env var সেট করা হয়নি, তাই আমরা ডিফল্ট ভ্যালু পাচ্ছি |
|||
|
|||
Hello World from Python |
|||
|
|||
// কিন্তু আমরা প্রথমে যদি একটা এনভায়রনমেন্ট ভারিয়েবল তৈরি করে নেই |
|||
$ export MY_NAME="Wade Wilson" |
|||
|
|||
// এবং তারপর আবার প্রোগ্রাটিকে কল করি |
|||
$ python main.py |
|||
|
|||
// এখন এটি এনভায়রনমেন্ট ভেরিয়েবল রিড করতে পারবে |
|||
|
|||
Hello Wade Wilson from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | উইন্ডোজ পাওয়ারশেল |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// এখনো আমরা এনভায়রনমেন্ট ভেরিয়েবল সেট করিনি |
|||
$ python main.py |
|||
|
|||
// যেহেতু env var সেট করা হয়নি, তাই আমরা ডিফল্ট ভ্যালু পাচ্ছি |
|||
|
|||
Hello World from Python |
|||
|
|||
// কিন্তু আমরা প্রথমে যদি একটা এনভায়রনমেন্ট ভারিয়েবল তৈরি করে নেই |
|||
$ $Env:MY_NAME = "Wade Wilson" |
|||
|
|||
// এবং তারপর আবার প্রোগ্রাটিকে কল করি |
|||
$ python main.py |
|||
|
|||
// এখন এটি এনভায়রনমেন্ট ভেরিয়েবল রিড করতে পারবে |
|||
|
|||
Hello Wade Wilson from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
যেহেতু এনভায়রনমেন্ট ভেরিয়েবলস কোডের বাইরে সেট করা যায়, কিন্তু পরবর্তীতে কোড দ্বারা রিড করা যায়, এবং বাকি ফাইলগুলোর সাথে রাখতে (`git` এ কমিট) হয় না, তাই কনফিগারেশনস বা **সেটিংস** এর জন্য এগুলো সাধারণত ব্যবহৃত হয়ে থাকে। |
|||
|
|||
আপনি একটি এনভায়রনমেন্ট ভেরিয়েবল শুধুমাত্র একটি **নির্দিষ্ট প্রোগ্রাম ইনভোকেশনের** জন্যও তৈরি করতে পারেন, যা শুধুমাত্র সেই প্রোগ্রামের জন্যই এভেইলেবল থাকবে এবং শুধুমাত্র তার চলাকালীন সময় পর্যন্তই সক্রিয় থাকবে। |
|||
|
|||
এটি করতে, প্রোগ্রামটি রান করার ঠিক আগেই, একই লাইনে এনভায়রনমেন্ট ভেরিয়েবল তৈরি করুন: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// প্রোগ্রামটি কল করার সময় একই লাইনে MY_NAME এনভায়রনমেন্ট ভেরিয়েবল তৈরি করুন |
|||
$ MY_NAME="Wade Wilson" python main.py |
|||
|
|||
// এখন এটি এনভায়রনমেন্ট ভ্যরিয়েবলটিকে রিড করতে পারবে |
|||
|
|||
Hello Wade Wilson from Python |
|||
|
|||
// পরবর্তীতে এনভায়রনমেন্ট ভেরিয়েবলটিকে আর ব্যবহার করা যাচ্ছে না |
|||
$ python main.py |
|||
|
|||
Hello World from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// tip |
|||
|
|||
এটি নিয়ে আরো বিস্তারিত পড়তে পারেন এখানে <a href="https://12factor.net/config" class="external-link" target="_blank">The Twelve-Factor App: Config</a>। |
|||
|
|||
/// |
|||
|
|||
## টাইপস এবং ভ্যালিডেশন |
|||
|
|||
এই এনভায়রনমেন্ট ভেরিয়েবলগুলো শুধুমাত্র **টেক্সট স্ট্রিংস** হ্যান্ডেল করতে পারে, যেহেতু এগুলো পাইথনের বাইরে অবস্থিত এবং অন্যান্য প্রোগ্রাম এবং সিস্টেমের বাকি অংশের (এমনকি বিভিন্ন অপারেটিং সিস্টেম যেমন লিনাক্স, উইন্ডোজ, ম্যাকওএস) সাথে সামঞ্জস্যপূর্ণ হতে হয়। |
|||
|
|||
এর অর্থ হচ্ছে পাইথনে এনভায়রনমেন্ট ভেরিয়েবল থেকে রিড করা **যেকোনো ভ্যালু** একটি `str` হবে, এবং অন্য কোনো টাইপে কনভার্সন বা যেকোনো ভেলিডেশন কোডে আলাদাভাবে করতে হবে। |
|||
|
|||
এনভায়রনমেন্ট ভেরিয়েবল ব্যবহার করে **এপ্লিকেশন সেটিংস** হ্যান্ডেল করা নিয়ে আরো বিস্তারিত জানা যাবে [Advanced User Guide - Settings and Environment Variables](./advanced/settings.md){.internal-link target=_blank}. |
|||
|
|||
## `PATH` এনভায়রনমেন্ট ভেরিয়েবল |
|||
|
|||
**`PATH`** নামে একটি **বিশেষ** এনভায়রনমেন্ট ভেরিয়েবল রয়েছে, যেটি প্রোগ্রাম রান করার জন্য অপারেটিং সিস্টেমস (লিনাক্স, ম্যাকওএস, উইন্ডোজ) দ্বারা ব্যবহৃত হয়। |
|||
|
|||
`PATH` ভেরিয়েবল এর ভ্যালু হচ্ছে একটি বিশাল স্ট্রিং যা ডিরেক্টরিকে কোলন `:` দিয়ে আলাদা করার মাধ্যমে লিনাক্সে ও ম্যাকওএস এ, এবং সেমিকোলন `;` এর মাধ্যমে উইন্ডোজ এ তৈরি করা থাকে। |
|||
|
|||
উদাহরণস্বরূপ, `PATH` ভেরিয়েবল নিচের মতো দেখতে হতে পারেঃ |
|||
|
|||
//// tab | লিনাক্স, ম্যাকওএস |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
তারমানে হলো সিস্টেম প্রোগ্রামগুলোকে নিচের ডিরেক্টরিগুলোতে খুঁজবেঃ |
|||
|
|||
* `/usr/local/bin` |
|||
* `/usr/bin` |
|||
* `/bin` |
|||
* `/usr/sbin` |
|||
* `/sbin` |
|||
|
|||
//// |
|||
|
|||
//// tab | উইন্ডোজ |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32 |
|||
``` |
|||
|
|||
তারমানে হলো সিস্টেম প্রোগ্রামগুলোকে নিচের ডিরেক্টরিগুলোতে খুঁজবেঃ |
|||
|
|||
* `C:\Program Files\Python312\Scripts` |
|||
* `C:\Program Files\Python312` |
|||
* `C:\Windows\System32` |
|||
|
|||
//// |
|||
|
|||
যখন আপনি টার্মিনালে কোনো **কমান্ড** লিখবেন, অপারেটিং সিস্টেম **প্রত্যেকটি ডিরেক্টরিতে** প্রোগ্রামটি **খুঁজবে** যেগুলো `PATH` এনভায়রনমেন্ট ভেরিয়েবল এ লিস্ট করা আছে। |
|||
|
|||
উদাহরণস্বরূপ, যখন আপনি টার্মিনালে `python` টাইপ করবেন, অপারেটিং সিস্টেম এই লিস্ট এর **প্রথম ডিরেক্টরিতে** `python` নামের একটি প্রোগ্রাম খুঁজবে। |
|||
|
|||
যদি এটি খুঁজে পায়, তাহলে এটি প্রোগ্রামটিকে ব্যবহার করবে। অন্যথায় এটি **অন্যান্য ডিরেক্টরিগুলোতে** এটিকে খুঁজতে থাকবে। |
|||
|
|||
### পাইথন ইনস্টল এবং `PATH` আপডেট |
|||
|
|||
যখন আপনি পাইথন ইনস্টল করেন, আপনি `PATH` এনভায়রনমেন্ট ভেরিয়েবল আপডেট করতে চান কিনা সেটা জিজ্ঞেস করা হতে পারে। |
|||
|
|||
//// tab | লিনাক্স, ম্যাকওএস |
|||
|
|||
ধরা যাক আপনি পাইথন ইনস্টল করলেন এবং এটি `/opt/custompython/bin` ডিরেক্টরিতে ইনস্টল হচ্ছে। |
|||
|
|||
যদি আপনি "Yes" সিলেক্ট করে `PATH` এনভায়রনমেন্ট ভেরিয়েবল আপডেট করতে চান, তাহলে ইনস্টলার `/opt/custompython/bin` কে `PATH` এনভায়রনমেন্ট ভেরিয়েবল এ এড করে দিবে। |
|||
|
|||
এটা দেখতে এমনটা হতে পারেঃ |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/custompython/bin |
|||
``` |
|||
|
|||
এইভাবে, আপনি যখন টার্মিনালে `python` টাইপ করেন, সিস্টেম পাইথন প্রোগ্রামটিকে `/opt/custompython/bin` (সর্বশেষ ডিরেক্টরি) তে খুঁজে পাবে এবং এটাকে ব্যবহার করবে। |
|||
|
|||
//// |
|||
|
|||
//// tab | উইন্ডোজ |
|||
|
|||
ধরা যাক আপনি পাইথন ইনস্টল করলেন এবং এটি `C:\opt\custompython\bin` ডিরেক্টরিতে ইনস্টল হচ্ছে। |
|||
|
|||
যদি আপনি "Yes" সিলেক্ট করে `PATH` এনভায়রনমেন্ট ভেরিয়েবল আপডেট করতে চান, তাহলে ইনস্টলার `C:\opt\custompython\bin` কে `PATH` এনভায়রনমেন্ট ভেরিয়েবল এ এড করে দিবে। |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32;C:\opt\custompython\bin |
|||
``` |
|||
|
|||
এইভাবে, আপনি যখন টার্মিনালে `python` টাইপ করেন, সিস্টেম পাইথন প্রোগ্রামটিকে `C:\opt\custompython\bin` (সর্বশেষ ডিরেক্টরি) তে খুঁজে পাবে এবং এটাকে ব্যবহার করবে। |
|||
|
|||
//// |
|||
|
|||
তাই, আপনি যদি টাইপ করেনঃ |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// tab | লিনাক্স, ম্যাকওএস |
|||
|
|||
সিস্টেম `python` প্রোগ্রামকে `/opt/custompython/bin` এ **খুঁজে পাবে** এবং এটাকে রান করবে। |
|||
|
|||
এটা মোটামুটিভাবে নিচের মতো করে লেখার সমান হবেঃ |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ /opt/custompython/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | উইন্ডোজ |
|||
|
|||
সিস্টেম `python` প্রোগ্রামকে `C:\opt\custompython\bin\python` এ **খুঁজে পাবে** এবং এটাকে রান করবে। |
|||
|
|||
এটা মোটামুটিভাবে নিচের মতো করে লেখার সমান হবেঃ |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ C:\opt\custompython\bin\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
এই তথ্যগুলো [ভার্চুয়াল এনভায়রনমেন্টস](virtual-environments.md){.internal-link target=_blank} শেখার ক্ষেত্রে সহায়ক হবে। |
|||
|
|||
## উপসংহার |
|||
|
|||
এর মাধ্যমে আপনি **এনভায়রনমেন্ট ভেরিয়েবলস** কি এবং এটিকে পাইথনে কিভাবে ব্যবহার করতে হয় তার সম্পর্কে বেসিক ধারনা পেলেন। |
|||
|
|||
চাইলে এই সম্পর্কে আরো বিস্তারিত পড়তে পারেন <a href="https://en.wikipedia.org/wiki/Environment_variable" class="external-link" target="_blank">Wikipedia for Environment Variable</a> এ। |
|||
|
|||
অনেক ক্ষেত্রে, দেখা মাত্রই এনভায়রনমেন্ট ভেরিয়েবল কীভাবে প্রয়োজন হবে তা স্পষ্ট হয় না। কিন্তু ডেভেলপমেন্টের সময় আপনি নানা রকম পরিস্থিতিতে এগুলোর সম্মুখীন হবেন, তাই এগুলো সম্পর্কে জেনে রাখা ভালো। |
|||
|
|||
উদাহরণস্বরূপ, আপনার এই ইনফরমেশনটি পরবর্তী, [ভার্চুয়াল এনভায়রনমেন্টস](virtual-environments.md) অংশে দরকার হবে। |
@ -1,106 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="BkDNbdtn8_9fWQybnc8v" name="Page-1"> |
|||
<mxGraphModel dx="741" dy="1167" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="420" y="280" width="920" height="670" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="755" y="290" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="1110" y="410" width="190" height="500" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">RAM<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="1166.92" y="420" width="76.16" height="30" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="9" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="470" y="410" width="250" height="500" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="10" value="<font style="font-size: 24px" face="Roboto">CPU<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="554.61" y="420" width="80.77" height="30" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" source="11" target="12" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" source="11" target="13" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="820" y="525" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;endArrow=none;endFill=0;" parent="1" source="11" target="17" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="11" target="18" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="11" value="<font face="roboto"><span style="font-size: 24px">Process&nbsp;</span></font><span style="font-family: &#34;roboto&#34; ; font-size: 24px">Manager</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1"> |
|||
<mxGeometry x="780" y="420" width="250" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="12" target="23" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="12" value="<font face="roboto"><span style="font-size: 24px">Worker Process</span></font>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="840" y="540" width="240" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="13" target="24" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="13" target="22" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="775" y="710"/> |
|||
<mxPoint x="775" y="688"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="13" value="<font face="roboto"><span style="font-size: 24px">Worker Process</span></font>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1"> |
|||
<mxGeometry x="840" y="660" width="240" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="16" target="27" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="16" target="30" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="16" value="<font face="roboto"><span style="font-size: 24px">Another Process</span></font>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="780" y="790" width="250" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="17" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#d5e8d4;strokeColor=#82b366;dashed=1;" parent="1" vertex="1"> |
|||
<mxGeometry x="480" y="458" width="230" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="18" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1"> |
|||
<mxGeometry x="1130" y="460" width="150" height="20" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="21" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#fff2cc;strokeColor=#d6b656;dashed=1;" parent="1" vertex="1"> |
|||
<mxGeometry x="480" y="508" width="230" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="22" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#e1d5e7;strokeColor=#9673a6;dashed=1;" parent="1" vertex="1"> |
|||
<mxGeometry x="480" y="618" width="230" height="140" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="23" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">1 GB</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="1130" y="490" width="150" height="150" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="24" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">1 GB</font>" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1"> |
|||
<mxGeometry x="1130" y="650" width="150" height="150" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="27" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;dashed=1;" parent="1" vertex="1"> |
|||
<mxGeometry x="480" y="768" width="230" height="50" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="30" value="" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="1130" y="810" width="150" height="50" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 16 KiB |
@ -1,277 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="3321" dy="2867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" vertex="1" parent="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" vertex="1" parent="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" edge="1" parent="1" target="14"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" edge="1" parent="1" target="17"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" vertex="1" connectable="0" parent="1"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" vertex="1" parent="33"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" vertex="1" parent="33"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="101" target="32"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" vertex="1" parent="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;" edge="1" parent="1" source="55" target="49"> |
|||
<mxGeometry relative="1" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;startArrow=none;" edge="1" parent="1" source="102" target="57"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="410" y="400" as="targetPoint"/> |
|||
<mxPoint x="585" y="1050" as="sourcePoint"/> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="55" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">Cert Renovation Program</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="515" y="780" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;strokeWidth=3;startArrow=none;" edge="1" parent="1" source="103" target="55"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="875" y="1030" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="790" y="930"/> |
|||
<mxPoint x="790" y="930"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="57" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Let's Encrypt</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="500" y="1150" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="85" target="6"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="82" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="62" target="78"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="920" y="770"/> |
|||
<mxPoint x="920" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="62" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">FastAPI</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal"> app for: someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="890" y="650" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="65" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">Another app</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">: another.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="890" y="50" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="66" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">One more app</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">: onemore.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="890" y="180" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="78" value="<font face="Roboto"><span style="font-size: 24px ; font-weight: 400">A Database</span></font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1"> |
|||
<mxGeometry x="890" y="780" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="80" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;strokeWidth=3;endArrow=none;" edge="1" parent="1" source="57" target="103"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="480" y="1090" as="sourcePoint"/> |
|||
<mxPoint x="875" y="1110" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="915" y="1250"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="81" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;endArrow=none;" edge="1" parent="1" source="55" target="102"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="525" y="970" as="targetPoint"/> |
|||
<mxPoint x="550" y="880" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="525" y="930"/> |
|||
<mxPoint x="525" y="930"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="85" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Plain response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" vertex="1" parent="1"> |
|||
<mxGeometry x="890" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="86" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="62" target="85"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="1030.0000000000005" y="649.9999999999995" as="sourcePoint"/> |
|||
<mxPoint x="850" y="540.0000000000005" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="1030" y="540"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="87" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="84" target="62"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="1240" y="390"/> |
|||
<mxPoint x="1240" y="700"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" edge="1" parent="1" source="100" target="34"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" edge="1" parent="1" source="32" target="100"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-80"/> |
|||
<mxPoint x="-5" y="-80"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="34" target="101"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="109" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="97" target="32"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="340" y="480"/> |
|||
<mxPoint x="340" y="480"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" edge="1" parent="1" source="96" target="36"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="32" target="96"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" vertex="1" parent="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="102" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Renew HTTPS cert for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="430" y="960" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="103" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">New HTTPS cert for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="750" y="1070" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" edge="1" parent="1" source="104" target="36"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="32" target="104"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="97" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" vertex="1" parent="1"> |
|||
<mxGeometry x="90" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="110" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="36" target="97"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="415" y="680" as="sourcePoint"/> |
|||
<mxPoint x="110" y="275" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="245" y="710"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" vertex="1" parent="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" vertex="1" parent="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" vertex="1" parent="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="84" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Decrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" vertex="1" parent="1"> |
|||
<mxGeometry x="885" y="350" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="111" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" edge="1" parent="1" source="6" target="84"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="850" y="390" as="sourcePoint"/> |
|||
<mxPoint x="1190" y="700" as="targetPoint"/> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 647 KiB |
Before Width: | Height: | Size: 40 KiB |
@ -1,78 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="2738" dy="2173" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-10" y="-120"/> |
|||
<mxPoint x="-10" y="-120"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB |
@ -1,110 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="2481" dy="1867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 15 KiB |
@ -1,131 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="2481" dy="1867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 21 KiB |
@ -1,152 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="2312" dy="1667" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="96" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="96" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 23 KiB |
@ -1,166 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="5190" dy="5090" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="62" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">FastAPI</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal"> app for: someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="640" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="87" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="6" target="62" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="1240" y="390"/> |
|||
<mxPoint x="1240" y="700"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="84" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Decrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="350" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-80"/> |
|||
<mxPoint x="-5" y="-80"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="96" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="96" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 624 KiB |
Before Width: | Height: | Size: 26 KiB |
@ -1,183 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="3321" dy="2867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="85" target="6" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="62" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">FastAPI</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal"> app for: someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="650" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="85" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Plain response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="86" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="62" target="85" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="1030.0000000000005" y="649.9999999999995" as="sourcePoint"/> |
|||
<mxPoint x="850" y="540.0000000000005" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="1030" y="540"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="87" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="6" target="62" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="1240" y="390"/> |
|||
<mxPoint x="1240" y="700"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="84" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Decrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="350" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="96" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="96" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 627 KiB |
Before Width: | Height: | Size: 27 KiB |
@ -1,203 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="3321" dy="2867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="85" target="6" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="62" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">FastAPI</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal"> app for: someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="650" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="85" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Plain response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="86" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="62" target="85" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="1030.0000000000005" y="649.9999999999995" as="sourcePoint"/> |
|||
<mxPoint x="850" y="540.0000000000005" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="1030" y="540"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="87" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="6" target="62" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="1240" y="390"/> |
|||
<mxPoint x="1240" y="700"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="84" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Decrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="350" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="109" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="97" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="340" y="480"/> |
|||
<mxPoint x="340" y="480"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="96" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="96" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="97" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" parent="1" vertex="1"> |
|||
<mxGeometry x="90" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="110" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="36" target="97" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="415" y="680" as="sourcePoint"/> |
|||
<mxPoint x="110" y="275" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="245" y="710"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 29 KiB |
@ -1,217 +0,0 @@ |
|||
<mxfile host="65bd71144e"> |
|||
<diagram id="jyERGzDynktFHFRGN0ph" name="Page-1"> |
|||
<mxGraphModel dx="3321" dy="2867" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="450" y="-50" width="820" height="970" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font face="Roboto"><span style="font-size: 24px">Server(s)</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="710" y="-50" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;exitX=0.092;exitY=1.01;exitDx=0;exitDy=0;dashed=1;exitPerimeter=0;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="521"/> |
|||
<mxPoint x="800" y="560"/> |
|||
</Array> |
|||
<mxPoint x="803" y="521" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=3;dashed=1;" parent="1" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="800" y="520" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="800" y="680"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="33" value="" style="group" parent="1" vertex="1" connectable="0"> |
|||
<mxGeometry x="-140" y="-75" width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="29" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">https://someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="33" vertex="1"> |
|||
<mxGeometry x="60" y="27" width="380" height="250" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="32" value="" style="pointerEvents=1;shadow=0;dashed=0;html=1;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.devices.laptop;strokeColor=none;" parent="33" vertex="1"> |
|||
<mxGeometry width="500" height="350" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="90" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="101" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="390" y="-190" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-132"/> |
|||
<mxPoint x="280" y="-132"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="34" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">DNS Servers</font>" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-60" y="-540" width="330" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="495" y="320" width="355" height="440" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">TLS Termination Proxy<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="525" y="330" width="280" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="73" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="85" target="6" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="82" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;entryX=0.073;entryY=0.01;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.075;exitY=0.998;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="62" target="78" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="917" y="754" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="62" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">FastAPI</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal"> app for: someapp.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="650" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="65" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">Another app</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">: another.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="50" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="66" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">One more app</font><font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px ; font-weight: normal">: onemore.example.com</font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="180" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="78" value="<font face="Roboto"><span style="font-size: 24px ; font-weight: 400">A Database</span></font>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1"> |
|||
<mxGeometry x="895" y="780" width="300" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="85" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Plain response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="86" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="62" target="85" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="1030.0000000000005" y="649.9999999999995" as="sourcePoint"/> |
|||
<mxPoint x="850" y="540.0000000000005" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="1030" y="540"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="87" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="6" target="62" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="1240" y="390"/> |
|||
<mxPoint x="1240" y="700"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="84" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Decrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="890" y="350" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="100" target="34" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="65.05882352941171" y="-220" as="sourcePoint"/> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="89" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;dashed=1;" parent="1" source="32" target="100" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="110" y="-75" as="sourcePoint"/> |
|||
<mxPoint x="-4.941176470588289" y="-139.99999999999955" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-5" y="-90"/> |
|||
<mxPoint x="-5" y="-90"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="91" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="34" target="101" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="105" y="-280" as="sourcePoint"/> |
|||
<mxPoint x="390" y="-260" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="390" y="-430"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="109" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="97" target="32" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="340" y="480"/> |
|||
<mxPoint x="340" y="480"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="36" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto" style="font-size: 24px">Port 443 (HTTPS)</font>" style="ellipse;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="330" y="680" width="170" height="120" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=classic;endFill=1;strokeWidth=3;" parent="1" source="96" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="50" y="500" as="sourcePoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="50" y="740"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="96" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="300" y="350" as="sourcePoint"/> |
|||
<mxPoint x="55" y="330" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="160" y="340"/> |
|||
<mxPoint x="160" y="340"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="96" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted request for: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#82b366;strokeWidth=3;fillColor=#d5e8d4;" parent="1" vertex="1"> |
|||
<mxGeometry x="-10" y="400" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="100" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Who is: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="-210" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="101" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">IP:</span><br style="font-family: &#34;roboto&#34;"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">123.124.125.126</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="270" y="-290" width="240" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="106" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=0;strokeWidth=3;" parent="1" source="104" target="36" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="770"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="104" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">TLS Handshake</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="-110" y="300" width="230" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="107" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="32" target="104" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="-40" y="275" as="sourcePoint"/> |
|||
<mxPoint x="341.38784067832285" y="770" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="-40" y="290"/> |
|||
<mxPoint x="-40" y="290"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="97" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Encrypted response from: someapp.example.com</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#9673a6;strokeWidth=3;fillColor=#e1d5e7;" parent="1" vertex="1"> |
|||
<mxGeometry x="90" y="500" width="310" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="110" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;startArrow=none;startFill=0;endArrow=none;endFill=1;strokeWidth=3;" parent="1" source="36" target="97" edge="1"> |
|||
<mxGeometry relative="1" as="geometry"> |
|||
<mxPoint x="415" y="680" as="sourcePoint"/> |
|||
<mxPoint x="110" y="275" as="targetPoint"/> |
|||
<Array as="points"> |
|||
<mxPoint x="245" y="710"/> |
|||
</Array> |
|||
</mxGeometry> |
|||
</mxCell> |
|||
<mxCell id="49" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1"> |
|||
<mxGeometry x="510" y="400" width="310" height="320" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="50" value="<font style="font-size: 24px" face="Roboto">HTTPS certificates<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="550.9" y="410" width="228.21" height="40" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="51" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">someapp.example.com</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="465" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="52" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">another.example.net</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="545" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="53" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">onemore.example.org</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#666666;strokeWidth=3;fillColor=#f5f5f5;fontColor=#333333;" parent="1" vertex="1"> |
|||
<mxGeometry x="530" y="625" width="270" height="70" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="42" value="<font face="Roboto" data-font-src="https://fonts.googleapis.com/css?family=Roboto"><span style="font-size: 24px">IP:</span><br><span style="font-size: 24px">123.124.125.126</span><br></font>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#000000;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="290" y="600" width="220" height="70" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 10 KiB |
@ -1,43 +0,0 @@ |
|||
<mxfile host="65bd71144e" modified="2020-11-28T18:13:19.199Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.51.1 Chrome/83.0.4103.122 Electron/9.3.3 Safari/537.36" etag="KPHuXUeExV3PdWouu_3U" version="13.6.5"> |
|||
<diagram id="zB4-QXJZ7ScUzHSLnJ1i" name="Page-1"> |
|||
<mxGraphModel dx="1154" dy="780" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1200" math="0" shadow="0" extFonts="Roboto^https://fonts.googleapis.com/css?family=Roboto|Roboto Mono, mono^https://fonts.googleapis.com/css?family=Roboto+Mono%2C+mono"> |
|||
<root> |
|||
<mxCell id="0"/> |
|||
<mxCell id="1" parent="0"/> |
|||
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="110" y="280" width="1350" height="620" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="3" value="<font style="font-size: 24px" face="Roboto">Package app<br>app/__init__.py</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="635" y="310" width="300" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="15" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Module app.main</span><br style="font-family: &#34;roboto&#34; ; font-size: 24px"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/main.py</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="140" y="430" width="360" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="16" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Module app.dependencies</span><br style="font-family: &#34;roboto&#34; ; font-size: 24px"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/dependencies.py</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="130" y="565" width="370" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="5" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="1030" y="430" width="400" height="260" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="8" value="<font style="font-size: 24px" face="Roboto">Subpackage app.internal<br></font><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/internal/__init__.py</span><font style="font-size: 24px" face="Roboto"><br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="1083.8438461538462" y="460" width="292.3076923076923" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="19" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Module app.internal.admin</span><br style="font-family: &#34;roboto&#34; ; font-size: 24px"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/internal/admin.py</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="1050" y="570" width="360" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="4" value="" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;strokeWidth=4;" parent="1" vertex="1"> |
|||
<mxGeometry x="540" y="430" width="440" height="410" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="7" value="<font style="font-size: 24px" face="Roboto">Subpackage app.routers<br>app/routers/__init__.py<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;strokeWidth=3;fontFamily=Roboto Mono, mono;FType=g;" parent="1" vertex="1"> |
|||
<mxGeometry x="599.2307692307693" y="460" width="321.53846153846155" height="80" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="17" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Module app.routers.items</span><br style="font-family: &#34;roboto&#34; ; font-size: 24px"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/routers/items.py</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="580" y="570" width="360" height="100" as="geometry"/> |
|||
</mxCell> |
|||
<mxCell id="18" value="<span style="font-family: &#34;roboto&#34; ; font-size: 24px">Module app.routers.users</span><br style="font-family: &#34;roboto&#34; ; font-size: 24px"><span style="font-family: &#34;roboto&#34; ; font-size: 24px">app/routers/users.py</span>" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;strokeWidth=3;" parent="1" vertex="1"> |
|||
<mxGeometry x="580" y="700" width="360" height="100" as="geometry"/> |
|||
</mxCell> |
|||
</root> |
|||
</mxGraphModel> |
|||
</diagram> |
|||
</mxfile> |
After Width: | Height: | Size: 604 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -0,0 +1,5 @@ |
|||
# یادگیری |
|||
|
|||
اینجا بخشهای مقدماتی و آموزشهایی هستن که برای یادگیری **FastAPI** بهت کمک میکنن. |
|||
|
|||
میتونی اینو یه **کتاب**، یه **دوره آموزشی**، یا راه **رسمی** و پیشنهادی برای یادگیری FastAPI در نظر بگیری. 😎 |
@ -1,53 +1,165 @@ |
|||
# 이벤트: startup과 shutdown |
|||
# Lifespan 이벤트 |
|||
|
|||
필요에 따라 응용 프로그램이 시작되기 전이나 종료될 때 실행되는 이벤트 핸들러(함수)를 정의할 수 있습니다. |
|||
애플리케이션 **시작 전**에 실행되어야 하는 로직(코드)을 정의할 수 있습니다. 이는 이 코드가 **한 번**만 실행되며, **애플리케이션이 요청을 받기 시작하기 전**에 실행된다는 의미입니다. |
|||
|
|||
이 함수들은 `async def` 또는 평범하게 `def`으로 선언할 수 있습니다. |
|||
마찬가지로, 애플리케이션이 **종료될 때** 실행되어야 하는 로직(코드)을 정의할 수 있습니다. 이 경우, 이 코드는 **한 번**만 실행되며, **여러 요청을 처리한 후**에 실행됩니다. |
|||
|
|||
이 코드가 애플리케이션이 **요청을 받기 시작하기 전에** 실행되고, 요청 처리가 끝난 후 **종료 직전에** 실행되기 때문에 전체 애플리케이션의 **수명(Lifespan)**을 다룹니다. (잠시 후 "수명"이라는 단어가 중요해집니다 😉) |
|||
|
|||
이 방법은 전체 애플리케이션에서 사용해야 하는 **자원**을 설정하거나 요청 간에 **공유되는** 자원을 설정하고, 또는 그 후에 **정리**하는 데 매우 유용할 수 있습니다. 예를 들어, 데이터베이스 연결 풀 또는 공유되는 머신러닝 모델을 로드하는 경우입니다. |
|||
|
|||
|
|||
## 사용 사례 |
|||
|
|||
먼저 **사용 사례**를 예로 들어보고, 이를 어떻게 해결할 수 있는지 살펴보겠습니다. |
|||
|
|||
우리가 요청을 처리하기 위해 사용하고 싶은 **머신러닝 모델**이 있다고 상상해 봅시다. 🤖 |
|||
|
|||
이 모델들은 요청 간에 공유되므로, 요청마다 모델이 하나씩 있는 것이 아니라, 여러 요청에서 동일한 모델을 사용합니다. |
|||
|
|||
모델을 로드하는 데 **상당한 시간이 걸린다고 상상해 봅시다**, 왜냐하면 모델이 **디스크에서 많은 데이터를 읽어야** 하기 때문입니다. 따라서 모든 요청에 대해 모델을 매번 로드하고 싶지 않습니다. |
|||
|
|||
모듈/파일의 최상위에서 모델을 로드할 수도 있지만, 그러면 **모델을 로드하는데** 시간이 걸리기 때문에, 단순한 자동화된 테스트를 실행할 때도 모델이 로드될 때까지 기다려야 해서 **테스트 속도가 느려집니다**. |
|||
|
|||
이 문제를 해결하려고 하는 것입니다. 요청을 처리하기 전에 모델을 로드하되, 애플리케이션이 요청을 받기 시작하기 직전에만 로드하고, 코드가 로드되는 동안은 로드하지 않도록 하겠습니다. |
|||
|
|||
## Lifespan |
|||
|
|||
`FastAPI` 애플리케이션의 `lifespan` 매개변수와 "컨텍스트 매니저"를 사용하여 *시작*과 *종료* 로직을 정의할 수 있습니다. (컨텍스트 매니저가 무엇인지 잠시 후에 설명드리겠습니다.) |
|||
|
|||
예제를 통해 시작하고, 그 후에 자세히 살펴보겠습니다. |
|||
|
|||
우리는 `yield`를 사용하여 비동기 함수 `lifespan()`을 다음과 같이 생성합니다: |
|||
|
|||
{* ../../docs_src/events/tutorial003.py hl[16,19] *} |
|||
|
|||
여기서 우리는 모델을 로드하는 비싼 *시작* 작업을 시뮬레이션하고 있습니다. `yield` 앞에서 (가짜) 모델 함수를 머신러닝 모델이 담긴 딕셔너리에 넣습니다. 이 코드는 **애플리케이션이 요청을 받기 시작하기 전**, *시작* 동안에 실행됩니다. |
|||
|
|||
그리고 `yield` 직후에는 모델을 언로드합니다. 이 코드는 **애플리케이션이 요청 처리 완료 후**, *종료* 직전에 실행됩니다. 예를 들어, 메모리나 GPU와 같은 자원을 해제하는 작업을 할 수 있습니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
`shutdown`은 애플리케이션을 **종료**할 때 발생합니다. |
|||
|
|||
새로운 버전을 시작해야 하거나, 그냥 실행을 멈추고 싶을 수도 있습니다. 🤷 |
|||
|
|||
/// |
|||
|
|||
### Lifespan 함수 |
|||
|
|||
먼저 주목할 점은, `yield`를 사용하여 비동기 함수(async function)를 정의하고 있다는 것입니다. 이는 `yield`를 사용한 의존성과 매우 유사합니다. |
|||
|
|||
{* ../../docs_src/events/tutorial003.py hl[14:19] *} |
|||
|
|||
함수의 첫 번째 부분, 즉 `yield` 이전의 코드는 애플리케이션이 시작되기 **전에** 실행됩니다. |
|||
|
|||
그리고 `yield` 이후의 부분은 애플리케이션이 완료된 후 **나중에** 실행됩니다. |
|||
|
|||
### 비동기 컨텍스트 매니저 |
|||
|
|||
함수를 확인해보면, `@asynccontextmanager`로 장식되어 있습니다. |
|||
|
|||
이것은 함수를 "**비동기 컨텍스트 매니저**"라고 불리는 것으로 변환시킵니다. |
|||
|
|||
{* ../../docs_src/events/tutorial003.py hl[1,13] *} |
|||
|
|||
파이썬에서 **컨텍스트 매니저**는 `with` 문에서 사용할 수 있는 것입니다. 예를 들어, `open()`은 컨텍스트 매니저로 사용할 수 있습니다: |
|||
|
|||
```Python |
|||
with open("file.txt") as file: |
|||
file.read() |
|||
``` |
|||
최근 버전의 파이썬에서는 **비동기 컨텍스트 매니저**도 있습니다. 이를 `async with`와 함께 사용합니다: |
|||
|
|||
```Python |
|||
async with lifespan(app): |
|||
await do_stuff() |
|||
``` |
|||
|
|||
컨텍스트 매니저나 위와 같은 비동기 컨텍스트 매니저를 만들면, `with` 블록에 들어가기 전에 `yield` 이전의 코드가 실행되고, `with` 블록을 벗어난 후에는 `yield` 이후의 코드가 실행됩니다. |
|||
|
|||
위의 코드 예제에서는 직접 사용하지 않고, FastAPI에 전달하여 사용하도록 합니다. |
|||
|
|||
`FastAPI` 애플리케이션의 `lifespan` 매개변수는 **비동기 컨텍스트 매니저**를 받기 때문에, 새로운 `lifespan` 비동기 컨텍스트 매니저를 FastAPI에 전달할 수 있습니다. |
|||
|
|||
{* ../../docs_src/events/tutorial003.py hl[22] *} |
|||
|
|||
## 대체 이벤트 (사용 중단) |
|||
|
|||
/// warning | 경고 |
|||
|
|||
이벤트 핸들러는 주 응용 프로그램에서만 작동합니다. [하위 응용 프로그램 - 마운트](./sub-applications.md){.internal-link target=_blank}에서는 작동하지 않습니다. |
|||
*시작*과 *종료*를 처리하는 권장 방법은 위에서 설명한 대로 `FastAPI` 애플리케이션의 `lifespan` 매개변수를 사용하는 것입니다. `lifespan` 매개변수를 제공하면 `startup`과 `shutdown` 이벤트 핸들러는 더 이상 호출되지 않습니다. `lifespan`을 사용할지, 모든 이벤트를 사용할지 선택해야 하며 둘 다 사용할 수는 없습니다. |
|||
|
|||
이 부분은 건너뛰셔도 좋습니다. |
|||
|
|||
/// |
|||
|
|||
## `startup` 이벤트 |
|||
*시작*과 *종료* 동안 실행될 이 로직을 정의하는 대체 방법이 있습니다. |
|||
|
|||
애플리케이션이 시작되기 전에 또는 종료될 때 실행해야 하는 이벤트 핸들러(함수)를 정의할 수 있습니다. |
|||
|
|||
응용 프로그램을 시작하기 전에 실행하려는 함수를 "startup" 이벤트로 선언합니다: |
|||
이 함수들은 `async def` 또는 일반 `def`로 선언할 수 있습니다. |
|||
|
|||
### `startup` 이벤트 |
|||
|
|||
애플리케이션이 시작되기 전에 실행되어야 하는 함수를 추가하려면, `"startup"` 이벤트로 선언합니다: |
|||
|
|||
{* ../../docs_src/events/tutorial001.py hl[8] *} |
|||
|
|||
이 경우 `startup` 이벤트 핸들러 함수는 단순히 몇 가지 값으로 구성된 `dict` 형식의 "데이터베이스"를 초기화합니다. |
|||
이 경우, `startup` 이벤트 핸들러 함수는 "database"라는 항목(단지 `dict`)을 일부 값으로 초기화합니다. |
|||
|
|||
하나 이상의 이벤트 핸들러 함수를 추가할 수도 있습니다. |
|||
여러 개의 이벤트 핸들러 함수를 추가할 수 있습니다. |
|||
|
|||
그리고 응용 프로그램은 모든 `startup` 이벤트 핸들러가 완료될 때까지 요청을 받지 않습니다. |
|||
애플리케이션은 모든 `startup` 이벤트 핸들러가 완료될 때까지 요청을 받기 시작하지 않습니다. |
|||
|
|||
## `shutdown` 이벤트 |
|||
### `shutdown` 이벤트 |
|||
|
|||
응용 프로그램이 종료될 때 실행하려는 함수를 추가하려면 `"shutdown"` 이벤트로 선언합니다: |
|||
애플리케이션이 종료될 때 실행되어야 하는 함수를 추가하려면, `"shutdown"` 이벤트로 선언합니다: |
|||
|
|||
{* ../../docs_src/events/tutorial002.py hl[6] *} |
|||
|
|||
이 예제에서 `shutdown` 이벤트 핸들러 함수는 `"Application shutdown"`이라는 텍스트가 적힌 `log.txt` 파일을 추가할 것입니다. |
|||
여기서, `shutdown` 이벤트 핸들러 함수는 `"Application shutdown"`이라는 텍스트를 `log.txt` 파일에 기록합니다. |
|||
|
|||
/// info | 정보 |
|||
|
|||
`open()` 함수에서 `mode="a"`는 "추가"를 의미합니다. 따라서 이미 존재하는 파일의 내용을 덮어쓰지 않고 새로운 줄을 추가합니다. |
|||
`open()` 함수에서 `mode="a"`는 "추가"를 의미하므로, 파일에 있는 기존 내용은 덮어쓰지 않고 새로운 줄이 추가됩니다. |
|||
|
|||
/// |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 예제에서는 파일과 상호작용 하기 위해 파이썬 표준 함수인 `open()`을 사용하고 있습니다. |
|||
이 경우, 우리는 표준 파이썬 `open()` 함수를 사용하여 파일과 상호작용하고 있습니다. |
|||
|
|||
따라서 디스크에 데이터를 쓰기 위해 "대기"가 필요한 I/O (입력/출력) 작업을 수행합니다. |
|||
따라서 I/O(입출력) 작업이 포함되어 있어 디스크에 기록되는 것을 "기다리는" 과정이 필요합니다. |
|||
|
|||
그러나 `open()`은 `async`와 `await`을 사용하지 않기 때문에 이벤트 핸들러 함수는 `async def`가 아닌 표준 `def`로 선언하고 있습니다. |
|||
하지만 `open()`은 `async`와 `await`를 사용하지 않습니다. |
|||
|
|||
그래서 우리는 이벤트 핸들러 함수를 `async def` 대신 일반 `def`로 선언합니다. |
|||
|
|||
/// |
|||
|
|||
### `startup`과 `shutdown`을 함께 사용 |
|||
|
|||
*시작*과 *종료* 로직이 연결될 가능성이 높습니다. 예를 들어, 무언가를 시작한 후 끝내거나, 자원을 획득한 후 해제하는 등의 작업을 할 수 있습니다. |
|||
|
|||
이러한 작업을 별도의 함수로 처리하면 서로 로직이나 변수를 공유하지 않기 때문에 더 어려워집니다. 값들을 전역 변수에 저장하거나 비슷한 트릭을 사용해야 할 수 있습니다. |
|||
|
|||
그렇기 때문에 위에서 설명한 대로 `lifespan`을 사용하는 것이 권장됩니다. |
|||
|
|||
## 기술적 세부사항 |
|||
|
|||
호기심 많은 분들을 위한 기술적인 세부사항입니다. 🤓 |
|||
|
|||
ASGI 기술 사양에 따르면, 이는 <a href="https://asgi.readthedocs.io/en/latest/specs/lifespan.html" class="external-link" target="_blank">Lifespan Protocol</a>의 일부이며, `startup`과 `shutdown`이라는 이벤트를 정의합니다. |
|||
|
|||
/// info | 정보 |
|||
|
|||
이벤트 핸들러에 관한 내용은 <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette 이벤트 문서</a>에서 추가로 확인할 수 있습니다. |
|||
Starlette의 `lifespan` 핸들러에 대해 더 읽고 싶다면 <a href="https://www.starlette.io/lifespan/" class="external-link" target="_blank">Starlette의 Lifespan 문서</a>에서 확인할 수 있습니다. |
|||
|
|||
이 문서에는 코드의 다른 영역에서 사용할 수 있는 lifespan 상태를 처리하는 방법도 포함되어 있습니다. |
|||
|
|||
/// |
|||
|
|||
## 서브 애플리케이션 |
|||
|
|||
🚨 이 lifespan 이벤트(`startup`과 `shutdown`)는 메인 애플리케이션에 대해서만 실행되며, [서브 애플리케이션 - Mounts](sub-applications.md){.internal-link target=_blank}에는 실행되지 않음을 유의하세요. |
|||
|
@ -0,0 +1,67 @@ |
|||
# 하위 응용프로그램 - 마운트 |
|||
|
|||
만약 각각의 독립적인 OpenAPI와 문서 UI를 갖는 두 개의 독립적인 FastAPI 응용프로그램이 필요하다면, 메인 어플리케이션에 하나 (또는 그 이상의) 하위-응용프로그램(들)을 “마운트"해서 사용할 수 있습니다. |
|||
|
|||
## **FastAPI** 응용프로그램 마운트 |
|||
|
|||
“마운트"이란 완전히 “독립적인" 응용프로그램을 특정 경로에 추가하여 해당 하위 응용프로그램에서 선언된 *경로 동작*을 통해 해당 경로 아래에 있는 모든 작업들을 처리할 수 있도록 하는 것을 의미합니다. |
|||
|
|||
### 최상단 응용프로그램 |
|||
|
|||
먼저, 메인, 최상단의 **FastAPI** 응용프로그램과 이것의 *경로 동작*을 생성합니다: |
|||
|
|||
{* ../../docs_src/sub_applications/tutorial001.py hl[3, 6:8] *} |
|||
|
|||
### 하위 응용프로그램 |
|||
|
|||
다음으로, 하위 응용프로그램과 이것의 *경로 동작*을 생성합니다: |
|||
|
|||
이 하위 응용프로그램은 또 다른 표준 FastAPI 응용프로그램입니다. 다만 이것은 “마운트”될 것입니다: |
|||
|
|||
{* ../../docs_src/sub_applications/tutorial001.py hl[11, 14:16] *} |
|||
|
|||
### 하위 응용프로그램 마운트 |
|||
|
|||
최상단 응용프로그램, `app`에 하위 응용프로그램, `subapi`를 마운트합니다. |
|||
|
|||
이 예시에서, 하위 응용프로그램션은 `/subapi` 경로에 마운트 될 것입니다: |
|||
|
|||
{* ../../docs_src/sub_applications/tutorial001.py hl[11, 19] *} |
|||
|
|||
### 자동으로 생성된 API 문서 확인 |
|||
|
|||
이제, `uvicorn`으로 메인 응용프로그램을 실행하십시오. 당신의 파일이 `main.py`라면, 이렇게 실행합니다: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uvicorn main:app --reload |
|||
|
|||
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
그리고 <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>에서 문서를 여십시오. |
|||
|
|||
메인 응용프로그램의 *경로 동작*만을 포함하는, 메인 응용프로그램에 대한 자동 API 문서를 확인할 수 있습니다: |
|||
|
|||
<img src="https://fastapi.tiangolo.com//img/tutorial/sub-applications/image01.png"> |
|||
|
|||
다음으로, <a href="http://127.0.0.1:8000/subapi/docs" class="external-link" target="_blank">http://127.0.0.1:8000/subapi/docs</a>에서 하위 응용프로그램의 문서를 여십시오. |
|||
|
|||
하위 경로 접두사 `/subapi` 아래에 선언된 *경로 동작* 을 포함하는, 하위 응용프로그램에 대한 자동 API 문서를 확인할 수 있습니다: |
|||
|
|||
<img src="https://fastapi.tiangolo.com//img/tutorial/sub-applications/image02.png"> |
|||
|
|||
두 사용자 인터페이스 중 어느 하나를 사용해야하는 경우, 브라우저는 특정 응용프로그램 또는 하위 응용프로그램과 각각 통신할 수 있기 때문에 올바르게 동작할 것입니다. |
|||
|
|||
### 기술적 세부사항: `root_path` |
|||
|
|||
위에 설명된 것과 같이 하위 응용프로그램을 마운트하는 경우, FastAPI는 `root_path`라고 하는 ASGI 명세의 매커니즘을 사용하여 하위 응용프로그램에 대한 마운트 경로 통신을 처리합니다. |
|||
|
|||
이를 통해, 하위 응용프로그램은 문서 UI를 위해 경로 접두사를 사용해야 한다는 사실을 인지합니다. |
|||
|
|||
하위 응용프로그램에도 역시 다른 하위 응용프로그램을 마운트하는 것이 가능하며 FastAPI가 모든 `root_path` 들을 자동적으로 처리하기 때문에 모든 것은 올바르게 동작할 것입니다. |
|||
|
|||
`root_path`와 이것을 사용하는 방법에 대해서는 [프록시의 뒷단](./behind-a-proxy.md){.internal-link target=_blank} 섹션에서 배울 수 있습니다. |
@ -0,0 +1,223 @@ |
|||
# 추가 모델 |
|||
|
|||
지난 예제에 이어서, 연관된 모델을 여러개 갖는 것은 흔한 일입니다. |
|||
|
|||
특히 사용자 모델의 경우에 그러한데, 왜냐하면: |
|||
|
|||
* **입력 모델** 은 비밀번호를 가져야 합니다. |
|||
* **출력 모델** 은 비밀번호를 가지면 안됩니다. |
|||
* **데이터베이스 모델** 은 해시처리된 비밀번호를 가질 것입니다. |
|||
|
|||
/// danger | 위험 |
|||
|
|||
절대 사용자의 비밀번호를 평문으로 저장하지 마세요. 항상 이후에 검증 가능한 "안전한 해시(secure hash)"로 저장하세요. |
|||
|
|||
만약 이게 무엇인지 모르겠다면, [security chapters](security/simple-oauth2.md#password-hashing){.internal-link target=_blank}.에서 비밀번호 해시에 대해 배울 수 있습니다. |
|||
|
|||
/// |
|||
|
|||
## 다중 모델 |
|||
|
|||
아래는 비밀번호 필드와 해당 필드가 사용되는 위치를 포함하여, 각 모델들이 어떤 형태를 가질 수 있는지 전반적인 예시입니다: |
|||
|
|||
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
|||
|
|||
|
|||
/// info | 정보 |
|||
|
|||
Pydantic v1에서는 해당 메서드가 `.dict()`로 불렸으며, Pydantic v2에서는 `.model_dump()`로 이름이 변경되었습니다. `.dict()`는 여전히 지원되지만 더 이상 권장되지 않습니다. |
|||
|
|||
여기에서 사용하는 예제는 Pydantic v1과의 호환성을 위해 `.dict()`를 사용하지만, Pydantic v2를 사용할 수 있다면 `.model_dump()`를 사용하는 것이 좋습니다. |
|||
|
|||
/// |
|||
|
|||
### `**user_in.dict()` 에 대하여 |
|||
|
|||
#### Pydantic의 `.dict()` |
|||
|
|||
`user_in`은 Pydantic 모델 클래스인 `UserIn`입니다. |
|||
|
|||
Pydantic 모델은 모델 데이터를 포함한 `dict`를 반환하는 `.dict()` 메서드를 제공합니다. |
|||
|
|||
따라서, 다음과 같이 Pydantic 객체 `user_in`을 생성할 수 있습니다: |
|||
|
|||
```Python |
|||
user_in = UserIn(username="john", password="secret", email="john.doe@example.com") |
|||
``` |
|||
|
|||
그 다음, 다음과 같이 호출합니다: |
|||
|
|||
```Python |
|||
user_dict = user_in.dict() |
|||
``` |
|||
|
|||
이제 변수 `user_dict`에 데이터가 포함된 `dict`를 가지게 됩니다(이는 Pydantic 모델 객체가 아닌 `dict`입니다). |
|||
|
|||
그리고 다음과 같이 호출하면: |
|||
|
|||
```Python |
|||
print(user_dict) |
|||
``` |
|||
|
|||
Python의 `dict`가 다음과 같이 출력됩니다: |
|||
|
|||
```Python |
|||
{ |
|||
'username': 'john', |
|||
'password': 'secret', |
|||
'email': 'john.doe@example.com', |
|||
'full_name': None, |
|||
} |
|||
``` |
|||
|
|||
#### `dict` 언패킹(Unpacking) |
|||
|
|||
`user_dict`와 같은 `dict`를 함수(또는 클래스)에 `**user_dict`로 전달하면, Python은 이를 "언팩(unpack)"합니다. 이 과정에서 `user_dict`의 키와 값을 각각 키-값 인자로 직접 전달합니다. |
|||
|
|||
따라서, 위에서 생성한 `user_dict`를 사용하여 다음과 같이 작성하면: |
|||
|
|||
```Python |
|||
UserInDB(**user_dict) |
|||
``` |
|||
|
|||
다음과 같은 결과를 생성합니다: |
|||
|
|||
```Python |
|||
UserInDB( |
|||
username="john", |
|||
password="secret", |
|||
email="john.doe@example.com", |
|||
full_name=None, |
|||
) |
|||
``` |
|||
|
|||
혹은 더 정확히 말하자면, `user_dict`를 직접 사용하는 것은, 나중에 어떤 값이 추가되더라도 아래와 동일한 효과를 냅니다: |
|||
|
|||
```Python |
|||
UserInDB( |
|||
username = user_dict["username"], |
|||
password = user_dict["password"], |
|||
email = user_dict["email"], |
|||
full_name = user_dict["full_name"], |
|||
) |
|||
``` |
|||
|
|||
#### 다른 모델 데이터로 새 Pydantic 모델 생성 |
|||
|
|||
위의 예제에서 `user_in.dict()`로부터 `user_dict`를 생성한 것처럼, 아래 코드는: |
|||
|
|||
```Python |
|||
user_dict = user_in.dict() |
|||
UserInDB(**user_dict) |
|||
``` |
|||
|
|||
다음과 동일합니다: |
|||
|
|||
```Python |
|||
UserInDB(**user_in.dict()) |
|||
``` |
|||
|
|||
...왜냐하면 `user_in.dict()`는 `dict`이며, 이를 `**`로 Python이 "언팩(unpack)"하도록 하여 `UserInDB`에 전달하기 때문입니다. |
|||
|
|||
따라서, 다른 Pydantic 모델의 데이터를 사용하여 새로운 Pydantic 모델을 생성할 수 있습니다. |
|||
|
|||
#### `dict` 언패킹(Unpacking)과 추가 키워드 |
|||
|
|||
그리고 다음과 같이 추가 키워드 인자 `hashed_password=hashed_password`를 추가하면: |
|||
|
|||
```Python |
|||
UserInDB(**user_in.dict(), hashed_password=hashed_password) |
|||
``` |
|||
|
|||
다음과 같은 결과를 생성합니다: |
|||
|
|||
```Python |
|||
UserInDB( |
|||
username = user_dict["username"], |
|||
password = user_dict["password"], |
|||
email = user_dict["email"], |
|||
full_name = user_dict["full_name"], |
|||
hashed_password = hashed_password, |
|||
) |
|||
``` |
|||
|
|||
/// warning | 경고 |
|||
|
|||
추가적으로 제공된 함수 `fake_password_hasher`와 `fake_save_user`는 데이터 흐름을 시연하기 위한 예제일 뿐이며, 실제 보안을 제공하지 않습니다. |
|||
|
|||
/// |
|||
|
|||
## 중복 줄이기 |
|||
|
|||
코드 중복을 줄이는 것은 **FastAPI**의 핵심 아이디어 중 하나입니다. |
|||
|
|||
코드 중복은 버그, 보안 문제, 코드 비동기화 문제(한 곳은 업데이트되었지만 다른 곳은 업데이트되지 않는 문제) 등의 가능성을 증가시킵니다. |
|||
|
|||
그리고 이 모델들은 많은 데이터를 공유하면서 속성 이름과 타입을 중복하고 있습니다. |
|||
|
|||
더 나은 방법이 있습니다. |
|||
|
|||
`UserBase` 모델을 선언하여 다른 모델들의 기본(base)으로 사용할 수 있습니다. 그런 다음 이 모델을 상속받아 속성과 타입 선언(유형 선언, 검증 등)을 상속하는 서브클래스를 만들 수 있습니다. |
|||
|
|||
모든 데이터 변환, 검증, 문서화 등은 정상적으로 작동할 것입니다. |
|||
|
|||
이렇게 하면 각 모델 간의 차이점만 선언할 수 있습니다(평문 `password`가 있는 경우, `hashed_password`만 있는 경우, 혹은 비밀번호가 없는 경우): |
|||
|
|||
{* ../../docs_src/extra_models/tutorial002_py310.py hl[7,13:14,17:18,21:22] *} |
|||
|
|||
## `Union` 또는 `anyOf` |
|||
|
|||
두 가지 이상의 타입을 포함하는 `Union`으로 응답을 선언할 수 있습니다. 이는 응답이 그 중 하나의 타입일 수 있음을 의미합니다. |
|||
|
|||
OpenAPI에서는 이를 `anyOf`로 정의합니다. |
|||
|
|||
이를 위해 표준 Python 타입 힌트인 <a href="https://docs.python.org/3/library/typing.html#typing.Union" class="external-link" target="_blank">`typing.Union`</a>을 사용할 수 있습니다: |
|||
|
|||
/// note | 참고 |
|||
|
|||
<a href="https://docs.pydantic.dev/latest/concepts/types/#unions" class="external-link" target="_blank">`Union`</a>을 정의할때는 더 구체적인 타입을 먼저 포함하고, 덜 구체적인 타입을 그 뒤에 나열해야합니다. 아래 예제에서는 `Union[PlaneItem, CarItem]` 를 보면, 더 구체적인 `PlaneItem`이 `CarItem`보다 앞에 위치합니다. |
|||
|
|||
/// |
|||
|
|||
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
|||
|
|||
|
|||
### Python 3.10에서 `Union` |
|||
|
|||
위의 예제에서는 `response_model` 인자 값으로 `Union[PlaneItem, CarItem]`을 전달합니다. |
|||
|
|||
이 경우, 이를 **타입 어노테이션(type annotation)** 이 아닌 **인자 값(argument value)** 으로 전달하고 있기 때문에 Python 3.10에서도 `Union`을 사용해야 합니다. |
|||
|
|||
만약 타입 어노테이션에 사용한다면, 다음과 같이 수직 막대(|)를 사용할 수 있습니다: |
|||
|
|||
```Python |
|||
some_variable: PlaneItem | CarItem |
|||
``` |
|||
|
|||
하지만 이를 `response_model=PlaneItem | CarItem`과 같이 할당하면 에러가 발생합니다. 이는 Python이 이를 타입 어노테이션으로 해석하지 않고, `PlaneItem`과 `CarItem` 사이의 **잘못된 연산(invalid operation)**을 시도하기 때문입니다 |
|||
|
|||
## 모델 리스트 |
|||
|
|||
마찬가지로, 객체 리스트 형태의 응답을 선언할 수도 있습니다. |
|||
|
|||
이를 위해 표준 Python의 `typing.List`를 사용하세요(또는 Python 3.9 이상에서는 단순히 `list`를 사용할 수 있습니다): |
|||
|
|||
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
|||
|
|||
|
|||
## 임의의 `dict` 응답 |
|||
|
|||
Pydantic 모델을 사용하지 않고, 키와 값의 타입만 선언하여 평범한 임의의 `dict`로 응답을 선언할 수도 있습니다. |
|||
|
|||
이는 Pydantic 모델에 필요한 유효한 필드/속성 이름을 사전에 알 수 없는 경우에 유용합니다. |
|||
|
|||
이 경우, `typing.Dict`를 사용할 수 있습니다(또는 Python 3.9 이상에서는 단순히 `dict`를 사용할 수 있습니다): |
|||
|
|||
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
|||
|
|||
|
|||
## 요약 |
|||
|
|||
여러 Pydantic 모델을 사용하고, 각 경우에 맞게 자유롭게 상속하세요. |
|||
|
|||
엔터티가 서로 다른 "상태"를 가져야 하는 경우, 엔터티당 단일 데이터 모델을 사용할 필요는 없습니다. 예를 들어, 사용자 "엔터티"가 `password`, `password_hash`, 또는 비밀번호가 없는 상태를 포함할 수 있는 경우처럼 말입니다. |
@ -0,0 +1,846 @@ |
|||
# 가상 환경 |
|||
|
|||
Python 프로젝트를 작업할 때는 **가상 환경** (또는 이와 유사한 도구)을 사용하는 것이 좋습니다. 각 프로젝트 마다 설치하는 패키지를 분리하여 관리할 수 있습니다. |
|||
|
|||
/// info | 정보 |
|||
|
|||
이미 가상 환경에 대해 잘 알고 있다면, 이 섹션은 건너 뛰어도 괜찮습니다. 🤓 |
|||
|
|||
/// |
|||
|
|||
/// tip | 팁 |
|||
|
|||
**가상 환경(Virtual Environment)** 은 **환경 변수(Environment Variable)** 와 다릅니다. |
|||
|
|||
**환경 변수**는 시스템에 존재하며, 프로그램이 사용할 수 있는 변수입니다. |
|||
|
|||
**가상 환경**은 몇몇 파일로 구성된 하나의 디렉터리입니다. |
|||
|
|||
/// |
|||
|
|||
/// info | 정보 |
|||
|
|||
이 페이지에서는 **가상 환경**의 사용 방법과 작동 방식을 설명합니다. |
|||
|
|||
만약 **모든 것을 관리해주는 도구** (Python 설치까지 포함)를 사용하고 싶다면 <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">uv</a>를 사용해보세요. |
|||
|
|||
/// |
|||
|
|||
## 프로젝트 생성 |
|||
|
|||
먼저, 프로젝트를 위한 디렉터리를 하나 생성합니다. |
|||
|
|||
보통 사용자 홈 디렉터리 안에 `code`라는 디렉터리를 만들고, 그 안에 프로젝트마다 하나씩 디렉터리를 만들어 관리합니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// 홈 디렉터리로 이동 |
|||
$ cd |
|||
// 모든 코드 프로젝트를 위한 디렉터리 생성 |
|||
$ mkdir code |
|||
// code 디렉터리로 이동 |
|||
$ cd code |
|||
// 이번 프로젝트를 위한 디렉터리 생성 |
|||
$ mkdir awesome-project |
|||
// 해당 프로젝트 디렉터리로 이동 |
|||
$ cd awesome-project |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## 가상 환경 생성 |
|||
|
|||
Python 프로젝트를 **처음 시작할 때**, 가상 환경을 **<abbr title="다른 방법들도 있지만, 이건 간단한 가이드라인입니다">프로젝트 내부</abbr>**에 생성합니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 작업은 **프로젝트를 처음 설정할 때 한번만** 해주면 됩니다. 이후 작업할 때 반복할 필요는 없습니다. |
|||
|
|||
/// |
|||
|
|||
//// tab | `venv` |
|||
|
|||
Python 표준 라이브러리에 포함된 venv 모듈을 사용해 가상 환경을 생성할 수 있습니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python -m venv .venv |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// details | 명령어 상세 설명 |
|||
|
|||
* `python`: `python` 프로그램을 실행합니다. |
|||
* `-m`: 특정 모듈을 스크립트처럼 실행합니다. 대상 모듈을 바로 뒤에 지정합니다. |
|||
* `venv`: Python 표준 라이브러리에 포함된 `venv` 모듈을 실행합니다. |
|||
* `.venv`: 가상 환경을 `.venv` 디렉터리에 생성합니다. |
|||
|
|||
/// |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
<a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>가 설치되어 있다면, uv를 통해 가상 환경을 생성할 수 있습니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv venv |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// tip | 팁 |
|||
|
|||
`uv`는 기본적으로 `.venv` 디렉터리에 가상 환경을 생성합니다. |
|||
|
|||
별도로 디렉터리 이름을 추가 인자로 넘겨 주면 경로를 지정 할 수 있습니다. |
|||
|
|||
/// |
|||
|
|||
//// |
|||
|
|||
해당 명령어는 `.venv` 디렉터리에 새로운 가상 환경을 생성합니다. |
|||
|
|||
/// details | `.venv` 또는 다른 이름 |
|||
|
|||
가상 환경을 다른 디렉터리에 생성할 수도 있지만, 관례적으로 `.venv` 디렉터리 이름을 사용합니다. |
|||
|
|||
/// |
|||
|
|||
## 가상 환경 활성화 |
|||
|
|||
이후 실행하는 Python 명령어와 패키지 설치가 가상 환경을 따르도록, 가상 환경을 활성화하세요. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
**터미널을 새로 열고** 프로젝트 작업을 시작할 때는, **항상 이 작업을** 해주세요. |
|||
|
|||
/// |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/bin/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ .venv\Scripts\Activate.ps1 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows Bash |
|||
|
|||
Windows에서 Bash(예: <a href="https://gitforwindows.org/" class="external-link" target="_blank">Git Bash</a>)를 사용하는 경우: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/Scripts/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
/// tip | 팁 |
|||
|
|||
가상 환경에 새로운 패키지를 설치할 때마다, 해당 환경을 다시 활성화하세요. |
|||
|
|||
이렇게 하면 해당 패키지로 설치된 **터미널(<abbr title="command line interface">CLI</abbr>) 프로그램**을 사용할 때, 전역에 설치된 다른 버전이 아니라, 가상 환경 안에 설치된 정확한 버전을 사용합니다. |
|||
|
|||
/// |
|||
|
|||
## 가상 환경이 활성화 여부 확인 |
|||
|
|||
가상 환경이 활성화되었는지 확인합니다. (이전 명령어가 제대로 작동했는지 확인합니다). |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 단계는 **선택 사항**이지만, 모든 것이 예상대로 작동하고 있는지, 그리고 의도한 가상 환경이 활성화 되었는 지 **확인**하는 좋은 방법입니다. |
|||
|
|||
/// |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ which python |
|||
|
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
`python` 위치가 프로젝트 내부(이 예시에서는 `awesome-project`)의 `.venv/bin/python` 경로로 표시된다면 성공입니다. 🎉 |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ Get-Command python |
|||
|
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
`python` 위치가 프로젝트 내부(이 예시에서는 `awesome-project`)의 `.venv\bin\python` 경로로 표시된다면 성공입니다. 🎉 |
|||
|
|||
//// |
|||
|
|||
## pip 업그레이드 |
|||
|
|||
/// tip | 팁 |
|||
|
|||
<a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>를 사용한다면, `pip` 대신 `uv`로 패키지를 설치하게 되므로 `pip`을 업그레이드할 필요가 없습니다. 😎 |
|||
|
|||
/// |
|||
|
|||
`pip`을 사용하여 패키지를 설치하는 경우 (Python 표준 라이브러리에 포함되어 있습니다), **최신 버전으로 업그레이드**하는 것이 좋습니다. |
|||
|
|||
패키지 설치 중 발생하는 다양하고 특이한 에러들은 `pip` 업그레이드로 쉽게 해결되는 경우가 많습니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 작업은 보통 가상 환경을 생성한 **직후 한 번만** 하면 됩니다. |
|||
|
|||
/// |
|||
|
|||
가상 환경이 활성화된 상태인지 확인한 후(앞서 설명한 명령어 사용), 아래 명령어를 실행하세요: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python -m pip install --upgrade pip |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## `.gitignore` 추가하기 |
|||
|
|||
**Git**을 사용하고 있다면 (사용하는 것이 좋습니다), `.gitignore` 파일을 추가해서 `.venv` 디렉터리 전체를 Git에서 제외하세요. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
<a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>를 사용해 가상 환경을 생성했다면, 이미 이 작업이 자동으로 처리되어 있으므로 이 단계는 건너뛰어도 됩니다. 😎 |
|||
|
|||
/// |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 작업도 마찬가지로, 가상 환경을 생성한 **직후 한 번만** 하면 됩니다. |
|||
|
|||
/// |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ echo "*" > .venv/.gitignore |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// details | 명령어 상세 설명 |
|||
|
|||
* `echo "*"`: 터미널에 `*` 텍스트를 "출력"합니다 (다음 설명에서 조금 바뀝니다) |
|||
* `>`: 왼쪽 명령어의 출력 내용을 터미널에 출력하지 않고, 오른쪽에 지정된 파일로 **기록(write)** 하라는 의미입니다. |
|||
* `.gitignore`: 출력된 텍스트가 기록될 파일 이름입니다. |
|||
|
|||
그리고 Git에서 `*`는 "모든 것"을 의미합니다. 따라서 `.venv` 디렉터리 안의 모든 것을 무시하게 됩니다. |
|||
|
|||
이 명령어는 다음과 같은 내용을 가진 `.gitignore` 파일을 생성합니다: |
|||
|
|||
|
|||
```gitignore |
|||
* |
|||
``` |
|||
|
|||
/// |
|||
|
|||
## 패키지 설치 |
|||
|
|||
가상 환경을 활성화한 후, 그 안에 필요한 패키지들을 설치할 수 있습니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
프로젝트에서 필요한 패키지를 설치하거나 업그레이드할 때는 이 작업을 **한 번만** 하면 됩니다. |
|||
|
|||
만약 특정 패키지의 버전을 업그레이드하거나, 새로운 패키지를 추가할 필요가 생기면 **다시 이 작업을 반복**하면 됩니다. |
|||
|
|||
/// |
|||
|
|||
### 패키지 직접 설치 |
|||
|
|||
급하게 작업하거나, 프로젝트에 필요한 패키지 목록을 따로 파일로 관리하고 싶지 않은 경우, 패키지를 직접 설치할 수도 있습니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
패키지 이름과 버전 정보를 파일에 정리해두는 것(예: `requirements.txt` 또는 `pyproject.toml`)은 (매우) 좋은 생각입니다. |
|||
|
|||
/// |
|||
|
|||
//// tab | `pip` |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "fastapi[standard]" |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
<a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>를 사용하는 경우: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv pip install "fastapi[standard]" |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
### `requirements.txt`에서 설치 |
|||
|
|||
`requirements.txt` 파일이 있다면, 그 안에 명시된 패키지들을 한 번에 설치할 수 있습니다. |
|||
|
|||
//// tab | `pip` |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install -r requirements.txt |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
<a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>를 사용하는 경우: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv pip install -r requirements.txt |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
/// details | `requirements.txt` |
|||
|
|||
다음은 몇 가지 패키지를 포함한 `requirements.txt`의 예시입니다: |
|||
|
|||
```requirements.txt |
|||
fastapi[standard]==0.113.0 |
|||
pydantic==2.8.0 |
|||
``` |
|||
|
|||
/// |
|||
|
|||
## 프로그램 실행 |
|||
|
|||
가상 환경을 활성화한 후에는 프로그램을 실행할 수 있습니다. 이때 해당 가상 환경에 설치된 Python과 패키지들이 사용됩니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python main.py |
|||
|
|||
Hello World |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## 에디터 설정 |
|||
|
|||
에디터를 사용할 경우, 앞서 만든 가상 환경을 사용하도록 설정하는 것이 좋습니다. (대부분의 에디터는 자동으로 감지하기도 합니다.) |
|||
이렇게 하면 자동 완성 기능이나 코드 내 오류 표시 기능을 제대로 사용할 수 있습니다. |
|||
|
|||
예시: |
|||
|
|||
* <a href="https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment" class="external-link" target="_blank">VS Code</a> |
|||
* <a href="https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html" class="external-link" target="_blank">PyCharm</a> |
|||
|
|||
/// tip | 팁 |
|||
|
|||
이 설정은 보통 가상 환경을 **처음 만들었을 때 한 번만** 해주면 됩니다. |
|||
|
|||
/// |
|||
|
|||
## 가상 환경 비활성화 |
|||
|
|||
프로젝트 작업이 끝났다면, 가상 환경을 **비활성화**할 수 있습니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ deactivate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
이렇게 하면 이후에 `python` 명령어를 실행했을 때, 가상 환경의 Python이나 그 안에 설치된 패키지들을 사용하지 않게 됩니다. |
|||
|
|||
## 이제 작업할 준비가 되었습니다 |
|||
|
|||
이제 프로젝트 작업을 시작할 준비가 완료되었습니다. |
|||
|
|||
|
|||
/// tip | 팁 |
|||
|
|||
위 내용을 더 깊이 이해하고 싶으신가요? |
|||
|
|||
그렇다면 계속 읽어 주세요. 👇🤓 |
|||
|
|||
/// |
|||
|
|||
## 가상 환경을 왜 사용하는가 |
|||
|
|||
FastAPI를 사용하려면 먼저 <a href="https://www.python.org/" class="external-link" target="_blank">Python</a>을 설치해야 합니다. |
|||
|
|||
그 후에는 FastAPI와 함께 사용할 **기타 패키지들**을 **설치**해야 합니다. |
|||
|
|||
패키지를 설치할 때 보통 Python에 기본 포함된 `pip` 명령어(또는 유사한 도구)를 사용합니다. |
|||
|
|||
하지만 `pip`을 그냥 직접 사용하면, 해당 패키지들은 **전역 Python 환경**(시스템 전체에 설치된 Python)에 설치됩니다. |
|||
|
|||
### 문제점 |
|||
|
|||
그렇다면, 전역 Python 환경에 패키지를 설치하면 어떤 문제가 발생할까요? |
|||
|
|||
어느 시점이 되면, **서로 다른 패키지들**에 의존하는 여러 개의 프로그램을 작성하게 될 것입니다. 그리고 이들 중 일부는 **같은 패키지의 서로 다른 버전**을 필요로 할 수 있습니다. 😱 |
|||
|
|||
예를 들어, `마법사의 돌(philosophers-stone)` 프로젝트를 만들었다고 가정해봅시다. 이 프로그램은 `해리 포터(harry)`라는 패키지의 `v1` 버전을 **의존**합니다. 따라서 `harry`를 설치해야 합니다. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
stone(philosophers-stone) -->|requires| harry-1[harry v1] |
|||
``` |
|||
|
|||
그런데 나중에 `아즈카반의 죄수(prisoner-of-azkaban)`이라는 또 다른 프로젝트를 만들게 되었고, 이 프로젝트도 역시 `harry` 패키지를 사용합니다. 그런데 이 프로젝트는 `harry`의 `v3` 버전이 필요합니다. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
azkaban(prisoner-of-azkaban) --> |requires| harry-3[harry v3] |
|||
``` |
|||
|
|||
하지만 이제 문제가 생깁니다. 로컬 가상 환경 대신에 전역 환경에 패키지를 설치하게 되면, 어떤 버전의 `harry`를 설치할지를 선택해야 하기 때문입니다. |
|||
|
|||
예를 들어, `마법사의 돌(philosophers-stone)`을 실행하고 싶다면 먼저 `harry` `v1` 버전을 다음과 같이 설치 해야 합니다: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "harry==1" |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
그러면 결국 전역 Python 환경에는 `harry` `v1`버전이 설치된 상태가 됩니다. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
subgraph global[global env] |
|||
harry-1[harry v1] |
|||
end |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) -->|requires| harry-1 |
|||
end |
|||
``` |
|||
|
|||
하지만 이제 `아즈카반의 죄수(prisoner-of-azkaban)`을 실행하고 싶다면, `harry` `v1`버전을 제거하고 `harry` `v3`버전을 설치해야 합니다. (또는 단순히 `v3`버전을 설치하는 것만으로도 기존의 `v1`버전이 자동으로 제거됩니다.) |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "harry==3" |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
그렇게 하면 이제 전역 Python 환경에는 `harry` `v3`버전이 설치된 상태가 됩니다. |
|||
|
|||
그리고 다시 `마법사의 돌(philosophers-stone)`을 실행하려고 하면, **작동하지** 않을 수 있습니다. 왜냐하면 이 프로그램은 `harry` `v1`버전을 필요로 하기 때문입니다. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
subgraph global[global env] |
|||
harry-1[<strike>harry v1</strike>] |
|||
style harry-1 fill:#ccc,stroke-dasharray: 5 5 |
|||
harry-3[harry v3] |
|||
end |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) -.-x|⛔️| harry-1 |
|||
end |
|||
subgraph azkaban-project[prisoner-of-azkaban project] |
|||
azkaban(prisoner-of-azkaban) --> |requires| harry-3 |
|||
end |
|||
``` |
|||
|
|||
/// tip | 팁 |
|||
|
|||
Python 패키지들은 **새 버전**에서 **호환성 문제(breaking changes)**가 발생하지 않도록 최대한 노력하는 것이 일반적입니다. 하지만 그래도 안전하게 작업하려면, 테스트를 실행해보면서 새 버전을 의도적으로 설치하는 것이 좋습니다. |
|||
|
|||
/// |
|||
|
|||
이제, 이런 일이 여러분의 **모든 프로젝트**가 사용하는 **수많은 패키지들**에서 동시에 발생한다고 상상해보세요. 이는 매우 관리하기 어려우며, 결국 **서로 호환되지 않는 버전**의 패키지로 프로젝트를 실행하게 될 가능성이 높고, 그로 인해 어떤 문제가 왜 발생하는지 알 수 없게 될 수 있습니다. |
|||
|
|||
또한 사용하는 운영체제(Linux, Windows, macOS 등)에 따라 Python이 **미리 설치되어 있을 수도** 있습니다. 이런 경우에는 운영체제의 동작에 필요한 특정 버전의 패키지들이 함께 설치되어 있을 수 있습니다. 이 상태에서 전역 Python 환경에 임의의 패키지를 설치하면, 운영체제에 포함된 프로그램 일부가 **깨질 위험**도 있습니다. |
|||
|
|||
## 패키지들은 어디에 설치되는가 |
|||
|
|||
Python을 설치하면, 컴퓨터에 여러 디렉터리와 파일들이 생성됩니다. |
|||
|
|||
이 중 일부 디렉터리는 사용자가 설치한 패키지들을 보관하는 역할을 합니다. |
|||
|
|||
예를 들어, 아래 명령어를 실행하면: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// 지금 실행하지 않아도 됩니다, 그냥 예제일 뿐이에요 🤓 |
|||
$ pip install "fastapi[standard]" |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
해당 명령어는 FastAPI 코드를 포함한 압축 파일을 다운로드합니다. 이 파일은 보통 <a href="https://pypi.org/project/fastapi/" class="external-link" target="_blank">PyPI</a>에서 받아옵니다. |
|||
|
|||
또한 FastAPI가 의존하는 다른 패키지들도 함께 **다운로드**됩니다. |
|||
|
|||
그리고 그 모든 파일들을 **압축 해제**한 뒤, 컴퓨터의 특정 디렉터리에 저장합니다. |
|||
|
|||
기본적으로 이 파일들은 Python이 설치된 디렉터리 안, 즉 **전역 환경**에 내의 디렉터리에 저장됩니다. |
|||
|
|||
## 가상 환경이란 |
|||
|
|||
전역 환경에 모든 패키지를 설치하면서 발생하는 문제에 대한 해결책은, 작업하는 **각 프로젝트마다 가상 환경**을 사용하는 것입니다. |
|||
|
|||
가상 환경은 전역 환경과 매우 유사한 하나의 **디렉터리**이며, 그 안에 해당 프로젝트를 위한 패키지들을 설치할 수 있습니다. |
|||
|
|||
이렇게 하면 각 프로젝트는 자체적인 가상 환경(`.venv` 디렉터리)을 가지게 되며, 그 안에 해당 프로젝트 전용 패키지들을 보유하게 됩니다. |
|||
|
|||
|
|||
```mermaid |
|||
flowchart TB |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) --->|requires| harry-1 |
|||
subgraph venv1[.venv] |
|||
harry-1[harry v1] |
|||
end |
|||
end |
|||
subgraph azkaban-project[prisoner-of-azkaban project] |
|||
azkaban(prisoner-of-azkaban) --->|requires| harry-3 |
|||
subgraph venv2[.venv] |
|||
harry-3[harry v3] |
|||
end |
|||
end |
|||
stone-project ~~~ azkaban-project |
|||
``` |
|||
|
|||
## 가상 환경 활성화 의미 |
|||
|
|||
가상 환경을 활성화한다는 것은, 예를 들어 다음과 같은 명령어를 실행하는 것을 의미합니다: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/bin/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ .venv\Scripts\Activate.ps1 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows Bash |
|||
|
|||
Windows에서 Bash(예: <a href="https://gitforwindows.org/" class="external-link" target="_blank">Git Bash</a>)를 사용하는 경우: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/Scripts/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
이 명령어는 이후에 실행될 명령어에서 사용될 [환경 변수](environment-variables.md){.internal-link target=_blank} 몇 개를 생성하거나 수정합니다. |
|||
|
|||
이 변수들 중 하나가 바로 `PATH` 변수입니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
`PATH` 환경 변수에 대해 더 알고 싶다면 [환경 변수 문서의 PATH 환경 변수 섹션](environment-variables.md#path-environment-variable){.internal-link target=_blank}을 참고하세요. |
|||
|
|||
/// |
|||
|
|||
가상 환경을 활성화하면, 가상 환경의 경로인 `.venv/bin` (Linux와 macOS) 또는 `.venv\Scripts`(Windows)를 `PATH` 환경 변수에 추가됩니다. |
|||
|
|||
예를 들어, 가상 환경을 활성화하기 전의 `PATH` 변수는 다음과 같았다고 가정해봅시다: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
시스템은 다음 경로들에서 프로그램을 찾게 됩니다: |
|||
|
|||
* `/usr/bin` |
|||
* `/bin` |
|||
* `/usr/sbin` |
|||
* `/sbin` |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Windows\System32 |
|||
``` |
|||
|
|||
시스템은 다음 경로들에서 프로그램을 찾게 됩니다: |
|||
|
|||
* `C:\Windows\System32` |
|||
|
|||
//// |
|||
|
|||
가상 환경을 활성화한 후에는, `PATH` 변수는 다음과 같은 형태가 됩니다: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin:/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
시스템은 가장 먼저 다음 경로에서 프로그램을 찾기 시작합니다: |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin |
|||
``` |
|||
|
|||
그 후에 다른 디렉터리들을 탐색합니다. |
|||
|
|||
따라서 터미널에 `python`을 입력하면, 시스템은 다음 위치에 있는 Python 프로그램을 찾게 됩니다: |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
그리고 해당 Python을 사용하게 됩니다. |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts;C:\Windows\System32 |
|||
``` |
|||
|
|||
시스템은 가장 먼저 다음 경로에서 프로그램을 찾기 시작합니다: |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts |
|||
``` |
|||
|
|||
그 후에 다른 디렉터리들을 탐색합니다. |
|||
|
|||
따라서 터미널에 `python`을 입력하면, 시스템은 다음 경로에 있는 Python 프로그램을 찾게 됩니다: |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
그리고 해당 Python을 사용하게 됩니다. |
|||
|
|||
//// |
|||
|
|||
중요한 세부 사항 중 하나는, 가상 환경의 경로가 `PATH` 변수의 가장 **앞**에 추가된다는 점입니다. 시스템은 사용 가능한 다른 Python들보다 **먼저** 이 경로를 찾습니다. 그래서 터미널에서 `python`을 실행하면, 전역 환경의 Python이 아닌 **가상 환경에 있는** Python이 사용됩니다. (예: 전역 환경에 설치된 `python`이 있더라도 그보다 우선합니다.) |
|||
|
|||
가상 환경을 활성화하면 이 외에도 몇 가지 다른 것들이 변경되지만, 이는 그중에서도 가장 중요한 변화 중 하나입니다. |
|||
|
|||
## 가상 환경 확인하기 |
|||
|
|||
가상 환경이 활성화 되었는지 확인하려면, 아래 명령어를 사용할 수 있습니다: |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ which python |
|||
|
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ Get-Command python |
|||
|
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
즉, 현재 사용되는 `python` 프로그램은 **가상 환경 내부에 있는 것**입니다. |
|||
|
|||
Linux와 macOS에서는 `which`, Windows PowerShell에서는 `Get-Command` 명령어를 사용합니다. |
|||
|
|||
이 명령어는 `PATH` 환경 변수에 지정된 경로들을 **순서대로 탐색**하면서 `python`이라는 이름의 프로그램을 찾습니다. |
|||
찾는 즉시, 해당 프로그램의 **경로를 출력**합니다. |
|||
|
|||
중요한 점은 터미널에서 `python`을 실행했을 때, 실제로 실행되는 "`python`"이 어떤 것인지 정확히 알 수 있다는 것입니다. |
|||
|
|||
따라서 현재 올바른 가상 환경에 있는지 확인할 수 있습니다. |
|||
|
|||
/// tip | 팁 |
|||
|
|||
하나의 가상 환경을 활성화한 뒤, 해당 Python을 가진 상태에서 **또 다른 프로젝트**로 이동하는 것은 흔히 발생합니다. |
|||
|
|||
하지만 이때 이전 프로젝트의 가상 환경에 있는 **잘못된 Python 실행 파일**을 사용하게 되어 새 프로젝트가 **정상 작동하지 않을 수 있습니다.** |
|||
|
|||
그래서 현재 어떤 `python`이 사용되고 있는지 확인할 수 있는 능력은 매우 유용합니다. 🤓 |
|||
|
|||
/// |
|||
|
|||
## 가상 환경을 비활성화하는 이유 |
|||
|
|||
예를 들어 `마법사의 돌(philosophers-stone)`이라는 프로젝트에서 작업 중이라고 해보겠습니다. 이때 해당 **가상 환경을 활성화**하고, 필요한 패키지를 설치하며 작업을 진행합니다. |
|||
|
|||
그런데 이제는 **다른 프로젝트**인 `아즈카반의 죄수(prisoner-of-azkaban)`을 작업하고 싶어졌습니다. |
|||
|
|||
그래서 그 프로젝트 디렉터리로 이동합니다: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
만약 `마법사의 돌(philosophers-stone)`의 가상 환경을 비활성화하지 않았다면, 터미널에서 `python`을 실행할 때 여전히 `마법사의 돌(philosophers-stone)` 가상 환경의 Python을 사용하게 됩니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
|
|||
$ python main.py |
|||
|
|||
// sirius를 임포트하는 데 실패했습니다. 설치되어 있지 않아요 😱 |
|||
Traceback (most recent call last): |
|||
File "main.py", line 1, in <module> |
|||
import sirius |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
하지만 `마법사의 돌(philosophers-stone)`의 가상 환경을 비활성화한 다음, `아즈카반의 죄수(prisoner-of-azkaban)` 프로젝트의 가상 환경을 활성화하면, 이제 `python` 명령어는 `아즈카반의 죄수(prisoner-of-azkaban)` 가상 환경의 Python을 사용하게 됩니다. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
|
|||
// 이전 디렉터리에 있을 필요 없이, 어디서든 가상 환경을 비활성화할 수 있습니다. 다른 프로젝트 디렉터리로 이동한 후에도 괜찮아요 😎 |
|||
$ deactivate |
|||
|
|||
// prisoner-of-azkaban/.venv 가상 환경을 활성화합니다 🚀 |
|||
$ source .venv/bin/activate |
|||
|
|||
// 이제 python을 실행하면, 이 가상 환경에 설치된 sirius 패키지를 찾게 됩니다 ✨ |
|||
$ python main.py |
|||
|
|||
못된 짓을 꾸미고 있음을 엄숙히 맹세합니다.🧙 |
|||
ImportError는 이제 없습니다. 🐺 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## 대안들 |
|||
|
|||
이 문서는 여러분이 Python 프로젝트를 시작하고, **그 내부에서** 어떻게 돌아가는지 알려주는 간단한 가이드입니다. |
|||
|
|||
가상 환경, 패키지 의존성(Requirements), 프로젝트를 관리하는 방법에는 이 외에도 다양한 **대안**들이 존재합니다. |
|||
|
|||
만약 준비가 되었다면, **프로젝트 전체**, 패키지 의존성, 가상 환경 등을 통합적으로 **관리**할 수 있는 도구를 써보는 것도 좋습니다. 그럴 때 추천하는 도구가 바로 <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">uv</a>입니다. |
|||
|
|||
`uv`는 다양한 기능을 지원합니다: |
|||
|
|||
* 다양한 버전의 **Python 설치** |
|||
* 각 프로젝트 별 **가상 환경 관리** |
|||
* **패키지 설치** |
|||
* 프로젝트의 **의존성과 버전** 관리 |
|||
* 설치된 패키지들과 그 버전을 **정확히 고정(lock)**해서,개발 환경과 운영 환경이 완전히 동일하게 작동할 수 있도록 보장 |
|||
* 이 외에도 다양한 기능을 지원 |
|||
|
|||
## 결론 |
|||
|
|||
여기까지 모두 읽고 이해했다면, 이제 많은 개발자들보다 가상 환경을 **훨씬 더 깊이 있게 이해**하게 되셨습니다. 🤓 |
|||
|
|||
이런 세부적인 내용을 알고 있으면, 언젠가 복잡해 보이는 문제를 디버깅할 때 분명히 큰 도움이 될 것입니다. 이제는 **이 모든 것들이 내부에서 어떻게 작동하는지** 알고 있기 때문입니다. 😎 |
@ -0,0 +1,41 @@ |
|||
# Дополнительные статус коды |
|||
|
|||
По умолчанию **FastAPI** возвращает ответы, используя `JSONResponse`, помещая содержимое, которое вы возвращаете из вашей *операции пути*, внутрь этого `JSONResponse`. |
|||
|
|||
Он будет использовать код статуса по умолчанию или тот, который вы укажете в вашей *операции пути*. |
|||
|
|||
## Дополнительные статус коды |
|||
|
|||
Если вы хотите возвращать дополнительный статус код помимо основного, вы можете сделать это, возвращая объект `Response` напрямую, как `JSONResponse`, и устанавливая нужный статус код напрямую. |
|||
|
|||
Например, скажем, вы хотите создать *операцию пути*, которая позволяет обновлять элементы и возвращает HTTP-код 200 "OK" при успешном выполнении. |
|||
|
|||
Но вы также хотите, чтобы она принимала новые элементы. И если элемент ранее не существовал, он создаётся, и возвращался HTTP-код 201 "Created". |
|||
|
|||
Чтобы реализовать это, импортируйте `JSONResponse` и возвращайте ваш контент напрямую, устанавливая нужный `status_code`: |
|||
|
|||
{* ../../docs_src/additional_status_codes/tutorial001_an_py310.py hl[4,25] *} |
|||
|
|||
/// warning | Внимание |
|||
|
|||
Когда вы возвращаете объект `Response` напрямую, как в примере выше, он будет возвращён как есть. |
|||
|
|||
Он не будет сериализован при помощи модели и т.д. |
|||
|
|||
Убедитесь, что в нём содержатся именно те данные, которые вы хотите, и что значения являются валидным JSON (если вы используете `JSONResponse`). |
|||
|
|||
/// |
|||
|
|||
/// note | Технические детали |
|||
|
|||
Вы также можете использовать `from starlette.responses import JSONResponse`. |
|||
|
|||
**FastAPI** предоставляет тот же `starlette.responses` через `fastapi.responses` просто для вашего удобства, как разработчика. Но большинство доступных Response-классов поступают напрямую из Starlette. То же самое касается и `status`. |
|||
|
|||
/// |
|||
|
|||
## OpenAPI и документация API |
|||
|
|||
Если вы возвращаете дополнительные коды статусов и ответы напрямую, они не будут включены в схему OpenAPI (документацию API), потому что FastAPI не может заранее знать, что вы собираетесь вернуть. |
|||
|
|||
Но вы можете задокументировать это в вашем коде, используя: [Дополнительные ответы в OpenAPI](additional-responses.md){.internal-link target=_blank}. |
@ -0,0 +1,21 @@ |
|||
# Расширенное руководство пользователя |
|||
|
|||
## Дополнительные возможности |
|||
|
|||
Основное [Учебник - Руководство пользователя](../tutorial/index.md){.internal-link target=_blank} должно быть достаточно, чтобы познакомить вас со всеми основными функциями **FastAPI**. |
|||
|
|||
В следующих разделах вы увидите другие варианты, конфигурации и дополнительные возможности. |
|||
|
|||
/// tip |
|||
|
|||
Следующие разделы **не обязательно являются "продвинутыми"**. |
|||
|
|||
И вполне возможно, что для вашего случая использования решение находится в одном из них. |
|||
|
|||
/// |
|||
|
|||
## Сначала прочитайте Учебник - Руководство пользователя |
|||
|
|||
Вы все еще можете использовать большинство функций **FastAPI** со знаниями из [Учебник - Руководство пользователя](../tutorial/index.md){.internal-link target=_blank}. |
|||
|
|||
И следующие разделы предполагают, что вы уже прочитали его, и предполагают, что вы знаете эти основные идеи. |
@ -0,0 +1,31 @@ |
|||
# Response - Изменение cтатус кода |
|||
|
|||
Вы, вероятно, уже читали о том, что можно установить [Состояние ответа по умолчанию](../tutorial/response-status-code.md){.internal-link target=_blank}. |
|||
|
|||
Но в некоторых случаях вам нужно вернуть код состояния, отличный от установленного по умолчанию. |
|||
|
|||
## Пример использования |
|||
|
|||
Например, представьте, что вы хотите возвращать HTTP код состояния "OK" `200` по умолчанию. |
|||
|
|||
Но если данные не существовали, вы хотите создать их и вернуть HTTP код состояния "CREATED" `201`. |
|||
|
|||
При этом вы всё ещё хотите иметь возможность фильтровать и преобразовывать возвращаемые данные с помощью `response_model`. |
|||
|
|||
Для таких случаев вы можете использовать параметр `Response`. |
|||
|
|||
## Использование параметра `Response` |
|||
|
|||
Вы можете объявить параметр типа `Response` в вашей *функции обработки пути* (так же как для cookies и headers). |
|||
|
|||
И затем вы можете установить `status_code` в этом *временном* объекте ответа. |
|||
|
|||
{* ../../docs_src/response_change_status_code/tutorial001.py hl[1,9,12] *} |
|||
|
|||
После этого вы можете вернуть любой объект, который вам нужен, как обычно (`dict`, модель базы данных и т.д.). |
|||
|
|||
И если вы объявили `response_model`, он всё равно будет использоваться для фильтрации и преобразования возвращаемого объекта. |
|||
|
|||
**FastAPI** будет использовать этот *временный* ответ для извлечения кода состояния (а также cookies и headers) и поместит их в финальный ответ, который содержит возвращаемое вами значение, отфильтрованное любым `response_model`. |
|||
|
|||
Вы также можете объявить параметр `Response` в зависимостях и установить код состояния в них. Но помните, что последнее установленное значение будет иметь приоритет. |
@ -0,0 +1,65 @@ |
|||
# Возврат ответа напрямую |
|||
|
|||
Когда вы создаёте **FastAPI** *операцию пути*, вы можете возвращать из неё любые данные: `dict`, `list`, Pydantic-модель, модель базы данных и т.д. |
|||
|
|||
По умолчанию **FastAPI** автоматически преобразует возвращаемое значение в JSON с помощью `jsonable_encoder`, как описано в [JSON кодировщик](../tutorial/encoder.md){.internal-link target=_blank}. |
|||
|
|||
Затем "под капотом" эти данные, совместимые с JSON (например `dict`), помещаются в `JSONResponse`, который используется для отправки ответа клиенту. |
|||
|
|||
Но вы можете возвращать `JSONResponse` напрямую из ваших *операций пути*. |
|||
|
|||
Это может быть полезно, например, если нужно вернуть пользовательские заголовки или куки. |
|||
|
|||
## Возврат `Response` |
|||
|
|||
На самом деле, вы можете возвращать любой объект `Response` или его подкласс. |
|||
|
|||
/// tip | Подсказка |
|||
|
|||
`JSONResponse` сам по себе является подклассом `Response`. |
|||
|
|||
/// |
|||
|
|||
И когда вы возвращаете `Response`, **FastAPI** передаст его напрямую. |
|||
|
|||
Это не приведет к преобразованию данных с помощью Pydantic-моделей, содержимое не будет преобразовано в какой-либо тип и т.д. |
|||
|
|||
Это даёт вам большую гибкость. Вы можете возвращать любые типы данных, переопределять любые объявления или валидацию данных и т.д. |
|||
|
|||
## Использование `jsonable_encoder` в `Response` |
|||
|
|||
Поскольку **FastAPI** не изменяет объект `Response`, который вы возвращаете, вы должны убедиться, что его содержимое готово к отправке. |
|||
|
|||
Например, вы не можете поместить Pydantic-модель в `JSONResponse`, не преобразовав её сначала в `dict` с помощью преобразования всех типов данных (таких как `datetime`, `UUID` и т.д.) в совместимые с JSON типы. |
|||
|
|||
В таких случаях вы можете использовать `jsonable_encoder` для преобразования данных перед передачей их в ответ: |
|||
|
|||
{* ../../docs_src/response_directly/tutorial001.py hl[6:7,21:22] *} |
|||
|
|||
/// note | Технические детали |
|||
|
|||
Вы также можете использовать `from starlette.responses import JSONResponse`. |
|||
|
|||
**FastAPI** предоставляет `starlette.responses` через `fastapi.responses` просто для вашего удобства, как разработчика. Но большинство доступных Response-классов поступают напрямую из Starlette. |
|||
|
|||
/// |
|||
|
|||
## Возврат пользовательского `Response` |
|||
|
|||
Пример выше показывает все необходимые части, но он пока не очень полезен, так как вы могли бы просто вернуть `item` напрямую, и **FastAPI** поместил бы его в `JSONResponse`, преобразовав в `dict` и т.д. Всё это происходит по умолчанию. |
|||
|
|||
Теперь давайте посмотрим, как можно использовать это для возврата пользовательского ответа. |
|||
|
|||
Допустим, вы хотите вернуть ответ в формате <a href="https://en.wikipedia.org/wiki/XML" class="external-link" target="_blank">XML</a>. |
|||
|
|||
Вы можете поместить ваш XML-контент в строку, поместить её в `Response` и вернуть: |
|||
|
|||
{* ../../docs_src/response_directly/tutorial002.py hl[1,18] *} |
|||
|
|||
## Примечания |
|||
|
|||
Когда вы возвращаете объект `Response` напрямую, его данные не валидируются, не преобразуются (не сериализуются) и не документируются автоматически. |
|||
|
|||
Но вы всё равно можете задокументировать это, как описано в [Дополнительные ответы в OpenAPI](additional-responses.md){.internal-link target=_blank}. |
|||
|
|||
В следующих разделах вы увидите, как использовать/объявлять такие кастомные `Response`, при этом сохраняя автоматическое преобразование данных, документацию и т.д. |
@ -0,0 +1,76 @@ |
|||
# Модели параметров cookie |
|||
|
|||
Если у вас есть группа **cookies**, которые связаны между собой, вы можете создать **Pydantic-модель** для их объявления. 🍪 |
|||
|
|||
Это позволит вам **переиспользовать модель** в **разных местах**, а также объявить проверки и метаданные сразу для всех параметров. 😎 |
|||
|
|||
/// note | Заметка |
|||
|
|||
Этот функционал доступен с версии `0.115.0`. 🤓 |
|||
|
|||
/// |
|||
|
|||
/// tip | Совет |
|||
|
|||
Такой же подход применяется для `Query`, `Cookie`, и `Header`. 😎 |
|||
|
|||
/// |
|||
|
|||
## Pydantic-модель для cookies |
|||
|
|||
Объявите параметры **cookie**, которые вам нужны, в **Pydantic-модели**, а затем объявите параметр как `Cookie`: |
|||
|
|||
{* ../../docs_src/cookie_param_models/tutorial001_an_py310.py hl[9:12,16] *} |
|||
|
|||
**FastAPI** **извлечёт** данные для **каждого поля** из **cookies**, полученных в запросе, и выдаст вам объявленную Pydantic-модель. |
|||
|
|||
## Проверка сгенерированной документации |
|||
|
|||
Вы можете посмотреть объявленные cookies в графическом интерфейсе Документации по пути `/docs`: |
|||
|
|||
<div class="screenshot"> |
|||
<img src="/img/tutorial/cookie-param-models/image01.png"> |
|||
</div> |
|||
|
|||
/// info | Дополнительная информация |
|||
|
|||
Имейте в виду, что, поскольку **браузеры обрабатывают cookies** особым образом и под капотом, они **не** позволят **JavaScript** легко получить доступ к ним. |
|||
|
|||
Если вы перейдёте к **графическому интерфейсу документации API** по пути `/docs`, то сможете увидеть **документацию** по cookies для ваших *операций путей*. |
|||
|
|||
Но даже если вы **заполните данные** и нажмёте "Execute", поскольку графический интерфейс Документации работает с **JavaScript**, cookies не будут отправлены, и вы увидите сообщение об **ошибке** как будто не указывали никаких значений. |
|||
|
|||
/// |
|||
|
|||
## Запрет дополнительных cookies |
|||
|
|||
В некоторых случаях (не особо часто встречающихся) вам может понадобиться **ограничить** cookies, которые вы хотите получать. |
|||
|
|||
Теперь ваш API сам решает, <abbr title="Это шутка, на всякий случай. Это не имеет никакого отношения к согласию на использование cookie, но забавно, что даже API теперь может отклонять несчастные cookies. Съешьте печеньку. 🍪">принимать ли cookies</abbr>. 🤪🍪 |
|||
|
|||
Вы можете сконфигурировать Pydantic-модель так, чтобы запретить (`forbid`) любые дополнительные (`extra`) поля: |
|||
|
|||
{* ../../docs_src/cookie_param_models/tutorial002_an_py39.py hl[10] *} |
|||
|
|||
Если клиент попробует отправить **дополнительные cookies**, то в ответ он получит **ошибку**. |
|||
|
|||
Бедные баннеры cookies, они всеми силами пытаются получить ваше согласие — и всё ради того, чтобы <abbr title="Это ещё одна шутка. Не обращайте на меня внимания. Выпейте кофе со своей печенькой. ☕">API его отклонил</abbr>. 🍪 |
|||
|
|||
Например, если клиент попытается отправить cookie `santa_tracker` со значением `good-list-please`, то в ответ он получит **ошибку**, сообщающую ему, что cookie `santa_tracker` <abbr title="Санта не одобряет пропажу печенья. 🎅 Ладно, больше никаких шуток про печенье.">не разрешён</abbr>: |
|||
|
|||
```json |
|||
{ |
|||
"detail": [ |
|||
{ |
|||
"type": "extra_forbidden", |
|||
"loc": ["cookie", "santa_tracker"], |
|||
"msg": "Extra inputs are not permitted", |
|||
"input": "good-list-please" |
|||
} |
|||
] |
|||
} |
|||
``` |
|||
|
|||
## Заключение |
|||
|
|||
Вы можете использовать **Pydantic-модели** для объявления <abbr title="Съешьте последнюю печеньку, прежде чем уйти. 🍪">**cookies**</abbr> в **FastAPI**. 😎 |
@ -0,0 +1,78 @@ |
|||
# Модели форм |
|||
|
|||
Вы можете использовать **Pydantic-модели** для объявления **полей форм** в FastAPI. |
|||
|
|||
/// info | Дополнительная информация |
|||
|
|||
Чтобы использовать формы, сначала установите <a href="https://github.com/Kludex/python-multipart" class="external-link" target="_blank">`python-multipart`</a>. |
|||
|
|||
Убедитесь, что вы создали и активировали [виртуальное окружение](../virtual-environments.md){.internal-link target=_blank}, а затем установите пакет, например: |
|||
|
|||
```console |
|||
$ pip install python-multipart |
|||
``` |
|||
|
|||
/// |
|||
|
|||
/// note | Заметка |
|||
|
|||
Этот функционал доступен с версии `0.113.0`. 🤓 |
|||
|
|||
/// |
|||
|
|||
## Pydantic-модель для формы |
|||
|
|||
Вам просто нужно объявить **Pydantic-модель** с полями, которые вы хотите получить как **поля формы**, а затем объявить параметр как `Form`: |
|||
|
|||
{* ../../docs_src/request_form_models/tutorial001_an_py39.py hl[9:11,15] *} |
|||
|
|||
**FastAPI** **извлечёт** данные для **каждого поля** из **данных формы** в запросе и выдаст вам объявленную Pydantic-модель. |
|||
|
|||
## Проверка сгенерированной документации |
|||
|
|||
Вы можете посмотреть поля формы в графическом интерфейсе Документации по пути `/docs`: |
|||
|
|||
<div class="screenshot"> |
|||
<img src="/img/tutorial/request-form-models/image01.png"> |
|||
</div> |
|||
|
|||
## Запрет дополнительных полей формы |
|||
|
|||
В некоторых случаях (не особо часто встречающихся) вам может понадобиться **ограничить** поля формы только теми, которые объявлены в Pydantic-модели. И **запретить** любые **дополнительные** поля. |
|||
|
|||
/// note | Заметка |
|||
|
|||
Этот функционал доступен с версии `0.114.0`. 🤓 |
|||
|
|||
/// |
|||
|
|||
Вы можете сконфигурировать Pydantic-модель так, чтобы запретить (`forbid`) все дополнительные (`extra`) поля: |
|||
|
|||
{* ../../docs_src/request_form_models/tutorial002_an_py39.py hl[12] *} |
|||
|
|||
Если клиент попробует отправить дополнительные данные, то в ответ он получит **ошибку**. |
|||
|
|||
Например, если клиент попытается отправить поля формы: |
|||
|
|||
* `username`: `Rick` |
|||
* `password`: `Portal Gun` |
|||
* `extra`: `Mr. Poopybutthole` |
|||
|
|||
То в ответ он получит **ошибку**, сообщающую ему, что поле `extra` не разрешено: |
|||
|
|||
```json |
|||
{ |
|||
"detail": [ |
|||
{ |
|||
"type": "extra_forbidden", |
|||
"loc": ["body", "extra"], |
|||
"msg": "Extra inputs are not permitted", |
|||
"input": "Mr. Poopybutthole" |
|||
} |
|||
] |
|||
} |
|||
``` |
|||
|
|||
## Заключение |
|||
|
|||
Вы можете использовать Pydantic-модели для объявления полей форм в FastAPI. 😎 |
@ -0,0 +1,85 @@ |
|||
# Фонові задачі |
|||
|
|||
Ви можете створювати фонові задачі, які будуть виконуватися *після* повернення відповіді. |
|||
|
|||
Це корисно для операцій, які потрібно виконати після обробки запиту, але клієнту не обов’язково чекати завершення цієї операції перед отриманням відповіді. |
|||
|
|||
Приклади використання: |
|||
|
|||
* Надсилання email-сповіщень після виконання певної дії: |
|||
* Підключення до поштового сервера та надсилання листа може займати кілька секунд. Ви можете відразу повернути відповідь, а email відправити у фоні. |
|||
* Обробка даних: |
|||
* Наприклад, якщо отримано файл, який потрібно обробити довготривалим процесом, можна повернути відповідь "Accepted" ("Прийнято", HTTP 202) і виконати обробку файлу у фоні. |
|||
|
|||
## Використання `BackgroundTasks` |
|||
|
|||
Спочатку імпортуйте `BackgroundTasks` і додайте його як параметр у Вашу *функцію операції шляху* (path operation function) до `BackgroundTasks`: |
|||
|
|||
{* ../../docs_src/background_tasks/tutorial001.py hl[1,13] *} |
|||
|
|||
**FastAPI** автоматично створить об'єкт `BackgroundTasks` і передасть його у цей параметр. |
|||
|
|||
|
|||
## Створення функції задачі |
|||
|
|||
Створіть функцію, яка буде виконувати фонову задачу. |
|||
|
|||
Це звичайна функція, яка може отримувати параметри. |
|||
|
|||
Вона може бути асинхронною `async def` або звичайною `def` функцією – **FastAPI** обробить її правильно. |
|||
|
|||
У нашому випадку функція записує у файл (імітуючи надсилання email). |
|||
|
|||
І оскільки операція запису не використовує `async` та `await`, ми визначаємо функцію як звичайну `def`: |
|||
|
|||
{* ../../docs_src/background_tasks/tutorial001.py hl[6:9] *} |
|||
|
|||
## Додавання фонової задачі |
|||
|
|||
Усередині Вашої *функції обробки шляху*, передайте функцію задачі в об'єкт *background tasks*, використовуючи метод `.add_task()`: |
|||
|
|||
{* ../../docs_src/background_tasks/tutorial001.py hl[14] *} |
|||
|
|||
`.add_task()` приймає аргументи: |
|||
|
|||
* Функція задача, яка буде виконуватися у фоновому режимі (`write_notification`). Зверніть увагу, що передається обʼєкт без дужок. |
|||
* Будь-яка послідовність аргументів, які потрібно передати у функцію завдання у відповідному порядку (`email`). |
|||
* Будь-які іменовані аргументи, які потрібно передати у функцію задачу (`message="some notification"`). |
|||
|
|||
## Впровадження залежностей |
|||
|
|||
Використання `BackgroundTasks` також працює з системою впровадження залежностей. Ви можете оголосити параметр типу `BackgroundTasks` на різних рівнях: у *функції операції шляху*, у залежності (dependable), у під залежності тощо. |
|||
|
|||
**FastAPI** знає, як діяти в кожному випадку і як повторно використовувати один і той самий об'єкт, щоб усі фонові задачі були об’єднані та виконувалися у фоновому режимі після завершення основного запиту. |
|||
|
|||
{* ../../docs_src/background_tasks/tutorial002_an_py310.py hl[13,15,22,25] *} |
|||
|
|||
У цьому прикладі повідомлення будуть записані у файл `log.txt` *після* того, як відповідь буде надіслана. |
|||
|
|||
Якщо у запиті був переданий query-параметр, він буде записаний у лог у фоновій задачі. |
|||
|
|||
А потім інша фонова задача, яка створюється у *функції операції шляху*, запише повідомлення з використанням path параметра `email`. |
|||
|
|||
## Технічні деталі |
|||
|
|||
Клас `BackgroundTasks` походить безпосередньо з <a href="https://www.starlette.io/background/" class="external-link" target="_blank">`starlette.background`</a>. |
|||
|
|||
Він імпортується безпосередньо у FastAPI, щоб Ви могли використовувати його з `fastapi` і випадково не імпортували `BackgroundTask` (без s в кінці) з `starlette.background`. |
|||
|
|||
Якщо використовувати лише `BackgroundTasks` (а не `BackgroundTask`), то його можна передавати як параметр у *функції операції шляху*, і **FastAPI** подбає про все інше, так само як і про використання об'єкта `Request`. |
|||
|
|||
Також можна використовувати `BackgroundTask` окремо в FastAPI, але для цього Вам доведеться створити об'єкт у коді та повернути Starlette `Response`, включаючи його. |
|||
|
|||
Детальніше можна почитати в <a href="https://www.starlette.io/background/" class="external-link" target="_blank">офіційній документації Starlette про фонові задачі </a>. |
|||
|
|||
## Застереження |
|||
|
|||
Якщо Вам потрібно виконувати складні фонові обчислення, і при цьому нема потреби запускати їх у тому ж процесі (наприклад, не потрібно спільного доступу до пам’яті чи змінних), можливо, варто скористатися більш потужними інструментами, такими як <a href="https://docs.celeryq.dev" class="external-link" target="_blank">Celery</a>. |
|||
|
|||
Такі інструменти зазвичай потребують складнішої конфігурації та менеджера черги повідомлень/завдань, наприклад, RabbitMQ або Redis. Однак вони дозволяють виконувати фонові задачі в кількох процесах і навіть на кількох серверах. |
|||
|
|||
Якщо ж Вам потрібно отримати доступ до змінних і об’єктів із тієї ж **FastAPI** - програми або виконувати невеликі фонові завдання (наприклад, надсилати сповіщення електронною поштою), достатньо просто використовувати `BackgroundTasks`. |
|||
|
|||
## Підсумок |
|||
|
|||
Імпортуйте та використовуйте `BackgroundTasks` як параметр у *функціях операції шляху* та залежностях, щоб додавати фонові задачі. |
@ -0,0 +1,116 @@ |
|||
# Тіло – Оновлення |
|||
|
|||
## Оновлення з використанням `PUT` |
|||
|
|||
Щоб оновити елемент, Ви можете використати <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT" class="external-link" target="_blank">HTTP `PUT`</a> операцію. |
|||
|
|||
Ви можете використати `jsonable_encoder`, щоб перетворити вхідні дані на такі, які можна зберігати як JSON (наприклад, у NoSQL базі даних). Наприклад, перетворюючи `datetime` у `str`. |
|||
|
|||
{* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} |
|||
|
|||
`PUT` використовується для отримання даних, які мають замінити чинні дані. |
|||
|
|||
### Попередження про заміну |
|||
|
|||
Це означає, що якщо Ви хочете оновити елемент `bar`, використовуючи `PUT` з тілом: |
|||
|
|||
```Python |
|||
{ |
|||
"name": "Barz", |
|||
"price": 3, |
|||
"description": None, |
|||
} |
|||
``` |
|||
|
|||
оскільки він не містить вже збереженого атрибута `"tax": 20.2`, модель введення прийме значення за замовчуванням `"tax": 10.5`. |
|||
|
|||
І дані будуть збережені з цим "новим" значенням `tax` = `10.5`. |
|||
|
|||
## Часткові оновлення з `PATCH` |
|||
|
|||
Ви також можете використовувати операцію <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH" class="external-link" target="_blank">HTTP `PATCH`</a> для *часткового* оновлення даних. |
|||
|
|||
Це означає, що Ви можете надіслати лише ті дані, які хочете оновити, залишаючи інші без змін. |
|||
|
|||
/// note | Примітка |
|||
|
|||
`PATCH` менш відомий і рідше використовується, ніж `PUT`. |
|||
|
|||
І багато команд використовують лише `PUT`, навіть для часткових оновлень. |
|||
|
|||
Ви **вільні** використовувати їх так, як хочете, **FastAPI** не накладає обмежень. |
|||
|
|||
Але цей посібник показує Вам більш-менш як їх задумано використовувати. |
|||
|
|||
/// |
|||
|
|||
### Використання параметра `exclude_unset` у Pydantic |
|||
|
|||
Якщо Ви хочете отримати часткові оновлення, дуже зручно використовувати параметр `exclude_unset` у методі `.model_dump()` моделі Pydantic. |
|||
|
|||
Наприклад: `item.model_dump(exclude_unset=True)`. |
|||
|
|||
/// info | Інформація |
|||
|
|||
У Pydantic v1 цей метод називався `.dict()`, він був застарілий (але все ще підтримується) у Pydantic v2, і був перейменований у `.model_dump()`. |
|||
|
|||
Приклади тут використовують `.dict()` для сумісності з Pydantic v1, але Вам слід використовувати `.model_dump()`, якщо можете використовувати Pydantic v2. |
|||
|
|||
/// |
|||
|
|||
Це створить `dict` лише з тими даними, які були явно встановлені під час створення моделі `item`, виключаючи значення за замовчуванням. |
|||
|
|||
Тоді Ви можете використовувати це, щоб створити `dict` лише з даними, які були встановлені (надіслані у запиті), пропускаючи значення за замовчуванням: |
|||
|
|||
{* ../../docs_src/body_updates/tutorial002_py310.py hl[32] *} |
|||
|
|||
### Використання параметра `update` у Pydantic |
|||
|
|||
Тепер Ви можете створити копію наявної моделі за допомогою `.model_copy()`, і передати параметр `update` з `dict` , який містить дані для оновлення. |
|||
|
|||
/// info | Інформація |
|||
|
|||
У Pydantic v1 метод називався `.copy()`, він був застарілий (але все ще підтримується) у Pydantic v2, і був перейменований у `.model_copy()`. |
|||
|
|||
Приклади тут використовують `.copy()` для сумісності з Pydantic v1, але якщо Ви можете використовувати Pydantic v2 — Вам слід використовувати `.model_copy()` замість цього. |
|||
|
|||
/// |
|||
|
|||
Наприклад: `stored_item_model.model_copy(update=update_data)`: |
|||
|
|||
{* ../../docs_src/body_updates/tutorial002_py310.py hl[33] *} |
|||
|
|||
### Підсумок часткових оновлень |
|||
|
|||
У підсумку, щоб застосувати часткові оновлення, Ви: |
|||
|
|||
* (Опціонально) використовуєте `PATCH` замість `PUT`. |
|||
* Отримуєте збережені дані. |
|||
* Поміщаєте ці дані в модель Pydantic. |
|||
* Генеруєте `dict` без значень за замовчуванням з моделі введення (використовуючи `exclude_unset`). |
|||
* Таким чином Ви оновите лише ті значення, які були явно задані користувачем, замість того, щоб перезаписувати вже збережені значення значеннями за замовчуванням з вашої моделі. |
|||
* Створюєте копію збереженої моделі, оновлюючи її атрибути отриманими частковими оновленнями (використовуючи параметр `update`). |
|||
* Перетворюєте скопійовану модель на щось, що можна зберегти у вашу БД (наприклад, використовуючи `jsonable_encoder`). |
|||
* Це можна порівняти з повторним використанням методу `.model_dump()` моделі, але це гарантує (і перетворює) значення у типи даних, які можна перетворити на JSON, наприклад, `datetime` на `str`. |
|||
* Зберігаєте дані у вашу БД. |
|||
* Повертаєте оновлену модель. |
|||
|
|||
{* ../../docs_src/body_updates/tutorial002_py310.py hl[28:35] *} |
|||
|
|||
/// tip | Порада |
|||
|
|||
Насправді Ви можете використовувати цю саму техніку і з операцією HTTP `PUT`. |
|||
|
|||
Але приклад тут використовує `PATCH`, тому що він був створений саме для таких випадків. |
|||
|
|||
/// |
|||
|
|||
/// note | Примітка |
|||
|
|||
Зверніть увагу, що модель запиту все ще проходить валідацію. |
|||
|
|||
Тож, якщо Ви хочете отримувати часткові оновлення, які можуть не містити жодного атрибута, Вам потрібно мати модель, де всі атрибути позначені як необов’язкові (зі значеннями за замовчуванням або `None`). |
|||
|
|||
Щоб розрізняти моделі з усіма необов’язковими значеннями для **оновлення** і моделі з обов’язковими значеннями для **створення**, Ви можете скористатись ідеями, описаними у [Додаткові моделі](extra-models.md){.internal-link target=_blank}. |
|||
|
|||
/// |
@ -0,0 +1,89 @@ |
|||
# CORS (Обмін ресурсами між різними джерелами) |
|||
|
|||
<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" class="external-link" target="_blank">CORS або "Обмін ресурсами між різними джерелами"</a> є ситуація, коли фронтенд, що працює в браузері, містить JavaScript-код, який взаємодіє з бекендом, розташованим в іншому "джерелі" (origin). |
|||
|
|||
## Джерело (Origin) |
|||
|
|||
Джерело визначається комбінацією протоколу (`http`, `https`), домену (`myapp.com`, `localhost`, `localhost.tiangolo.com`), порту (`80`, `443`, `8080`). |
|||
|
|||
|
|||
Наприклад, такі адреси вважаються різними джерелами: |
|||
|
|||
* `http://localhost` |
|||
* `https://localhost` |
|||
* `http://localhost:8080` |
|||
|
|||
Навіть якщо вони всі містять `localhost`, вони мають різні протоколи або порти, що робить їх окремими "джерелами". |
|||
|
|||
## Кроки |
|||
|
|||
Припустимо, що Ваш фронтенд працює в браузері на `http://localhost:8080`, а його JavaScript намагається відправити запит до бекенду, який працює на `http://localhost` (Оскільки ми не вказуємо порт, браузер за замовчуванням припускає порт `80`). |
|||
|
|||
Потім браузер надішле HTTP-запит `OPTIONS` до бекенду на порту `:80`, і якщо бекенд надішле відповідні заголовки, що дозволяють комунікацію з цього іншого джерела (`http://localhost:8080`), тоді браузер на порту `:8080` дозволить JavaScript у фронтенді надіслати свій запит до бекенду на порту `:80`. |
|||
|
|||
Щоб досягти цього, бекенд на порту `:80` повинен мати список "дозволених джерел". |
|||
|
|||
У цьому випадку список має містити `http://localhost:8080`, щоб фронтенд на порту `:8080` працював коректно. |
|||
|
|||
## Символьне підставляння |
|||
|
|||
Можна також оголосити список як `"*"` ("символьне підставляння"), що означає дозвіл для всіх джерел. |
|||
|
|||
Однак це дозволить лише певні типи комунікації, виключаючи все, що пов'язане з обліковими даними: Cookies, заголовки авторизації, такі як ті, що використовуються з Bearer токенами тощо. |
|||
|
|||
Тому для коректної роботи краще явно вказувати дозволені джерела. |
|||
|
|||
## Використання `CORSMiddleware` |
|||
|
|||
Ви можете налаштувати це у Вашому додатку **FastAPI** за допомогою `CORSMiddleware`. |
|||
|
|||
* Імпортуйте `CORSMiddleware`. |
|||
* Створіть список дозволених джерел (у вигляді рядків). |
|||
* Додайте його як "middleware" у Ваш додаток **FastAPI**. |
|||
|
|||
|
|||
Також можна вказати, чи дозволяє Ваш бекенд: |
|||
|
|||
* Облікові дані (заголовки авторизації, сookies, тощо). |
|||
* Конкретні HTTP-методи (`POST`, `PUT`) або всі за допомогою `"*"` |
|||
* Конкретні HTTP-заголовки або всі за допомогою `"*"`. |
|||
|
|||
|
|||
{* ../../docs_src/cors/tutorial001.py hl[2,6:11,13:19] *} |
|||
|
|||
Параметри за замовчуванням у `CORSMiddleware` є досить обмеженими, тому Вам потрібно явно вказати конкретні джерела, методи або заголовки, щоб браузери могли використовувати їх у контексті запитів між різними доменами. |
|||
|
|||
|
|||
Підтримуються такі аргументи: |
|||
|
|||
* `allow_origins` - Список джерел, яким дозволено здійснювати міждоменні запити. Наприклад `['https://example.org', 'https://www.example.org']`. Ви можете використовувати ['*'], щоб дозволити всі джерела. |
|||
* `allow_origin_regex` - Рядок регулярного виразу для відповідності джерелам, яким дозволено здійснювати міждоменні запити. Наприклад, `'https://.*\.example\.org'`. |
|||
* `allow_methods` - Список HTTP-методів, дозволених для міждоменних запитів. За замовчуванням `['GET']`. Ви можете використовувати `['*']`, щоб дозволити всі стандартні методи. |
|||
* `allow_headers` - Список HTTP-заголовків, які підтримуються для міждоменних запитів. За замовчуванням `[]`. Ви можете використовувати `['*']`, щоб дозволити всі заголовки. Заголовки `Accept`, `Accept-Language`, `Content-Language` і `Content-Type` завжди дозволені для <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests" class="external-link" rel="noopener" target="_blank">простих CORS-запитів</a>. |
|||
* `allow_credentials` - Визначає, чи підтримуються файли cookie для міждоменних запитів. За замовчуванням `False`. Також, якщо потрібно дозволити обмін обліковими даними (`allow_credentials = True`), параметр `allow_origins` не може бути встановлений як `['*']`, необхідно вказати конкретні джерела. |
|||
* `expose_headers` - Вказує, які заголовки відповіді повинні бути доступні для браузера. За замовчуванням `[]`. |
|||
* `max_age` - Встановлює максимальний час (у секундах) для кешування CORS-відповідей у браузерах. За замовчуванням `600`. |
|||
|
|||
Цей middleware обробляє два типи HTTP-запитів... |
|||
|
|||
### Попередні CORS-запити (preflight requests) |
|||
|
|||
Це будь-які `OPTIONS` - запити, що містять заголовки `Origin` та `Access-Control-Request-Method`. |
|||
|
|||
У такому випадку middleware перехопить вхідний запит і відповість відповідними CORS-заголовками, повертаючи або `200`, або `400` для інформаційних цілей. |
|||
|
|||
### Прості запити |
|||
|
|||
Будь-які запити із заголовком `Origin`. У цьому випадку middleware пропустить запит як звичайний, але додасть відповідні CORS-заголовки у відповідь. |
|||
|
|||
## Додаткова інформація |
|||
|
|||
Більше про <abbr title="Cross-Origin Resource Sharing">CORS</abbr> можна дізнатися в <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" class="external-link" target="_blank">документації Mozilla</a>. |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Також можна використовувати `from starlette.middleware.cors import CORSMiddleware`. |
|||
|
|||
**FastAPI** надає кілька middleware у `fastapi.middleware` для зручності розробників. Але більшість доступних middleware походять безпосередньо зі Starlette. |
|||
|
|||
/// |
@ -0,0 +1,255 @@ |
|||
# Обробка Помилок |
|||
|
|||
Є багато ситуацій, коли потрібно повідомити клієнта, який використовує Ваш API, про помилку. |
|||
|
|||
Цим клієнтом може бути браузер із фронтендом, код іншого розробника, IoT-пристрій тощо. |
|||
|
|||
Можливо, Вам потрібно повідомити клієнта, що: |
|||
|
|||
* У нього недостатньо прав для виконання цієї операції. |
|||
* Він не має доступу до цього ресурсу. |
|||
* Елемент, до якого він намагається отримати доступ, не існує. |
|||
* тощо. |
|||
|
|||
У таких випадках зазвичай повертається **HTTP статус-код** в діапазоні **400** (від 400 до 499). |
|||
|
|||
Це схоже на HTTP статус-коди 200 (від 200 до 299). Ці "200" статус-коди означають, що запит пройшов успішно. |
|||
|
|||
Статус-коди в діапазоні 400 означають, що сталася помилка з боку клієнта. |
|||
|
|||
Пам'ятаєте всі ці помилки **404 Not Found** (і жарти про них)? |
|||
|
|||
## Використання `HTTPException` |
|||
|
|||
Щоб повернути HTTP-відповіді з помилками клієнту, використовуйте `HTTPException`. |
|||
|
|||
### Імпорт `HTTPException` |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial001.py hl[1] *} |
|||
|
|||
### Використання `HTTPException` у коді |
|||
|
|||
`HTTPException` — це звичайна помилка Python із додатковими даними, які стосуються API. |
|||
|
|||
Оскільки це помилка Python, Ви не `повертаєте` його, а `генеруєте` (генеруєте помилку). |
|||
|
|||
Це також означає, що якщо Ви перебуваєте всередині допоміжної функції, яку викликаєте всередині своєї *функції операції шляху*, і там генеруєте `HTTPException`, всередині цієї допоміжної функції, то решта коду в *функції операції шляху* не буде виконана. Запит одразу завершиться, і HTTP-помилка з `HTTPException` буде надіслана клієнту. |
|||
|
|||
Перевага використання `генерації` (raise) помилки замість `повернення` значення (return) стане більш очевидним в розділі про Залежності та Безпеку. |
|||
|
|||
У цьому прикладі, якщо клієнт запитує елемент за ID, якого не існує, буде згенеровано помилку зі статус-кодом `404`: |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial001.py hl[11] *} |
|||
|
|||
### Отримана відповідь |
|||
|
|||
Якщо клієнт робить запит за шляхом `http://example.com/items/foo` (де `item_id` `"foo"`), він отримає статус-код 200 і JSON відповідь: |
|||
|
|||
```JSON |
|||
{ |
|||
"item": "The Foo Wrestlers" |
|||
} |
|||
``` |
|||
|
|||
Але якщо клієнт робить запит на `http://example.com/items/bar` (де `item_id` має не існуюче значення `"bar"`), то отримає статус-код 404 (помилка "не знайдено") та відповідь: |
|||
|
|||
```JSON |
|||
{ |
|||
"detail": "Item not found" |
|||
} |
|||
``` |
|||
|
|||
/// tip | Порада |
|||
|
|||
Під час виклику `HTTPException` Ви можете передати будь-яке значення, яке може бути перетворене в JSON, як параметр `detail`, а не лише рядок (`str`). |
|||
|
|||
Ви можете передати `dict`, `list` тощо. |
|||
|
|||
Вони обробляються автоматично за допомогою **FastAPI** та перетворюються в JSON. |
|||
|
|||
/// |
|||
|
|||
## Додавання власних заголовків |
|||
|
|||
Іноді потрібно додати власні заголовки до HTTP-помилки, наприклад, для певних типів безпеки. |
|||
|
|||
Ймовірно, Вам не доведеться використовувати це безпосередньо у своєму коді. |
|||
|
|||
Але якщо Вам знадобиться це для складного сценарію, Ви можете додати власні заголовки: |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial002.py hl[14] *} |
|||
|
|||
## Встановлення власних обробників помилок |
|||
|
|||
Ви можете додати власні обробники помилок за допомогою <a href="https://www.starlette.io/exceptions/" class="external-link" target="_blank">тих самих утиліт обробки помилок зі Starlette</a>. |
|||
|
|||
Припустимо, у Вас є власний обʼєкт помилки `UnicornException`, яке Ви (або бібліотека, яку Ви використовуєте) може `згенерувати` (`raise`). |
|||
|
|||
І Ви хочете обробляти це виключення глобально за допомогою FastAPI. |
|||
|
|||
Ви можете додати власний обробник виключень за допомогою `@app.exception_handler()`: |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial003.py hl[5:7,13:18,24] *} |
|||
|
|||
Тут, якщо Ви звернетеся до `/unicorns/yolo`, то згенерується помилка `UnicornException`. |
|||
|
|||
Але вона буде оброблена функцією-обробником `unicorn_exception_handler`. |
|||
|
|||
Отже, Ви отримаєте зрозумілу помилку зі HTTP-статусом `418` і JSON-відповіддю: |
|||
|
|||
```JSON |
|||
{"message": "Oops! yolo did something. There goes a rainbow..."} |
|||
``` |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Ви також можете використовувати `from starlette.requests import Request` і `from starlette.responses import JSONResponse`. |
|||
|
|||
**FastAPI** надає ті самі `starlette.responses`, що й `fastapi.responses`, просто для зручності розробника. Але більшість доступних відповідей надходять безпосередньо зі Starlette. Те ж саме стосується і `Request`. |
|||
|
|||
/// |
|||
|
|||
## Перевизначення обробників помилок за замовчуванням |
|||
|
|||
**FastAPI** має кілька обробників помилок за замовчуванням. |
|||
|
|||
Ці обробники відповідають за повернення стандартних JSON-відповідей, коли Ви `генеруєте` (`raise`) `HTTPException`, а також коли запит містить некоректні дані. |
|||
|
|||
Ви можете перевизначити ці обробники, створивши власні. |
|||
|
|||
### Перевизначення помилок валідації запиту |
|||
|
|||
Коли запит містить некоректні дані, **FastAPI** генерує `RequestValidationError`. |
|||
|
|||
І також включає обробник помилок за замовчуванням для нього. |
|||
|
|||
Щоб перевизначити його, імпортуйте `RequestValidationError` і використовуйте його з `@app.exception_handler(RequestValidationError)` для декорування обробника помилок. |
|||
|
|||
Обробник помилок отримує `Request` і саму помилку. |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial004.py hl[2,14:16] *} |
|||
|
|||
Тепер, якщо Ви перейдете за посиланням `/items/foo`, замість того, щоб отримати стандартну JSON-помилку: |
|||
|
|||
```JSON |
|||
{ |
|||
"detail": [ |
|||
{ |
|||
"loc": [ |
|||
"path", |
|||
"item_id" |
|||
], |
|||
"msg": "value is not a valid integer", |
|||
"type": "type_error.integer" |
|||
} |
|||
] |
|||
} |
|||
``` |
|||
|
|||
Ви отримаєте текстову версію: |
|||
|
|||
``` |
|||
1 validation error |
|||
path -> item_id |
|||
value is not a valid integer (type=type_error.integer) |
|||
``` |
|||
|
|||
#### `RequestValidationError` проти `ValidationError` |
|||
|
|||
/// warning | Увага |
|||
|
|||
Це технічні деталі, які Ви можете пропустити, якщо вони зараз не важливі для Вас. |
|||
|
|||
/// |
|||
|
|||
`RequestValidationError` є підкласом Pydantic <a href="https://docs.pydantic.dev/latest/concepts/models/#error-handling" class="external-link" target="_blank">`ValidationError`</a>. |
|||
|
|||
**FastAPI** використовує його для того, якщо Ви використовуєте модель Pydantic у `response_model` і у ваших даних є помилка, Ви побачили помилку у своєму журналі. |
|||
|
|||
Але клієнт/користувач не побачить її. Натомість клієнт отримає "Internal Server Error" зі статусом HTTP `500`. |
|||
|
|||
Так має бути, якщо у Вас виникла `ValidationError` Pydantic у *відповіді* або деінде у вашому коді (не у *запиті* клієнта), це насправді є помилкою у Вашому коді. |
|||
|
|||
І поки Ви її виправляєте, клієнти/користувачі не повинні мати доступу до внутрішньої інформації про помилку, оскільки це може призвести до вразливості безпеки. |
|||
|
|||
### Перевизначення обробника помилок `HTTPException` |
|||
|
|||
Аналогічно, Ви можете перевизначити обробник `HTTPException`. |
|||
|
|||
Наприклад, Ви можете захотіти повернути текстову відповідь замість JSON для цих помилок: |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial004.py hl[3:4,9:11,22] *} |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Ви також можете використовувати `from starlette.responses import PlainTextResponse`. |
|||
|
|||
**FastAPI** надає ті самі `starlette.responses`, що й `fastapi.responses`, просто для зручності розробника. Але більшість доступних відповідей надходять безпосередньо зі Starlette. |
|||
|
|||
/// |
|||
|
|||
### Використання тіла `RequestValidationError` |
|||
|
|||
`RequestValidationError` містить `body`, який він отримав із некоректними даними. |
|||
|
|||
Ви можете використовувати це під час розробки свого додатка, щоб логувати тіло запиту та налагоджувати його, повертати користувачеві тощо. |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial005.py hl[14] *} |
|||
|
|||
Тепер спробуйте надіслати некоректний елемент, наприклад: |
|||
|
|||
```JSON |
|||
{ |
|||
"title": "towel", |
|||
"size": "XL" |
|||
} |
|||
``` |
|||
Ви отримаєте відповідь, яка повідомить Вам, які саме дані є некоректні у вашому тілі запиту: |
|||
|
|||
|
|||
```JSON hl_lines="12-15" |
|||
{ |
|||
"detail": [ |
|||
{ |
|||
"loc": [ |
|||
"body", |
|||
"size" |
|||
], |
|||
"msg": "value is not a valid integer", |
|||
"type": "type_error.integer" |
|||
} |
|||
], |
|||
"body": { |
|||
"title": "towel", |
|||
"size": "XL" |
|||
} |
|||
} |
|||
``` |
|||
|
|||
#### `HTTPException` FastAPI проти `HTTPException` Starlette |
|||
|
|||
**FastAPI** має власний `HTTPException`. |
|||
|
|||
І клас помилки `HTTPException` в **FastAPI** успадковується від класу помилки `HTTPException` в Starlette. |
|||
|
|||
Єдина різниця полягає в тому, що `HTTPException` в **FastAPI** приймає будь-які дані, які можна перетворити на JSON, для поля `detail`, тоді як `HTTPException` у Starlette приймає тільки рядки. |
|||
|
|||
Отже, Ви можете продовжувати використовувати `HTTPException` в **FastAPI** як зазвичай у своєму коді. |
|||
|
|||
Але коли Ви реєструєте обробник виключень, слід реєструвати його для `HTTPException` зі Starlette. |
|||
|
|||
Таким чином, якщо будь-яка частина внутрішнього коду Starlette або розширення чи плагін Starlette згенерує (raise) `HTTPException`, Ваш обробник зможе перехопити та обробити її. |
|||
|
|||
У цьому прикладі, щоб мати можливість використовувати обидва `HTTPException` в одному коді, помилка Starlette перейменовується на `StarletteHTTPException`: |
|||
|
|||
```Python |
|||
from starlette.exceptions import HTTPException as StarletteHTTPException |
|||
``` |
|||
|
|||
### Повторне використання обробників помилок **FastAPI** |
|||
|
|||
Якщо Ви хочете використовувати помилки разом із такими ж обробниками помилок за замовчуванням, як у **FastAPI**, Ви можете імпортувати та повторно використовувати їх із `fastapi.exception_handlers`: |
|||
|
|||
{* ../../docs_src/handling_errors/tutorial006.py hl[2:5,15,21] *} |
|||
|
|||
У цьому прикладі Ви просто використовуєте `print` для виведення дуже інформативного повідомлення, але Ви зрозуміли основну ідею. Ви можете обробити помилку та повторно використовувати обробники помилок за замовчуванням. |
@ -0,0 +1,75 @@ |
|||
# Middleware (Проміжний шар) |
|||
|
|||
У **FastAPI** можна додавати middleware (проміжний шар). |
|||
|
|||
"Middleware" — це функція, яка працює з кожним **запитом** перед його обробкою будь-якою конкретною *операцією шляху* (*path operation*), а також з кожною **відповіддю** перед її поверненням. |
|||
|
|||
* Middleware отримує кожен **запит**, що надходить до Вашого застосунку. |
|||
* Може виконати певні дії із цим **запитом** або запустити необхідний код. |
|||
* Далі передає **запит** для обробки основним застосунком (*операцією шляху*). |
|||
* Отримує **відповідь**, сформовану застосунком (*операцією шляху*). |
|||
* Може змінити цю **відповідь** або виконати додатковий код. |
|||
* Повертає **відповідь** клієнту. |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Якщо у Вас є залежності з `yield`, код виходу виконається *після* middleware. |
|||
|
|||
Якщо були заплановані фонові задачі (background tasks - розглянуто далі), вони виконаються *після* всіх middleware. |
|||
|
|||
/// |
|||
|
|||
## Створення middleware |
|||
|
|||
Щоб створити middleware, Ви використовуєте декоратор `@app.middleware("http")` на функції. |
|||
|
|||
Функція middleware отримує: |
|||
|
|||
* `Запит`. |
|||
* Функцію `call_next`, яка приймає `запит` як параметр. |
|||
* Ця функція передає `запит` відповідній *операції шляху*. |
|||
* Потім вона повертає `відповідь`, згенеровану цією *операцією шляху*. |
|||
|
|||
* Ви можете ще змінити `відповідь` перед тим, як повернути її. |
|||
|
|||
|
|||
{* ../../docs_src/middleware/tutorial001.py hl[8:9,11,14] *} |
|||
|
|||
/// tip | Порада |
|||
|
|||
Не забувайте, що власні заголовки можна додавати, використовуючи <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">префікс 'X-'</a>. |
|||
|
|||
Але якщо у Вас є власні заголовки, які Ви хочете, щоб браузерний клієнт міг побачити, потрібно додати їх до Вашої конфігурації CORS (див. [CORS (Обмін ресурсами між різними джерелами)](cors.md){.internal-link target=_blank} за допомогою параметра `expose_headers`, описаного в <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">документації Starlette по CORS</a>. |
|||
|
|||
/// |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Ви також можете використати `from starlette.requests import Request`. |
|||
|
|||
**FastAPI** надає це для Вашої зручності як розробника. Але він походить безпосередньо зі Starlette. |
|||
|
|||
/// |
|||
|
|||
### До і після `response`(`відповіді`) |
|||
|
|||
Ви можете додати код, який буде виконуватися з `запитом` (`request`), до того, як його обробить будь-яка *операція шляху* (*path operation*). |
|||
|
|||
Також Ви можете додати код, який буде виконуватися після того, як `відповідь` (`response`) буде згенеровано, перед тим як його повернути. |
|||
|
|||
Наприклад, Ви можете додати власний заголовок `X-Process-Time`, який міститиме час у секундах, який витратився на обробку запиту та генерацію відповіді: |
|||
|
|||
{* ../../docs_src/middleware/tutorial001.py hl[10,12:13] *} |
|||
|
|||
|
|||
/// tip | Підказка |
|||
|
|||
Тут ми використовуємо <a href="https://docs.python.org/3/library/time.html#time.perf_counter" class="external-link" target="_blank">`time.perf_counter()`</a> замість `time.time()` оскільки він може бути більш точним для таких випадків. 🤓 |
|||
|
|||
/// |
|||
|
|||
## Інші middlewares |
|||
|
|||
Ви можете пізніше прочитати більше про інші middlewares в [Advanced User Guide: Advanced Middleware](../advanced/middleware.md){.internal-link target=_blank}. |
|||
|
|||
Ви дізнаєтесь, як обробляти <abbr title="Cross-Origin Resource Sharing">CORS</abbr> за допомогою middleware в наступному розділі. |
@ -0,0 +1,165 @@ |
|||
# Path Параметри та валідація числових даних |
|||
|
|||
Так само як Ви можете оголошувати додаткові перевірки та метадані для query параметрів за допомогою `Query`, Ви можете оголошувати той самий тип перевірок і метаданих для параметрів шляху за допомогою `Path`. |
|||
|
|||
## Імпорт Path |
|||
|
|||
Спочатку імпортуйте `Path` з `fastapi` і імпортуйте `Annotated`: |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[1,3] *} |
|||
|
|||
/// info | Інформація |
|||
|
|||
FastAPI додав підтримку `Annotated` (і почав рекомендувати його використання) у версії 0.95.0. |
|||
|
|||
Якщо у Вас стара версія, при спробі використати `Annotated` можуть виникати помилки. |
|||
|
|||
Переконайтеся, що Ви [оновили версію FastAPI](../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} принаймні до версії 0.95.1 перед використанням `Annotated`. |
|||
|
|||
/// |
|||
|
|||
## Оголошення метаданих |
|||
|
|||
Ви можете оголошувати всі ті ж параметри, що і для `Query`. |
|||
|
|||
Наприклад, щоб оголосити значення метаданих `title` для параметра шляху `item_id`, Ви можете написати: |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[10] *} |
|||
|
|||
/// note | Примітка |
|||
|
|||
Параметр шляху завжди є обов’язковим, оскільки він має бути частиною шляху. Навіть якщо Ви оголосите його зі значенням `None` або встановите значення за замовчуванням — він все одно залишатиметься обов’язковим. |
|||
|
|||
/// |
|||
|
|||
## Упорядковуйте параметри, як Вам потрібно |
|||
|
|||
/// tip | Підказка |
|||
|
|||
Це, мабуть, не настільки важливо або необхідно, якщо Ви використовуєте `Annotated`. |
|||
|
|||
/// |
|||
|
|||
Припустимо, Ви хочете оголосити параметр запиту `q` як обов’язковий `str`. |
|||
|
|||
І Вам не потрібно оголошувати нічого іншого для цього параметра, тому немає потреби використовувати `Query`. |
|||
|
|||
Але Вам все одно потрібно використовувати `Path` для параметра шляху `item_id`. І з певних причин Ви не хочете використовувати `Annotated`. |
|||
|
|||
Python видасть помилку, якщо розмістити значення з "default" перед значенням, яке не має "default". |
|||
|
|||
Але Ви можете змінити порядок і розмістити значення без значення за замовчуванням (параметр запиту `q`) першим. |
|||
|
|||
|
|||
Для **FastAPI** порядок не має значення. Він визначає параметри за їх іменами, типами та значеннями за замовчуванням (`Query`, `Path` тощо) і не звертає уваги на порядок. |
|||
|
|||
Тому Ви можете оголосити Вашу функцію так: |
|||
|
|||
//// tab | Python 3.8 non-Annotated |
|||
|
|||
/// tip | Підказка |
|||
|
|||
За можливості віддавайте перевагу версії з використанням `Annotated`. |
|||
|
|||
/// |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial002.py hl[7] *} |
|||
|
|||
//// |
|||
|
|||
Але майте на увазі, що якщо Ви використовуєте `Annotated`, ця проблема не виникне, оскільки Ви не використовуєте значення за замовчуванням для параметрів `Query()` або `Path()`. |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py *} |
|||
|
|||
## Упорядковуйте параметри за потребою, хитрощі |
|||
|
|||
/// tip | Підказка |
|||
|
|||
Це, мабуть, не настільки важливо або необхідно, якщо Ви використовуєте `Annotated`. |
|||
|
|||
/// |
|||
|
|||
Ось **невелика хитрість**, яка може стати в пригоді, хоча вона рідко знадобиться. |
|||
|
|||
Якщо Ви хочете: |
|||
|
|||
* оголосити параметр запиту `q` без використання `Query` або значення за замовчуванням |
|||
* оголосити параметр шляху `item_id`, використовуючи `Path` |
|||
* розмістити їх у різному порядку |
|||
* не використовувати `Annotated` |
|||
|
|||
...у Python є спеціальний синтаксис для цього. |
|||
|
|||
Передайте `*` як перший параметр функції. |
|||
|
|||
Python нічого не зробить із цією `*`, але розпізнає, що всі наступні параметри слід викликати як аргументи за ключовим словом (пари ключ-значення), також відомі як <abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. Навіть якщо вони не мають значення за замовчуванням. |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial003.py hl[7] *} |
|||
|
|||
### Краще з `Annotated` |
|||
|
|||
Майте на увазі, якщо Ви використовуєте `Annotated`, оскільки Ви не використовуєте значення за замовчуванням для параметрів функції, цієї проблеми не виникне, і, швидше за все, Вам не потрібно буде використовувати `*`. |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py hl[10] *} |
|||
|
|||
## Валідація числових даних: більше або дорівнює |
|||
|
|||
За допомогою `Query` і `Path` (та інших, які Ви побачите пізніше) можна оголошувати числові обмеження. |
|||
|
|||
Тут, завдяки `ge=1`, `item_id` має бути цілим числом, яке "`g`reater than or `e`qual" (більше або дорівнює) `1`. |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py hl[10] *} |
|||
|
|||
## Валідація числових даних: більше ніж і менше або дорівнює |
|||
|
|||
Те саме застосовується до: |
|||
|
|||
* `gt`: `g`reater `t`han (більше ніж) |
|||
* `le`: `l`ess than or `e`qual (менше або дорівнює) |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py hl[10] *} |
|||
|
|||
## Валідація числових даних: float, більше ніж і менше ніж |
|||
|
|||
Валідація чисел також працює для значень типу `float`. |
|||
|
|||
Ось де стає важливо мати можливість оголошувати <abbr title="greater than (більше ніж)"><code>gt</code></abbr>, а не тільки <abbr title="greater than or equal (більше або дорівнює)"><code>ge</code></abbr>. Це дозволяє, наприклад, вимагати, щоб значення було більше `0`, навіть якщо воно менше `1`. |
|||
|
|||
Таким чином, значення `0.5` буде допустимим. Але `0.0` або `0` — ні. |
|||
|
|||
Те саме стосується <abbr title="less than (менше ніж)"><code>lt</code></abbr>. |
|||
|
|||
{* ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py hl[13] *} |
|||
|
|||
## Підсумок |
|||
|
|||
За допомогою `Query`, `Path` (і інших параметрів, які Ви ще не бачили) можна оголошувати метадані та перевірки рядків, так само як у [Query параметри та валідація рядків](query-params-str-validations.md){.internal-link target=_blank}. |
|||
|
|||
Також можна оголошувати числові перевірки: |
|||
|
|||
* `gt`: `g`reater `t`han (більше ніж) |
|||
* `ge`: `g`reater than or `e`qual (більше або дорівнює) |
|||
* `lt`: `l`ess `t`han (менше ніж) |
|||
* `le`: `l`ess than or `e`qual (менше або дорівнює) |
|||
|
|||
/// info | Інформація |
|||
|
|||
`Query`, `Path` та інші класи, які Ви побачите пізніше, є підкласами спільного класу `Param`. |
|||
|
|||
Всі вони мають однакові параметри для додаткових перевірок і метаданих, які Ви вже бачили. |
|||
|
|||
/// |
|||
|
|||
/// note | Технічні деталі |
|||
|
|||
Коли Ви імпортуєте `Query`, `Path` та інші з `fastapi`, насправді це функції. |
|||
|
|||
При виклику вони повертають екземпляри класів з такими ж іменами. |
|||
|
|||
Тобто Ви імпортуєте `Query`, яка є функцією. А коли Ви її викликаєте, вона повертає екземпляр класу, який теж називається `Query`. |
|||
|
|||
Ці функції створені таким чином (замість використання класів напряму), щоб Ваш редактор не відзначав їхні типи як помилки. |
|||
|
|||
Таким чином, Ви можете користуватися своїм звичайним редактором і інструментами для програмування без додаткових налаштувань для ігнорування таких помилок. |
|||
|
|||
/// |
@ -0,0 +1,68 @@ |
|||
# Моделі Query параметрів |
|||
|
|||
Якщо у Вас є група **query параметрів**, які пов’язані між собою, Ви можете створити **Pydantic-модель** для їх оголошення. |
|||
|
|||
Це дозволить Вам **повторно використовувати модель** у **різних місцях**, а також оголошувати перевірки та метадані для всіх параметрів одночасно. 😎 |
|||
|
|||
/// note | Примітка |
|||
|
|||
Ця можливість підтримується, починаючи з версії FastAPI `0.115.0`. 🤓 |
|||
|
|||
/// |
|||
|
|||
## Query параметри з Pydantic-моделлю |
|||
|
|||
Оголосіть **query параметри**, які Вам потрібні, у **Pydantic-моделі**, а потім оголосіть цей параметр як `Query`: |
|||
|
|||
{* ../../docs_src/query_param_models/tutorial001_an_py310.py hl[9:13,17] *} |
|||
|
|||
**FastAPI** буде **витягувати** дані для **кожного поля** з **query параметрів** у запиті та передавати їх у визначену вами Pydantic-модель. |
|||
|
|||
## Перевірте документацію |
|||
|
|||
Ви можете побачити параметри запиту в UI документації за `/docs`: |
|||
|
|||
<div class="screenshot"> |
|||
<img src="/img/tutorial/query-param-models/image01.png"> |
|||
</div> |
|||
|
|||
## Заборона зайвих Query параметрів |
|||
|
|||
У деяких особливих випадках (ймовірно, не дуже поширених) Ви можете захотіти **обмежити** query параметри, які дозволено отримувати. |
|||
|
|||
Ви можете використати конфігурацію моделі Pydantic, щоб заборонити (`forbid`) будь-які зайві (`extra`) поля: |
|||
|
|||
{* ../../docs_src/query_param_models/tutorial002_an_py310.py hl[10] *} |
|||
|
|||
Якщо клієнт спробує надіслати **зайві** дані у **query параметрах**, він отримає **помилку**. |
|||
|
|||
Наприклад, якщо клієнт спробує надіслати query параметр `tool` зі значенням `plumbus`, як у цьому запиті: |
|||
|
|||
```http |
|||
https://example.com/items/?limit=10&tool=plumbus |
|||
``` |
|||
|
|||
Він отримає відповідь з **помилкою**, яка повідомить, що query параметр `tool ` не дозволено: |
|||
|
|||
```json |
|||
{ |
|||
"detail": [ |
|||
{ |
|||
"type": "extra_forbidden", |
|||
"loc": ["query", "tool"], |
|||
"msg": "Extra inputs are not permitted", |
|||
"input": "plumbus" |
|||
} |
|||
] |
|||
} |
|||
``` |
|||
|
|||
## Підсумок |
|||
|
|||
Ви можете використовувати **Pydantic-моделі** для оголошення **query параметрів** у **FastAPI**. 😎 |
|||
|
|||
/// tip | Підказка |
|||
|
|||
Спойлер: Ви також можете використовувати Pydantic-моделі для оголошення cookie та заголовків, але про це Ви дізнаєтеся пізніше в цьому посібнику. 🤫 |
|||
|
|||
/// |