Skip to content

dependencies updated #14

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 35 additions & 37 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
version: '3.7'

services:
gateway:
image: baranbartu/k-api-gateway:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./gateway
dockerfile: Dockerfile
env_file:
- ./gateway/.env
ports:
- 8001:8000
depends_on:
- users
- orders
volumes:
- ./gateway:/app
gateway:
image: baranbartu/k-api-gateway:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./gateway
dockerfile: Dockerfile
env_file:
- ./gateway/.env
ports:
- 8001:8000
depends_on:
- users
- orders
volumes:
- ./gateway:/app

users:
image: baranbartu/k-users:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./users
dockerfile: Dockerfile
env_file:
- ./users/.env
volumes:
- ./users:/app
users:
image: baranbartu/k-users:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./users
dockerfile: Dockerfile
env_file:
- ./users/.env
volumes:
- ./users:/app

orders:
image: baranbartu/k-orders:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./orders
dockerfile: Dockerfile
env_file:
- ./orders/.env
volumes:
- ./orders:/app
orders:
image: baranbartu/k-orders:latest
command: sh -c "uvicorn main:app --reload --host 0.0.0.0"
build:
context: ./orders
dockerfile: Dockerfile
env_file:
- ./orders/.env
volumes:
- ./orders:/app
4 changes: 2 additions & 2 deletions gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.7
FROM python:3.11

WORKDIR /app

Expand All @@ -8,4 +8,4 @@ ENV PYTHONBUFFERED 1
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
COPY . .
5 changes: 3 additions & 2 deletions gateway/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jwt

from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from conf import settings
from exceptions import AuthTokenMissing, AuthTokenExpired, AuthTokenCorrupted
Expand All @@ -17,7 +17,8 @@ def generate_access_token(
)
):

expire = datetime.utcnow() + expires_delta
expire = datetime.now(timezone.utc) + expires_delta

token_data = {
'id': data['id'],
'user_type': data['user_type'],
Expand Down
3 changes: 2 additions & 1 deletion gateway/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from pydantic import BaseSettings
from pydantic_settings import BaseSettings



class Settings(BaseSettings):
Expand Down
19 changes: 11 additions & 8 deletions gateway/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
fastapi==0.58.0
uvicorn==0.11.5
PyJWT==1.7.1
fastapi==0.112.1
uvicorn==0.30.6
PyJWT==2.9.0
pydantic-settings==2.4.0

async_timeout==4.0.3

# async http requests & fast dns resolving
aiohttp==3.6.2
aiodns==2.0.0
aiohttp==3.10.5
aiodns==3.2.0

# for test purposes
flake8==3.8.3
ipdb==0.13.2
ipython==7.15.0
flake8==7.1.1
ipdb==0.13.13
ipython==8.26.0
2 changes: 1 addition & 1 deletion orders/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.7
FROM python:3.11

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion orders/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def get_orders(request_user_id: str = Header(None)):
@app.post('/api/orders', response_model=Order_Pydantic)
async def create_user(order: OrderIn_Pydantic,
request_user_id: str = Header(None)):
data = order.dict()
data = order.model_dump()
data.update({'created_by': request_user_id})

order_obj = await Orders.create(**data)
Expand Down
12 changes: 6 additions & 6 deletions orders/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fastapi==0.58.0
uvicorn==0.11.5
tortoise-orm==0.16.13
fastapi==0.112.1
uvicorn==0.30.6
tortoise-orm==0.21.6

# for test purposes
flake8==3.8.3
ipdb==0.13.2
ipython==7.15.0
flake8==7.1.1
ipdb==0.13.13
ipython==8.26.0
2 changes: 1 addition & 1 deletion users/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.7
FROM python:3.11

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion users/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def create_user(user: UserForm,
)

hashed_password = get_password_hash(user.password)
data = user.dict()
data = user.model_dump()
user_in_db = insert_user(data, hashed_password, request_user_id)

return user_in_db
Expand Down
14 changes: 7 additions & 7 deletions users/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fastapi==0.58.0
uvicorn==0.11.5
passlib==1.7.2
bcrypt==3.1.7
fastapi==0.112.1
uvicorn==0.30.6
passlib==1.7.4
bcrypt==4.2.0

# for test purposes
flake8==3.8.3
ipdb==0.13.2
ipython==7.15.0
flake8==7.1.1
ipdb==0.13.13
ipython==8.26.0