Skip to content
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
27 changes: 27 additions & 0 deletions auth_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.13.3-slim

WORKDIR /auth_service

COPY . .

RUN pip install poetry

# Adds poetry to PATH
ENV PATH="/root/.local/bin:$PATH"

# Make poetry not run in other virtual enviroment (run in his own container)
RUN poetry config virtualenvs.create false

RUN poetry install --no-root

EXPOSE 5050

CMD ["poetry", "run", "gunicorn", "-w", "2", "-b", "0.0.0.0:5050", "main:auth_app"]
## Comando que será executado
# "poetry": Chama o Poetry
# "run": Executar os comandos dentro do ambiente virtual do poetry
# "gunicorn": servidor HTTP para aplicações Python WSGI
# "-w" e "2": Vai definir o número de processos que o Gunicorn vai usar
# "-b" e "0.0.0.0:5050": Fazer com que Gunicorn funcione em todos os endereções IP
# "main:internal_api" Qual aplicação rodar - (main-> nome do arquivo python & auth_app-> nome da variável do app)

Empty file added auth_service/__init__.py
Empty file.
10 changes: 8 additions & 2 deletions auth_service/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[tool.poetry]
name = "auth-service"
name = "auth_service"
version = "0.1.0"
description = "serviço de autenticação para o cluster do LabTech"
authors = ["Danrley Pereira <danrleywillian@gmail.com>"]
readme = "README.md"
readme = "deployment.md"
packages = [{include = "*.py"}]
package-mode = false



[tool.poetry.dependencies]
python = "^3.12"
Expand All @@ -21,3 +25,5 @@ redis = "^5.2.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


46 changes: 46 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,52 @@ services:
options:
max-size: "10m"
max-file: "3"

auth-service:
build:
context: ./auth_service
dockerfile: Dockerfile
container_name: auth_service
restart: unless-stopped
ports:
- "5050:5050"
depends_on:
- redis-local
environment:
- REDIS_HOST=redis-local
- REDIS_PORT=6379
- REDIS_URL=redis://redis-local:6379/0

mongo:
image: mongo:6.0
container_name: mongo
restart: unless-stopped
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db

internal_apis:
build:
context: ./internal_apis
dockerfile: Dockerfile
container_name: internal_apis
restart: unless-stopped
ports:
- "5081:5081"
depends_on:
- redis-local
- mongo
environment:
- REDIS_HOST=redis-local
- REDIS_PORT=6379
- REDIS_URL=redis://redis-local:6379/0
- MONGO_URI=mongodb://mongo:27017/shared-resources
- MONGO_DATABASE=shared-resources


volumes:
redis-data:
driver: local
mongo-data:
driver: local
18 changes: 18 additions & 0 deletions internal_apis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.13.3-slim

WORKDIR /internal_apis

COPY . .

RUN pip install poetry

ENV PATH="/root/.local/bin:$PATH"

RUN poetry config virtualenvs.create false

RUN poetry install --no-root

EXPOSE 5081


CMD ["sh", "-c", "PYTHONPATH=src poetry run gunicorn -w 2 -b 0.0.0.0:5081 main:internal_api"]
4 changes: 2 additions & 2 deletions internal_apis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from config_module import get_config

# Create the app at module level so Gunicorn can import it.
internal_apis = create_app(get_config())
internal_api = create_app(get_config())

if __name__ == "__main__":
internal_apis.run(host="0.0.0.0", port=5081, debug=True)
internal_api.run(host="0.0.0.0", port=5081, debug=True)

7 changes: 7 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "shared-resources"
version = "0.1.0"
description = ""
authors = [
{name = "Bappoz",email = "landradezanetti@gmail.com"}
]
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"