Add kubernetes files and shell scripts for test deployment

This commit is contained in:
David Eder
2021-05-02 22:31:00 +02:00
parent 5c6be895e4
commit dae1700704
10 changed files with 173 additions and 31 deletions
-31
View File
@@ -1,31 +0,0 @@
from flask import Flask
from flask_pymongo import PyMongo
# make sure mongoDB (container) is running and accessible
# see https://flask-pymongo.readthedocs.io/en/latest/
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
mongo = PyMongo(app)
mongo.db.test.save({'_id': 0, 'foo': {'test': 'this'}})
mongo.db.test.save({'_id': 1, 'suu': 'sar'})
@app.route("/")
def home_page():
test_results = mongo.db.test.find()
results = []
try:
while True:
result = test_results.next()
results.append(result)
except StopIteration:
pass
return str(results)
if __name__ == '__main__':
app.run()
@@ -0,0 +1,8 @@
FROM python:3.8-slim
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENV PORT 5000
EXPOSE 5000
ENTRYPOINT [ "python" ]
CMD [ "entity_ident.py" ]
@@ -0,0 +1,38 @@
import jsonify as jsonify
from flask import Flask
from flask_pymongo import PyMongo
# make sure mongoDB (container) is running and accessible
# see https://flask-pymongo.readthedocs.io/en/latest/
app = Flask(__name__)
#app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
#mongo = PyMongo(app)
#mongo.db.test.insert_one({'_id': 0, 'foo': {'test': 'this'}})
#mongo.db.test.insert_one({'_id': 1, 'suu': 'sar'})
#@app.route("/")
#def home_page():
# test_results = mongo.db.test.find()
# results = []
# try:
# while True:
# result = test_results.next()
# results.append(result)
# except StopIteration:
# pass
#return str(results)
@app.route("/")
def index():
return str("Welcome to Tasks app! I am running inside pod!")
#if __name__ == '__main__':
# app.run()
if __name__ == '__main__':
app.run(host='0.0.0.0')
@@ -1,3 +1,4 @@
pika
flask
Flask-PyMongo
jsonify