First part of T56 (crash server)
This commit is contained in:
parent
83f094a15f
commit
62a58f05b5
9
docker/crash_server.dockerfile
Normal file
9
docker/crash_server.dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM python:3.5
|
||||
|
||||
COPY src/crash_analysis/server /server
|
||||
|
||||
RUN pip install -r /server/requirements.txt
|
||||
|
||||
WORKDIR /server
|
||||
|
||||
CMD python app.py
|
1
src/crash_analysis/server/.gitignore
vendored
Normal file
1
src/crash_analysis/server/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
ve/
|
19
src/crash_analysis/server/app.py
Normal file
19
src/crash_analysis/server/app.py
Normal file
@ -0,0 +1,19 @@
|
||||
import json
|
||||
from flask import Flask, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/crash", methods=["POST"])
|
||||
def crash():
|
||||
'''
|
||||
Appends json body to a log file and print it to the stdout.
|
||||
'''
|
||||
body_dump = json.dumps(request.json)
|
||||
with open("crash.log", "a") as f:
|
||||
f.write(body_dump)
|
||||
f.write('\n')
|
||||
print(body_dump)
|
||||
return '', 204
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=8080)
|
6
src/crash_analysis/server/requirements.txt
Normal file
6
src/crash_analysis/server/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
click==6.6
|
||||
Flask==0.11.1
|
||||
itsdangerous==0.24
|
||||
Jinja2==2.8
|
||||
MarkupSafe==0.23
|
||||
Werkzeug==0.11.10
|
Loading…
Reference in New Issue
Block a user