{"id":22042634,"url":"https://github.com/renanstn/prefect-poc","last_synced_at":"2026-04-07T21:31:00.359Z","repository":{"id":119527918,"uuid":"427578065","full_name":"renanstn/prefect-poc","owner":"renanstn","description":"Um pequeno estudo com prefect que acabou virando um aglomerado de APIs aleatórias se comunicando entre si.","archived":false,"fork":false,"pushed_at":"2022-05-12T02:41:06.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T05:56:07.694Z","etag":null,"topics":["django","docker","docker-compose","fastapi","nginx","prefect","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renanstn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-13T05:30:24.000Z","updated_at":"2022-02-23T22:20:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"54853084-3cb0-4807-b92a-bac63c0061a5","html_url":"https://github.com/renanstn/prefect-poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/renanstn/prefect-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fprefect-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fprefect-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fprefect-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fprefect-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renanstn","download_url":"https://codeload.github.com/renanstn/prefect-poc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanstn%2Fprefect-poc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31530640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","docker","docker-compose","fastapi","nginx","prefect","python"],"created_at":"2024-11-30T12:13:05.853Z","updated_at":"2026-04-07T21:31:00.339Z","avatar_url":"https://github.com/renanstn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prefect-poc\n\n[![Python](https://img.shields.io/badge/python-%2314354C.svg?style=flat\u0026logo=python\u0026logoColor=white)](https://www.python.org/)\n[![Django](https://img.shields.io/badge/django-%23092E20.svg?style=flat\u0026logo=django\u0026logoColor=white)](https://www.djangoproject.com/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=flat\u0026logo=fastapi)](https://fastapi.tiangolo.com/)\n[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=flat\u0026logo=docker\u0026logoColor=white)](https://www.docker.com/)\n[![Nginx](https://img.shields.io/badge/nginx-%23009639.svg?style=flat\u0026logo=nginx\u0026logoColor=white)](https://www.nginx.com/)\n\n## Descrição\n\nPequeno ambiente criado para estudo diversos usando a ferramenta [Prefect](https://www.prefect.io/).\n\nO ambiente consiste atualmente em:\n\n- 1 API que fornecem números aleatórios (FastAPI)\n- 1 API que fornecem nomes aleatórios (FastAPI)\n- 1 API que soma 2 valores e retorna o resultado (FastAPI)\n- 1 API central que chamará todas as outras e armazenará os resultados (Django Rest Framework)\n- 1 Nginx fazendo o proxy reverso até essas APIs\n- 1 Banco de dados Postgres\n- 1 App Prefect para servir de server\n- 1 worker para rodar as tasks do Celery\n- 1 broker RabbitMQ para que o Celery funcione\n\nPara estudo, foi criado um fluxo extremamente aleatório onde, ao receber um `POST` no endpoint `/api/start_flux/`, a API Core:\n\n- Busca um nome aleatório na API `random_name`\n- Busca 2 números aleatórios na API `random_number`\n- Soma os 2 números usando a API `calculator`\n- Concatena o nome buscado com o resultado da soma no seguinte formato: `\"{nome}-{soma}\"`\n- Salva o resultado no banco para eventuais consultas\n\n## Setup do ambiente\n```\ndocker-compose up\n```\n\n### Disparar fluxo de exemplo\n```\ncurl -X POST http://localhost:8000/api/start_flux/\n```\n\n### Disparar exemplo de tarefa assíncrona usando o celery\n```\ncurl -X POST http://localhost:8000/api/celery/\n```\n\n## Setup do Prefect Server\n\nAlterar o backend default para o server local\n```\nprefect backend server\n```\n\nIniciar o server\n```\nprefect server start\n```\n\nPela UI, criar um project\n\nRegistrar seu flow com o comando:\n```\nflow.register(project_name=\"\u003cnome do project criado via UI\u003e\")\n```\n\nCaos queira usar o scheduler, é necessário iniciar um Agent local também\n```\nprefect agent local start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanstn%2Fprefect-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenanstn%2Fprefect-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanstn%2Fprefect-poc/lists"}