Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
added nginx chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
rafsaf committed Apr 15, 2021
1 parent 296ebd5 commit b9c1f15
Show file tree
Hide file tree
Showing 11 changed files with 420 additions and 176 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ This project is an attempt at an orderly way through the process of creating mor
- Literally any knowledge of `Docker` (`Docker For Beginners Video on YouTube`, `Dockerfile official reference`).
- `Docker Desktop client` installed on your machine.
- Any experience with cloud platforms like `AWS`, `Azure`, `Digital Ocean`, `Google Cloud` etc. (While an `AWS EC2 instance` will be used in the project, any virtual machine with docker and ssh access will also be excellent).

# Uvicorn

This dead simple application shows you to how to create a simple Docker Image with running FastAPI app with Uvicorn and presenting the basics of creating and running Docker Images.

[See chapter dedicated to this repository](https://docker-fastapi-projects.readthedocs.io/en/latest/uvicorn.html)

# Nginx

This dead simple application shows you to how to create a simple Docker Image with running FastAPI app with Nginx and presenting the basics of creating and running Docker Images.

[See chapter dedicated to this repository](https://docker-fastapi-projects.readthedocs.io/en/latest/nginx.html)
4 changes: 4 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.green {
color: #008000;
font-weight: bold;
}
170 changes: 0 additions & 170 deletions docs/basic_uvicorn.rst

This file was deleted.

4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_css_files = [
'custom.css',
]
48 changes: 48 additions & 0 deletions docs/deployment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Deployment in AWS EC2 instance
==============================

Each of the projects can be easily implemented on the AWS EC2 instance. Since there are tons of articles on this subject, below we will only focus on the stage where you already have access to the console on the instance.

.. admonition:: You should probably follow official documentation

| First steps with EC2
| https://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html
| Docker basics
| https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html


Remember that your inbound rules should appear like this:

Inbound rules
-------------

+------+----------+------------+--------------+
| Type | Protocol | Port range | Source |
+======+==========+============+==============+
| HTTP | TCP | 80 | 0.0.0.0/0 |
+------+----------+------------+--------------+
| HTTP | TCP | 80 | ::/0 |
+------+----------+------------+--------------+
| SSH | TCP | 22 | YOUR_HOME_IP |
+------+----------+------------+--------------+

With Docker and Git installed on your instance
----------------------------------------------

Going live is as simple as:

.. code-block:: bash
git clone https://git.luolix.tope/some-user/some-repository.git
cd some-repository
docker build . -t my_tag_name
docker run -t -i -p 80:80 my_tag_name:latest
Now by typing ``my_instance_IP`` in the browser you will see the server replies.


8 changes: 5 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Docker FastAPI projects

*Well-documented examples of deployment-ready FastAPI applications written from scratch.*

So, you want to include a docker in your FastAPI app, but there is a Great Wall?
You want to include a docker in your FastAPI app, but there is a Great Wall?
--------------------------------------------------------------------------------

**That's definitely a good place to learn how to jump over it.**
Expand All @@ -28,10 +28,12 @@ Nice to have:

.. toctree::
:maxdepth: 1
:caption: Basics:
:caption: Basic examples:

introduction
basic_uvicorn
deployment
uvicorn
nginx

.. _Docker: https://www.docker.com/
.. _REST: https://restfulapi.net
Expand Down
4 changes: 1 addition & 3 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ The Structure of this project
Each chapter is another application and at the same time a repository on `GitHub`_. You can go ahead and download it to your computer or your virtual machine and follow the steps or simply read and try out these configurations in your projects. Each subsequent application in this section is more and more advanced, from a simple hello-world on a localhost to production applications with a database and an authentication system included.

.. CAUTION::
Please note that even if we try to faithfully recreate production applications here, probably none of them is suitable for even a simple production API and should not be a template for any **serious** project. They are written to help you understand the basics.
Please note that even if we try to faithfully recreate production applications here, none of them is suitable for even a simple production API and should not be a template for any **serious** project. They are written to help you understand the basics.

The Structure of each chapter
-----------------------------

* Application structure
* Files description
* Local deployment
* Production deployment*
* Troubleshoots

``\* The first (dead simple) app only has a chapter on local deployment.``

Other useful resources
----------------------
Expand Down
Loading

0 comments on commit b9c1f15

Please sign in to comment.