Skip to content

Commit d559843

Browse files
committed
Add heroku deployment
1 parent 50e22ea commit d559843

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

Procfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
web: python -m announce server
2+
worker: python -m announce bot

announce/__main__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import os
12
import argparse
23

34
parser = argparse.ArgumentParser()
45
parser.add_argument("cmd", choices=("server", "bot", "run"))
5-
parser.add_argument("--port", type=int, default=8080)
6+
parser.add_argument("--port", type=int, default=int(os.environ.get("PORT")))
67
parser.add_argument("--fn", type=str, default=None)
78

89
args = parser.parse_args()
910

1011
if args.cmd == "server":
1112
from announce.server import app
1213

13-
app.run(port=args.port, host="0.0.0.0", debug=True)
14+
app.run(port=args.port, host="0.0.0.0", debug=True, server="gunicorn")
1415
elif args.cmd == "bot":
1516
from announce.bot import run
1617

poetry.lock

+22-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ bottle-tools = "^2019.12.22"
1919
sqlalchemy = "^1.3.17"
2020
psycopg2-binary = "^2.8.5"
2121
python-telegram-bot = "^12.7"
22+
gunicorn = "^20.0.4"
2223

2324
[tool.poetry.dev-dependencies]
2425
pytest = "^5.2"

runtime.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.7.8

0 commit comments

Comments
 (0)