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
325a5941
Commit
325a5941
authored
Aug 12, 2019
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using K8s for message-broker connection
parent
09289708
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
13 deletions
+23
-13
build.py
build.py
+13
-8
loadbalancer.yml
message-broker/deployment/loadbalancer.yml
+1
-1
Dockerfile
transaction-hub-in/trace-retrieval-microservice/Dockerfile
+3
-1
main.py
transaction-hub-in/trace-retrieval-microservice/app/main.py
+5
-2
loadbalancer.yml
.../trace-retrieval-microservice/deployment/loadbalancer.yml
+1
-1
No files found.
build.py
View file @
325a5941
import
os
import
os
import
shutil
docker_reg
=
'localhost:5000'
docker_reg
=
'localhost:5000'
DOCKER_COMPOSE_NAME
=
"Dockerfile"
paths
=
[]
paths
=
[]
for
r
,
_
,
f
in
os
.
walk
(
'./'
):
for
r
,
_
,
f
in
os
.
walk
(
'./'
):
for
file
in
f
:
for
file
in
f
:
if
'Dockerfile'
==
file
:
if
DOCKER_COMPOSE_NAME
==
file
:
paths
.
append
(
os
.
path
.
join
(
r
,
''
))
paths
.
append
(
os
.
path
.
join
(
r
,
''
))
command_args
=
[{
'path'
:
path
,
command_args
=
[{
'path'
:
path
,
# ./transaction-hub-out/tokenized-decision-making-microservice/Dockerfile
'name'
:
str
(
path
)
.
split
(
'/'
)[
2
]}
# -> tokenized-decision-making
for
path
#'name': '-'.join(str(path).split('/')[2].split('-')[:-1])}
in
paths
]
'name'
:
str
(
path
)
.
split
(
'/'
)[
2
]}
for
path
in
paths
]
for
command_arg
in
command_args
:
for
command_arg
in
command_args
:
path
=
command_arg
[
'path'
]
image_name
=
f
"{docker_reg}/{command_arg['name']}"
image_name
=
f
"{docker_reg}/{command_arg['name']}"
os
.
system
(
f
"docker image build -t {image_name} {command_arg['path']}"
)
# copy Dockerfile into root dir to have access to modules folder
shutil
.
copy2
(
os
.
path
.
join
(
path
,
DOCKER_COMPOSE_NAME
),
'./'
)
os
.
system
(
f
"docker image build -t {image_name} ."
)
os
.
remove
(
DOCKER_COMPOSE_NAME
)
os
.
system
(
f
"docker push {image_name}"
)
os
.
system
(
f
"docker push {image_name}"
)
print
(
f
"Finished {image_name}"
)
print
(
f
"Finished {image_name}"
)
\ No newline at end of file
message-broker/deployment/loadbalancer.yml
View file @
325a5941
...
@@ -2,7 +2,7 @@ apiVersion: v1
...
@@ -2,7 +2,7 @@ apiVersion: v1
kind
:
Service
kind
:
Service
metadata
:
metadata
:
name
:
rabbit-mq
-endpoint
name
:
rabbit-mq
spec
:
spec
:
type
:
LoadBalancer
type
:
LoadBalancer
...
...
transaction-hub-in/trace-retrieval-microservice/Dockerfile
View file @
325a5941
...
@@ -7,11 +7,13 @@ ENV https_proxy http://proxy.uni-klu.ac.at:3128/
...
@@ -7,11 +7,13 @@ ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN
apt-get update
RUN
apt-get update
RUN
pip
install
flask
RUN
pip
install
flask
RUN
pip
install
connexion[swagger-ui]
RUN
pip
install
connexion[swagger-ui]
RUN
pip
install
pika
EXPOSE
5000
EXPOSE
5000
WORKDIR
/app
WORKDIR
/app
COPY
app/ /app/
COPY
transaction-hub-in/trace-retrieval-microservice/app/ /app/
COPY
modules/ /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
transaction-hub-in/trace-retrieval-microservice/app/main.py
View file @
325a5941
...
@@ -10,6 +10,9 @@ import connexion
...
@@ -10,6 +10,9 @@ import connexion
from
messaging.MessageReceiver
import
MessageReceiver
from
messaging.MessageReceiver
import
MessageReceiver
from
messaging.MessageSender
import
MessageSender
from
messaging.MessageSender
import
MessageSender
RABBIT_MQ_DNS_NAME
=
'rabbit-mq'
RABBIT_MQ_PORT
=
'5672'
message_sender
=
None
message_sender
=
None
# init message handler
# init message handler
...
@@ -28,10 +31,10 @@ def api_root():
...
@@ -28,10 +31,10 @@ def api_root():
# start app
# start app
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
message_rec
=
MessageReceiver
(
exchange_name
=
'inhub'
,
exchange_type
=
'direct'
,
queue_name
=
'trace-retrieval'
,
auto_ack
=
True
)
message_rec
=
MessageReceiver
(
rabbit_mq_ip
=
RABBIT_MQ_DNS_NAME
,
rabbit_mq_port
=
RABBIT_MQ_PORT
,
exchange_name
=
'inhub'
,
exchange_type
=
'direct'
,
queue_name
=
'trace-retrieval'
,
auto_ack
=
True
)
message_rec
.
start
(
message_received_callback
)
message_rec
.
start
(
message_received_callback
)
message_sender
=
MessageSender
()
message_sender
=
MessageSender
(
rabbit_mq_ip
=
RABBIT_MQ_DNS_NAME
,
rabbit_mq_port
=
RABBIT_MQ_PORT
)
message_sender
.
connect
()
message_sender
.
connect
()
message_sender
.
create_exchange
(
'rest-gateway'
,
'direct'
)
message_sender
.
create_exchange
(
'rest-gateway'
,
'direct'
)
...
...
transaction-hub-in/trace-retrieval-microservice/deployment/loadbalancer.yml
View file @
325a5941
...
@@ -2,7 +2,7 @@ apiVersion: v1
...
@@ -2,7 +2,7 @@ apiVersion: v1
kind
:
Service
kind
:
Service
metadata
:
metadata
:
name
:
trace-retrieval
-endpoint
name
:
trace-retrieval
spec
:
spec
:
type
:
LoadBalancer
type
:
LoadBalancer
...
...
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