granian-precommit
Some checks failed
Deploy to notifier / deploy (push) Failing after 5s

This commit is contained in:
Untone 2024-02-04 07:29:26 +03:00
parent 537b89dbaf
commit 2a090ea7a2
5 changed files with 25 additions and 10 deletions

View File

@ -1,4 +1,4 @@
name: 'deploy'
name: "Deploy to notifier"
on: [push]
jobs:
@ -14,9 +14,13 @@ jobs:
id: repo_name
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
- name: Get Branch Name
id: branch_name
run: echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})"
- name: Push to dokku
uses: dokku/github-action@master
with:
branch: 'main'
git_remote_url: 'ssh://dokku@staging.discours.io:22/${{ steps.repo_name.outputs.repo }}'
branch: "main"
git_remote_url: "ssh://dokku@v2.discours.io:22/notifier"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

View File

@ -5,7 +5,7 @@ FROM python:slim
WORKDIR /app
# Add metadata to the image to describe that the container is listening on port 80
EXPOSE 80
EXPOSE 8000
# Copy the current directory contents into the container at /app
COPY . /app

View File

@ -13,7 +13,7 @@ python = "^3.12"
SQLAlchemy = "^2.0.22"
psycopg2-binary = "^2.9.9"
redis = {extras = ["hiredis"], version = "^5.0.1"}
uvicorn = "^0.24.0"
granian = "^1.0.1"
strawberry-graphql = {extras = ["asgi", "debug-server"], version = "^0.216.1" }
strawberry-sqlalchemy-mapper = "^0.4.0"
sentry-sdk = "^1.37.1"
@ -23,10 +23,11 @@ aiohttp = "^3.9.1"
setuptools = "^69.0.2"
pytest = "^7.4.2"
black = { version = "^23.12.0", python = ">=3.12" }
ruff = { version = "^0.1.8", python = ">=3.12" }
ruff = { version = "^0.1.15", python = ">=3.12" }
mypy = { version = "^1.7", python = ">=3.12" }
isort = "^5.13.2"
pyright = "^1.1.341"
pre-commit = "^3.6.0"
[tool.black]
line-length = 120

View File

@ -1,7 +1,6 @@
import sys
import uvicorn
from uvicorn.main import logger
from granian import Interfaces, Granina
from settings import PORT
@ -55,5 +54,16 @@ def exception_handler(_et, exc, _tb):
if __name__ == "__main__":
print('[server] started')
sys.excepthook = exception_handler
uvicorn.run("main:app", host="0.0.0.0", port=PORT, proxy_headers=True, server_header=True)
granian_instance = Granian("main:app",
address="0.0.0.0",
port=PORT,
proxy_headers=True,
server_header=True,
workers=2,
threads=2,
websockets=False,
interface=Interfaces.ASGI,
)
granian_instance.serve()

View File

@ -1,6 +1,6 @@
from os import environ
PORT = 80
PORT = 8000
DB_URL = (
environ.get("DATABASE_URL", environ.get("DB_URL", "")).replace("postgres://", "postgresql://")
or "postgresql://postgres@localhost:5432/discoursio"