Skip to content

Commit

Permalink
Merge pull request #3679 from KBVE/patch-atomic-preparing-the-docker-…
Browse files Browse the repository at this point in the history
…image-01-07-2025-1736290584

[CI] Merge patch-atomic-preparing-the-docker-image-01-07-2025-1736290584 into dev
  • Loading branch information
h0lybyte authored Jan 7, 2025
2 parents 8e8ae78 + fb0a991 commit 474c4aa
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
5 changes: 4 additions & 1 deletion apps/pydiscordsh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ COPY . .
# Install the project itself (if it's structured as a package)
RUN poetry install --no-dev

# Expose Port
EXPOSE 3000

# Set the default command to run the application
CMD ["poetry", "run", "python", "-m", "pydiscordsh"]
CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000", "--ws-ping-interval", "25", "--ws-ping-timeout", "5"]
11 changes: 8 additions & 3 deletions apps/pydiscordsh/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from fastapi import FastAPI, WebSocket
from pydiscordsh import Routes, CORS
from contextlib import asynccontextmanager
from pydiscordsh import Routes, CORS, TursoDatabase

import logging

logger = logging.getLogger("uvicorn")
logger = logging.getLogger("uvicorn")

app = FastAPI()
routes = Routes(app, templates_dir="templates")
CORS(app)

routes.get("/", TursoDatabase, "start_client")
2 changes: 1 addition & 1 deletion apps/pydiscordsh/poetry.lock

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

3 changes: 2 additions & 1 deletion apps/pydiscordsh/pydiscordsh/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .api import Routes, CORS
from .api import Routes, CORS
from .apps import TursoDatabase
1 change: 1 addition & 0 deletions apps/pydiscordsh/pydiscordsh/apps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .turso import TursoDatabase
16 changes: 16 additions & 0 deletions apps/pydiscordsh/pydiscordsh/apps/turso.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import logging
logger = logging.getLogger("uvicorn")

class TursoDatabase:
async def start_client(self):
return {"status": 200, "message": "Client started successfully."}

async def stop_client(self):
return {"status": 200, "message": "Client stopped successfully."}

async def status_client(self):
return {"status": 200, "message": "Client is running."}

async def close(self):
logger.info("Closing the database connection.")
return {"status": 200, "message": "Database connection closed."}
1 change: 1 addition & 0 deletions apps/pydiscordsh/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ readme = 'README.md'
fastapi = "^0.115.6"
supabase = "^2.11.0"
uvicorn = "^0.34.0"
jinja2 = "^3.1.5"

[tool.poetry.group.dev.dependencies]
autopep8 = "2.3.1"
Expand Down

0 comments on commit 474c4aa

Please sign in to comment.