diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..ff260b5 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ee981f5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "infra"] + path = infra + url = https://github.com/beppevanrolleghem/stage-infra diff --git a/infra b/infra new file mode 160000 index 0000000..e05b588 --- /dev/null +++ b/infra @@ -0,0 +1 @@ +Subproject commit e05b58851797eb8a31b6fb256b8f79af24c8774c diff --git a/src/app.py b/src/app.py new file mode 100644 index 0000000..1fb7633 --- /dev/null +++ b/src/app.py @@ -0,0 +1,38 @@ +from flask import Flask +import requests + +app = Flask(__name__) + +URL = "http://server-check:6000" + +@app.errorhandler(404) +def page_not_found(error): + return "beppe's 404 error" + +@app.route('/') +def doRequest(): + return "it works" + +@app.route('/server-a') +def checkThis(): + return "server-a is apparently something to worry abt" + +@app.route("/server-a/check") +def itAlsoWorks(): + return requests.get(URL).json() + +@app.route('/check') +def itWorks(): + return requests.get(URL).json() + +@app.route('/text') +def hope(): + return requests.get(URL).text + + +@app.route('/find//') +def findServer(name, port): + return requests.get("http://"+name+":"+port) + +if __name__ == '__main__': + app.run(debug=True, host="0.0.0.0", port=5000) diff --git a/src/dockerfile b/src/dockerfile new file mode 100644 index 0000000..5709ecc --- /dev/null +++ b/src/dockerfile @@ -0,0 +1,10 @@ +from python:3.7 + +copy . /app +workdir /app + +run pip install -r requirements.txt +expose 5000 +entrypoint [ "python" ] + +cmd [ "app.py" ] \ No newline at end of file diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..0eb56cd --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,2 @@ +Flask +requests \ No newline at end of file diff --git a/stage-infra b/stage-infra new file mode 160000 index 0000000..7938666 --- /dev/null +++ b/stage-infra @@ -0,0 +1 @@ +Subproject commit 7938666913047455c7864e47fca80700f22acd66