-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from akmamun/dev
- Loading branch information
Showing
8 changed files
with
41 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
DATABASE_NAME=DATABASE_NAME | ||
MONGO_URL=mongodb://localhost:27017/ | ||
DATABASE_NAME=your_database_name | ||
USERNAME= | ||
PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
## FastAPI MicroService with Docker, Nginx and MongoDB(Motor) | ||
## FastAPI Micro Service with Docker, Nginx, and Asynchronous MongoDB (Motor) | ||
|
||
### Create [virtual environment](https://docs.python.org/3/library/venv.html) and install requirements | ||
```sh | ||
pip install -r requirements.txt | ||
``` | ||
### Installation Instructions | ||
|
||
### Run docker compose | ||
- Make sure [docker](https://docs.docker.com/engine/install) and [docker-compose](https://docs.docker.com/compose/install/) installed | ||
- Create a [virtual environment](https://docs.python.org/3/library/venv.html) | ||
- Install the python Dependencies with `pip install -r requirements.txt` | ||
- Copy the .env.example file as .env | ||
```sh | ||
cp .env.example .env | ||
``` | ||
- Ensure that you fill in all the valid environment properties in the .env file. | ||
|
||
|
||
### Run Locally | ||
To run the service locally, use the following command: | ||
```sh | ||
uvicorn server:app --reload | ||
``` | ||
|
||
### Run with Docker | ||
To run the service using Docker, use the following command: | ||
```sh | ||
sudo docker-compose up -d --build | ||
``` | ||
|
||
### Run Docker Compose for Production Build | ||
Ensure that you have [Docker]((https://docs.docker.com/engine/install)) and [Docker Compose](https://docs.docker.com/compose/install/) installed. | ||
|
||
### Lets Run | ||
- Docker run `sudo docker-compose up -d --build` | ||
- Locally run `uvicorn src.servers.start:app --reload` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
fastapi==0.66.0 | ||
uvicorn==0.14.0 | ||
motor==2.4.0 | ||
python-dotenv==0.18.0 | ||
gunicorn==20.1.0 | ||
fastapi==0.104.0 | ||
uvicorn==0.23.2 | ||
motor==3.3.1 | ||
python-dotenv==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ | |
|
||
|
||
if __name__ == "main": | ||
app.run() | ||
app.run(host="0.0.0.0",port=9000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters