Merge pull request 'master' (#17) from master into prod

Reviewed-on: #17
This commit is contained in:
emmatveev 2024-11-27 02:13:37 +03:00
commit f462477280
5 changed files with 12 additions and 11 deletions

View File

@ -5,7 +5,7 @@ services:
queues: queues:
image: mathwave/sprint-repo:queues image: mathwave/sprint-repo:queues
networks: networks:
- queues - queues-development
environment: environment:
MONGO_HOST: "mongo.develop.sprinthub.ru" MONGO_HOST: "mongo.develop.sprinthub.ru"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV MONGO_PASSWORD: $MONGO_PASSWORD_DEV
@ -18,7 +18,5 @@ services:
order: start-first order: start-first
networks: networks:
common-infra-nginx: queues-development:
external: true
queues:
external: true external: true

View File

@ -5,7 +5,6 @@ services:
queues: queues:
image: mathwave/sprint-repo:queues image: mathwave/sprint-repo:queues
networks: networks:
- common-infra-nginx
- queues - queues
environment: environment:
MONGO_HOST: "mongo.sprinthub.ru" MONGO_HOST: "mongo.sprinthub.ru"
@ -19,7 +18,5 @@ services:
order: start-first order: start-first
networks: networks:
common-infra-nginx:
external: true
queues: queues:
external: true external: true

View File

@ -28,7 +28,7 @@ jobs:
run: docker push mathwave/sprint-repo:queues run: docker push mathwave/sprint-repo:queues
deploy-dev: deploy-dev:
name: Deploy dev name: Deploy dev
runs-on: [dev] runs-on: [prod]
needs: push needs: push
steps: steps:
- name: login - name: login
@ -40,4 +40,4 @@ jobs:
- name: deploy - name: deploy
env: env:
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }} MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development

View File

@ -8,10 +8,17 @@ from app.storage.mongo import tasks
router = fastapi.APIRouter() router = fastapi.APIRouter()
class Task(pydantic.BaseModel):
id: str
attempt: int
payload: dict
class Response(pydantic.BaseModel): class Response(pydantic.BaseModel):
id: str id: str
attempt: int attempt: int
payload: dict payload: dict
task: Task|None
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}}) @router.get('/api/v1/take', responses={404: {'description': 'Not found'}})
@ -19,4 +26,4 @@ async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response:
task = await tasks.take_task(queue) task = await tasks.take_task(queue)
if not task: if not task:
raise fastapi.HTTPException(404) raise fastapi.HTTPException(404)
return Response(id=str(task._id), attempt=task.attempts, payload=task.payload) return Response(id=str(task._id), attempt=task.attempts, payload=task.payload, task=Task(id=str(task._id), attempt=task.attempts, payload=task.payload))

View File

@ -1,4 +1,3 @@
import asyncio
import bson import bson
import datetime import datetime
import pydantic import pydantic