Skip to content

Commit

Permalink
add healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ilude committed May 9, 2024
1 parent 47e1b4f commit a1388c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ENV TERM_SHELL=${TERM_SHELL}

RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
bash-completion \
ca-certificates \
curl \
gosu \
Expand All @@ -43,7 +42,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
make \
tzdata \
zsh && \
wget && \
# cleanup
apt-get autoremove -fy && \
apt-get clean && \
Expand Down Expand Up @@ -110,8 +109,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
openssh-client \
sqlite3 \
libsqlite3-dev \
wget && \
libsqlite3-dev && \
apt-get autoremove -fy && \
apt-get clean && \
apt-get autoclean -y && \
Expand Down Expand Up @@ -143,6 +141,10 @@ RUN mkdir /cache && \
mkdir -p /app/static/assets &&\
chown -R ${USER}:${USER} /app/static

HEALTHCHECK --interval=10s --timeout=3s --start-period=20s \
CMD wget --no-verbose --tries=1 --spider --no-check-certificate http://localhost:$PORT/api/healthcheck || exit 1


CMD [ "python3", "app.py" ]

##############################
Expand Down Expand Up @@ -187,6 +189,7 @@ COPY --from=jupyter-builder --chown=${USER}:${USER} ${PYTHON_DEPS_PATH} ${PYTHON

RUN apt-get update && apt-get install -y --no-install-recommends \
ansible \
bash-completion \
dnsutils \
exa \
iproute2 \
Expand All @@ -200,6 +203,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
tree \
util-linux \
yq \
zsh \
zsh-autosuggestions \
zsh-syntax-highlighting && \
apt-get autoremove -fy && \
Expand Down
5 changes: 5 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,17 @@ def refresh(feed_id):
return redirect('/', code=302)


@app.route('/api/healthcheck')
def healthcheck():
return 'OK', 200

###############################################################################
#
# Main Startup Code
#
###############################################################################


if __name__ == '__main__':
port = int(os.environ.get("FLASK_PORT", os.environ.get("ONBOARD_PORT", 9830)))
development = bool(os.environ.get("FLASK_ENV", "development") == "development")
Expand Down
2 changes: 1 addition & 1 deletion app/processors/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def process(self, articles: list[FeedArticle]) -> list[FeedArticle]:
for chain in [self.llama3_chain, self.mistral_chain]:
try:
logger.info(f"Processing title {count}/{total}: {article.original_title}")
logger.debug(f"{self.script_hash}!={article.processed}: {article.processed != self.script_hash}")
# logger.debug(f"{self.script_hash}!={article.processed}: {article.processed != self.script_hash}")
# , config={'callbacks': [ConsoleCallbackHandler()]})
result = chain.invoke({"title": article.original_title, "summary": article.description})
article.title = result['title']
Expand Down

0 comments on commit a1388c6

Please sign in to comment.