Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
akmamun authored Oct 26, 2023
1 parent 6719880 commit 3fcd592
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MONGO_URL=mongodb://localhost:27017/
DATABASE_NAME=your_database_name
USERNAME_NAME=
USERNAME=
PASSWORD=
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
## FastAPI MicroService with Docker, Nginx and MongoDB(Motor)
## FastAPI Micro Service with Docker, Nginx, and Asynchronous MongoDB (Motor)

### Installation Instruction
- Create [virtual environment](https://docs.python.org/3/library/venv.html) and install requirements
### Installation Instructions

- 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
pip install -r requirements.txt
uvicorn server:app --reload
```
- Copy .env.example as .env

### Run with Docker
To run the service using Docker, use the following command:
```sh
cp .env.example .env
sudo docker-compose up -d --build
```
### Run docker compose
- Make sure [docker](https://docs.docker.com/engine/install) and [docker-compose](https://docs.docker.com/compose/install/) installed

### Lets Run with Docker
- Docker run `sudo docker-compose up -d --build`
- Locally run `uvicorn src.servers.start:app --reload`
### 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 Locally
- Locally run `uvicorn server:app --reload`
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ services:
- servernet

server:
container_name: service
container_name: core_server
build: .
restart: always
command: gunicorn -w 4 -k uvicorn.workers.UvicornWorker server:app --bind 0.0.0.0:8000
expose:
- 8000
# env_file:
# - .env
env_file:
- .env
depends_on:
- db
links:
Expand Down
2 changes: 1 addition & 1 deletion src/servers/models/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Todos(Repository):
# async def index(self, add):
# await add([('', "")])
# await add([('_id')])

def collection(self):
return 'todos'
Expand Down

0 comments on commit 3fcd592

Please sign in to comment.