From 5163f14a14b617fded7124e25a51c9a72034836c Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sun, 23 Feb 2020 12:05:41 +0200 Subject: [PATCH] Dummy web server. --- .pre-commit-config.yaml | 5 +---- docker-compose.yml | 10 ++++++++++ waldorf/server.py | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 waldorf/server.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fcf366d..e718b38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,6 @@ repos: rev: 19.10b0 hooks: - id: black - exclude: &excluded_pythonscripts pythonrc.py|rabbitmqadmin args: - | --line-length=79 @@ -33,7 +32,6 @@ repos: rev: 3.7.9 hooks: - id: flake8 - exclude: *excluded_pythonscripts args: - |- --max-line-length=79 @@ -43,10 +41,9 @@ repos: rev: v2.4.4 hooks: - id: pylint - exclude: *excluded_pythonscripts args: - |- - --disable=R0801 + --disable=R0801,E0401 - repo: https://www.shore.co.il/git/docker-pre-commit rev: v0.3.0 hooks: diff --git a/docker-compose.yml b/docker-compose.yml index 6047329..242dc2b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,3 +14,13 @@ services: image: rabbitmq:3.8-management-alpine ports: - 15672:15672 + server: + build: + context: ./ + command: ["flask", "run", "--port", "8080", "--host", "0.0.0.0"] + environment: + FLASK_APP: waldorf/server + healthcheck: + test: ["CMD-SHELL", "wget http://localhost:8080/ping || exit 1"] + ports: + - 8080:8080 diff --git a/waldorf/server.py b/waldorf/server.py new file mode 100644 index 0000000..ee41f97 --- /dev/null +++ b/waldorf/server.py @@ -0,0 +1,10 @@ +"""Dummy web server using Flask.""" +from flask import Flask + +app = Flask(__name__) # pylint: disable=invalid-name + + +@app.route("/ping") +def ping(): + """Healthcheck.""" + return "pong" -- GitLab