From 278be2f343bffeb89404901e481864349b610773 Mon Sep 17 00:00:00 2001 From: beppe Date: Mon, 16 Mar 2020 12:15:24 +0100 Subject: [PATCH] src en submodule --- .DS_Store | Bin 0 -> 6148 bytes .gitmodules | 3 +++ infra | 1 + src/app.py | 38 ++++++++++++++++++++++++++++++++++++++ src/dockerfile | 10 ++++++++++ src/requirements.txt | 2 ++ stage-infra | 1 + 7 files changed, 55 insertions(+) create mode 100644 .DS_Store create mode 100644 .gitmodules create mode 160000 infra create mode 100644 src/app.py create mode 100644 src/dockerfile create mode 100644 src/requirements.txt create mode 160000 stage-infra diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ff260b5b80c15d2eae673ea840fe0955bea1216e GIT binary patch literal 6148 zcmeHKOHKko5Um0h7>u%X;bJbJkqelSjByW%3*E>^(F7c#xHOp?cm?ALO!Ne-+`IP@ zUVvBKB}`{TR~loglJ3`2pRVpVWQrmpZr=18M0FynVhEO2FnuComr;!UG@3>c=Kg_x)<8}U)sm#x!(rg zBb3T?O;^+lvzBicmVD0X)6whQn#-wiqjZt6Xbtkwj^wK$--J52>nUyFzL#`{{GBj= z>utGb{yYx{haVg)**AZ_@4bWb@}r#B#27FJjDeqG05w~rTJvbLF<=ZB19JxC`w(FW z#)_Fo_vygoS^!`LYA0ArFCj6JVyu{XgayJr6zD@)TMYK$&`0VQD`p;jII%V#teIIm z6n5FMf8^YWV~;i)1I9qeK-oXmrT*_P@BhOfdol)$fq%sSSCV$p#FezR7A_~XHo`c; p5D~x3<2(clSBl{)rFa9w3G|UHfU#oc5gLg75pXovWDNW&12edjX<7gP literal 0 HcmV?d00001 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