This commit is contained in:
parent
537b89dbaf
commit
2a090ea7a2
|
@ -1,4 +1,4 @@
|
||||||
name: 'deploy'
|
name: "Deploy to notifier"
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -14,9 +14,13 @@ jobs:
|
||||||
id: repo_name
|
id: repo_name
|
||||||
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
|
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
|
- name: Push to dokku
|
||||||
uses: dokku/github-action@master
|
uses: dokku/github-action@master
|
||||||
with:
|
with:
|
||||||
branch: 'main'
|
branch: "main"
|
||||||
git_remote_url: 'ssh://dokku@staging.discours.io:22/${{ steps.repo_name.outputs.repo }}'
|
git_remote_url: "ssh://dokku@v2.discours.io:22/notifier"
|
||||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
@ -5,7 +5,7 @@ FROM python:slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Add metadata to the image to describe that the container is listening on port 80
|
# 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 the current directory contents into the container at /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
|
@ -13,7 +13,7 @@ python = "^3.12"
|
||||||
SQLAlchemy = "^2.0.22"
|
SQLAlchemy = "^2.0.22"
|
||||||
psycopg2-binary = "^2.9.9"
|
psycopg2-binary = "^2.9.9"
|
||||||
redis = {extras = ["hiredis"], version = "^5.0.1"}
|
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-graphql = {extras = ["asgi", "debug-server"], version = "^0.216.1" }
|
||||||
strawberry-sqlalchemy-mapper = "^0.4.0"
|
strawberry-sqlalchemy-mapper = "^0.4.0"
|
||||||
sentry-sdk = "^1.37.1"
|
sentry-sdk = "^1.37.1"
|
||||||
|
@ -23,10 +23,11 @@ aiohttp = "^3.9.1"
|
||||||
setuptools = "^69.0.2"
|
setuptools = "^69.0.2"
|
||||||
pytest = "^7.4.2"
|
pytest = "^7.4.2"
|
||||||
black = { version = "^23.12.0", python = ">=3.12" }
|
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" }
|
mypy = { version = "^1.7", python = ">=3.12" }
|
||||||
isort = "^5.13.2"
|
isort = "^5.13.2"
|
||||||
pyright = "^1.1.341"
|
pyright = "^1.1.341"
|
||||||
|
pre-commit = "^3.6.0"
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
16
server.py
16
server.py
|
@ -1,7 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import uvicorn
|
from granian import Interfaces, Granina
|
||||||
from uvicorn.main import logger
|
|
||||||
|
|
||||||
from settings import PORT
|
from settings import PORT
|
||||||
|
|
||||||
|
@ -55,5 +54,16 @@ def exception_handler(_et, exc, _tb):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
print('[server] started')
|
||||||
sys.excepthook = exception_handler
|
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()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
PORT = 80
|
PORT = 8000
|
||||||
DB_URL = (
|
DB_URL = (
|
||||||
environ.get("DATABASE_URL", environ.get("DB_URL", "")).replace("postgres://", "postgresql://")
|
environ.get("DATABASE_URL", environ.get("DB_URL", "")).replace("postgres://", "postgresql://")
|
||||||
or "postgresql://postgres@localhost:5432/discoursio"
|
or "postgresql://postgres@localhost:5432/discoursio"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user