From afee087d8895eb1f0c7058a91ed832dbb604c596 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Thu, 10 Nov 2022 23:44:04 +0100 Subject: [PATCH 1/2] dokku zero downtime --- CHECKS | 5 +++++ Dockerfile | 28 +++++++++++++--------------- Procfile | 2 ++ 3 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 CHECKS create mode 100644 Procfile diff --git a/CHECKS b/CHECKS new file mode 100644 index 00000000..5affecfc --- /dev/null +++ b/CHECKS @@ -0,0 +1,5 @@ +WAIT=30 +TIMEOUT=10 +ATTEMPTS=60 # 60 * 30 = 30 min + +/ Playground diff --git a/Dockerfile b/Dockerfile index 2365f893..3f0887f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,13 @@ -FROM python:3.8 - -EXPOSE 8080 - -RUN /usr/local/bin/python -m pip install --upgrade pip - -WORKDIR /usr/src/app - -COPY requirements.txt ./ - -RUN set -ex && pip install -r requirements.txt - -COPY . . - -CMD ["python", "server.py"] +FROM python:3.8 + +EXPOSE 8080 + +RUN /usr/local/bin/python -m pip install --upgrade pip + +WORKDIR /usr/src/app + +COPY requirements.txt ./ + +RUN set -ex && pip install -r requirements.txt + +COPY . . diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..c5c1bfa8 --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: python server.py + From 96e16f5b5c568bfc930858aed6c51267d3d42d61 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Fri, 11 Nov 2022 16:32:30 +0100 Subject: [PATCH 2/2] getTopic, getAuthor fix --- resolvers/profile.py | 4 ++-- resolvers/topics.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resolvers/profile.py b/resolvers/profile.py index 6730ac53..1e68f27b 100644 --- a/resolvers/profile.py +++ b/resolvers/profile.py @@ -213,6 +213,6 @@ def get_top_authors(_, _info, offset, limit): @query.field("getAuthor") async def get_author(_, _info, slug): - a = await UserStorage.users[slug] - a.stat = get_author_stat(slug) + a = await UserStorage.get_user_by_slug(slug) + a.stat = await get_author_stat(slug) return a diff --git a/resolvers/topics.py b/resolvers/topics.py index e2216caf..12d914f8 100644 --- a/resolvers/topics.py +++ b/resolvers/topics.py @@ -55,8 +55,8 @@ async def topics_by_author(_, _info, author): @query.field("getTopic") async def get_topic(_, _info, slug): - t = await TopicStorage.topics[slug] - t.stat = get_topic_stat(slug) + t = TopicStorage.topics[slug] + t.stat = await get_topic_stat(slug) return t