Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
89b0d210
Commit
89b0d210
authored
Aug 03, 2021
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final Fix?
parent
13dd065e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
21 deletions
+18
-21
Dockerfile
src/data-hub/reputation-calculation-microservice/Dockerfile
+2
-4
main.py
src/data-hub/reputation-calculation-microservice/app/main.py
+16
-17
No files found.
src/data-hub/reputation-calculation-microservice/Dockerfile
View file @
89b0d210
...
@@ -2,8 +2,7 @@ FROM python:3
...
@@ -2,8 +2,7 @@ FROM python:3
LABEL
maintainer="Manuel Herold"
LABEL
maintainer="Manuel Herold"
RUN
apt-get update
RUN
apt-get update
RUN
pip
install
flask
RUN
pip
install
-U
pip
RUN
pip
install
connexion[swagger-ui]
EXPOSE
5000
EXPOSE
5000
...
@@ -12,9 +11,8 @@ WORKDIR /app
...
@@ -12,9 +11,8 @@ WORKDIR /app
COPY
src/data-hub/reputation-calculation-microservice/app/requirements.txt /app/
COPY
src/data-hub/reputation-calculation-microservice/app/requirements.txt /app/
RUN
pip
install
-r
requirements.txt
RUN
pip
install
-r
requirements.txt
COPY
src/data-hub/reputation-calculation-microservice/app/ /app/
COPY
src/modules/ /app/
COPY
src/modules/ /app/
COPY
src/data-hub/reputation-calculation-microservice/app/ /app/
RUN
chmod
a+x main.py
RUN
chmod
a+x main.py
CMD
["python", "./main.py"]
CMD
["python", "./main.py"]
\ No newline at end of file
src/data-hub/reputation-calculation-microservice/app/main.py
View file @
89b0d210
...
@@ -16,7 +16,8 @@ LOGGER = logging.getLogger(__name__)
...
@@ -16,7 +16,8 @@ LOGGER = logging.getLogger(__name__)
#############################
#############################
import
connexion
import
connexion
from
security
import
swagger_util
from
security
import
swagger_util
from
env_info
import
is_running_locally
,
get_resources_path
from
pathlib
import
Path
import
env_info
from
flask
import
request
from
flask
import
request
from
flask
import
redirect
from
flask
import
redirect
...
@@ -26,29 +27,27 @@ from flask_cors import CORS
...
@@ -26,29 +27,27 @@ from flask_cors import CORS
app
=
connexion
.
App
(
__name__
,
specification_dir
=
'configs/'
)
app
=
connexion
.
App
(
__name__
,
specification_dir
=
'configs/'
)
CORS
(
app
.
app
)
CORS
(
app
.
app
)
@
app
.
app
.
before_request
def
before_request
():
if
request
.
url
.
startswith
(
'http://'
):
url
=
request
.
url
.
replace
(
'http://'
,
'https://'
,
1
)
code
=
301
return
redirect
(
url
,
code
=
code
)
@
app
.
route
(
'/'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/'
,
methods
=
[
'GET'
])
def
api_root
():
def
api_root
():
return
redirect
(
'/api/ui'
)
return
redirect
(
'/api/ui'
)
# SSL configuration
if
not
env_info
.
is_running_locally
():
certificate_path
=
get_resources_path
()
swagger_path
=
"configs/swagger.yml"
context
=
(
os
.
path
.
normpath
(
f
'{certificate_path}/articonf1.crt'
),
os
.
path
.
normpath
(
f
'{certificate_path}/articonf1.key'
))
# certificate and key files
if
is_running_locally
():
# SSL configuration
print
(
"Running locally..."
)
certificate_path
=
env_info
.
get_resources_path
(
)
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger_local.yml"
)),
context
=
(
os
.
path
.
normpath
(
f
'{certificate_path}/articonf1.crt'
),
os
.
path
.
normpath
(
f
'{certificate_path}/articonf1.key'
))
# certificate and key files
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
else
:
else
:
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger.yml"
)),
print
(
"Running locally..."
)
swagger_path
=
"configs/swagger_local.yml"
context
=
None
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
swagger_path
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
# start app
# start app
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
(
host
=
'0.0.0.0'
,
port
=
5000
,
debug
=
True
,
use_reloader
=
False
,
ssl_context
=
context
)
# disable reloader so only subscribed once to rabbitmq
app
.
run
(
host
=
'0.0.0.0'
,
port
=
5000
,
ssl_context
=
context
)
#, debug=True)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment