diff --git a/poetry.lock b/poetry.lock index b8693ae..e06e353 100644 --- a/poetry.lock +++ b/poetry.lock @@ -274,7 +274,7 @@ typing-extensions = "*" name = "django-stubs-ext" version = "0.3.1" description = "Monkey-patching and extensions for django-stubs" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -880,7 +880,7 @@ python-versions = "*" name = "typing-extensions" version = "4.0.1" description = "Backported and Experimental Type Hints for Python 3.6+" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -975,7 +975,7 @@ multidict = ">=4.0" [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "35d359b39bfd7c907a1119797a4badf33b3f3c964a5ec90e85c781cf99fecf7e" +content-hash = "f98d2a4ae15821bd9d0247980743235129a22295abf136ae59f89568a329180e" [metadata.files] asgiref = [ diff --git a/pyproject.toml b/pyproject.toml index f341900..5c0242e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ django-csp = "^3.7" django-two-factor-auth = {extras = ["phonenumberslite"], git = "https://github.com/Bouke/django-two-factor-auth.git", rev = "ffe4422e"} beautifulsoup4 = "^4.10.0" django-environ = "^0.8.1" +django-stubs-ext = "^0.3.1" [tool.poetry.dev-dependencies] pre-commit = "^2.7" diff --git a/tasks.py b/tasks.py index 9d7e07e..318d452 100644 --- a/tasks.py +++ b/tasks.py @@ -1,5 +1,7 @@ +import time from pathlib import Path +import requests from invoke import task BASE_DIR = Path(__file__).parent.resolve(strict=True) @@ -56,7 +58,18 @@ def deploy(ctx): ctx.run("ssh ubuntu /home/gaugendre/blog/update", pty=True, echo=True) -@task(pre=[check, build, publish, deploy]) +@task +def check_alive(ctx): + for _ in range(5): + try: + res = requests.get("https://gabnotes.org") + res.raise_for_status() + except requests.exceptions.HTTPError: + time.sleep(1) + return + + +@task(pre=[check, build, publish, deploy], post=[check_alive]) def beam(ctx): pass