Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
postprocessing
Media Metadata Indexer
Commits
8aa9be6d
Unverified
Commit
8aa9be6d
authored
Nov 30, 2020
by
Sebastian Schüpbach
Browse files
read mariadb connection details from cm and secret
Signed-off-by:
Sebastian Schüpbach
<
sebastian.schuepbach@unibas.ch
>
parent
8cbc9c67
Changes
3
Hide whitespace changes
Inline
Side-by-side
k8s-manifests/test/kubernetes-confimap.yml
View file @
8aa9be6d
...
@@ -4,4 +4,13 @@ metadata:
...
@@ -4,4 +4,13 @@ metadata:
name
:
mediametadatatodb-config
name
:
mediametadatatodb-config
namespace
:
memobase
namespace
:
memobase
data
:
data
:
INPUT_TOPIC
:
'
fedora-output-json-records'
KAFKA_CONNECTION_RETRIES
:
'
2'
KAFKA_GROUP_ID
:
'
medienserverMetadataService'
LOG_LEVEL
:
'
INFO'
MARIADB_CONNECTION_RETRIES
:
'
2'
MARIADB_DATABASE
:
'
medienserver'
MARIADB_HOST
:
'
mb-db1.swissbib.unibas.ch'
MARIADB_PORT
:
'
3306'
REPORTING_TOPIC
:
'
postprocessing-reporting'
URI_BASE
:
'
file:///data/'
URI_BASE
:
'
file:///data/'
k8s-manifests/test/kubernetes-deployment.yml
View file @
8aa9be6d
...
@@ -19,28 +19,11 @@ spec:
...
@@ -19,28 +19,11 @@ spec:
containers
:
containers
:
-
name
:
mediametadatatodb-container
-
name
:
mediametadatatodb-container
image
:
cr.gitlab.switch.ch/memoriav/memobase-2020/services/postprocessing/mediametadatatodb:latest
image
:
cr.gitlab.switch.ch/memoriav/memobase-2020/services/postprocessing/mediametadatatodb:latest
env
:
-
name
:
KAFKA_GROUP_ID
value
:
"
medienserverMetadataService"
-
name
:
KAFKA_CONNECTION_RETRIES
value
:
"
3"
-
name
:
MARIADB_CONNECTION_RETRIES
value
:
"
3"
-
name
:
INPUT_TOPIC
value
:
"
fedora-output-json-records"
-
name
:
REPORTING_TOPIC
value
:
"
postprocessing-reporting"
-
name
:
LOG_LEVEL
value
:
"
INFO"
envFrom
:
envFrom
:
-
configMapRef
:
-
configMapRef
:
name
:
"
prod-kafka-bootstrap-servers"
name
:
"
prod-kafka-bootstrap-servers"
-
configMapRef
:
-
configMapRef
:
name
:
"
mediametadatatodb-config"
name
:
"
mediametadatatodb-config"
-
secretRef
:
-
secretRef
:
name
:
mariadb-secret
name
:
mariadb-mb-db1-medienserver
ports
:
-
containerPort
:
5000
name
:
http
protocol
:
TCP
imagePullPolicy
:
Always
imagePullPolicy
:
Always
mediametadatatodb_app/resources/MediametadataToDB.py
View file @
8aa9be6d
...
@@ -59,13 +59,12 @@ def _connect_to_kafka(retries=0):
...
@@ -59,13 +59,12 @@ def _connect_to_kafka(retries=0):
def
_connect_to_mariadb
(
retries
=
0
):
def
_connect_to_mariadb
(
retries
=
0
):
password
=
os
.
environ
[
"mediaserver"
].
split
(
':'
)[
1
].
split
(
'@tcp('
)[
0
]
try
:
try
:
mariadb_connection
=
mariadb
.
connect
(
user
=
'medienserver'
,
mariadb_connection
=
mariadb
.
connect
(
user
=
os
.
environ
[
'MARIADB_USER'
]
,
password
=
password
,
password
=
os
.
environ
[
'MARIADB_PASSWORD'
]
,
host
=
'mb-db1.memobase.unibas.ch'
,
host
=
os
.
environ
[
'MARIADB_HOST'
]
,
port
=
3306
,
port
=
int
(
os
.
environ
[
'MARIADB_PORT'
])
,
database
=
'medienserver'
)
database
=
os
.
environ
[
'MARIADB_DATABASE'
]
)
mariadb_connection
.
autocommit
=
False
mariadb_connection
.
autocommit
=
False
mariadb_cursor
=
mariadb_connection
.
cursor
()
mariadb_cursor
=
mariadb_connection
.
cursor
()
return
mariadb_connection
,
mariadb_cursor
return
mariadb_connection
,
mariadb_cursor
...
...
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