Skip to content

Commit

Permalink
Docker Modeshape Repo in MySQL
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Olotu <kevin.olotu@bosch.io>
  • Loading branch information
kolotu committed Oct 27, 2020
1 parent a1c5455 commit 3eb6206
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docker/Repository_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ RUN apt-get install -y python3 python3-yaml wget
RUN wget -P /code/lib https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.3.0/mariadb-java-client-2.3.0.jar
ADD ./${JAR_FILE} /code/infomodelrepository.jar
ADD ./docker/scripts/run.py /code
ADD ./docker/mysql_spring.yml /code
ADD ./docker/config/application.yml /code/config/
ADD ./docker/config/vorto-repository-config-mysql.json /code/config/
ADD ./docker/scripts/wait-for-it.sh /code
RUN chmod +x wait-for-it.sh
CMD ["/bin/bash", "/code/wait-for-it.sh", "-t", "120", "db:3306", "--", "/usr/bin/python3", "/code/run.py"]
Expand Down
39 changes: 39 additions & 0 deletions docker/config/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (c) 2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
#

server:
contextPath: /

repo:
configFile: vorto-repository-config-mysql.json
attachment:
allowed:
extension:

spring:
datasource:
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
wait_timeout: 180
validationInterval: 60
validationQuery: SELECT 1
driver-class-name: org.mariadb.jdbc.Driver
url:
username:
password:
jpa:
show-sql: false
generate-ddl: true
hibernate:
ddl-auto: none

50 changes: 50 additions & 0 deletions docker/config/vorto-repository-config-mysql.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "vorto",
"workspaces": {
"default": "default",
"allowCreation": true
},
"security": {
"anonymous": {
"roles": [
"readonly",
"readwrite",
"admin"
],
"useOnFailedLogin": false
},
"providers": [
{
"name": "Spring Security",
"classname": "org.eclipse.vorto.repository.core.security.SpringSecurityProvider"
}
]
},
"storage": {
"persistence": {
"type": "db",
"driver": "org.mariadb.jdbc.Driver",
"connectionUrl": "${spring.datasource.url}",
"username": "${spring.datasource.username}",
"password": "${spring.datasource.password}"
},
"binaryStorage": {
"type": "database",
"driverClass": "org.mariadb.jdbc.Driver",
"url": "${spring.datasource.url}",
"username": "${spring.datasource.username}",
"password": "${spring.datasource.password}"
}
},
"sequencing": {
"removeDerivedContentWithOriginal": false,
"sequencers": {
"Vorto Sequencer": {
"classname": "org.eclipse.vorto.repository.core.impl.ModelSequencer",
"pathExpressions": [
"default://(*.type|*.fbmodel|*.infomodel|*.mapping)/jcr:content[@jcr:data]"
]
}
}
}
}
3 changes: 2 additions & 1 deletion docker/scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ def main():
sys.exit(1)

if datasource == "mysql":
with open("./mysql_spring.yml") as yaml_file:
with open("./config/application.yml") as yaml_file:
yaml_data = yaml.safe_load(yaml_file.read())
spring_application.update(yaml_data)
args.update({"spring.datasource.url": getenv("MYSQL_URL", "jdbc:mysql://db:3306/vorto")})
args.update({"spring.datasource.username": getenv("MYSQL_USER", "root")})
args.update({"spring.datasource.password": getenv("MYSQL_ROOT_PASSWORD")})
args.update({"spring.datasource.driver-class-name": "org.mariadb.jdbc.Driver"})
#generator settings
if is_generator:
if getenv("SERVICE_URL"):
Expand Down

0 comments on commit 3eb6206

Please sign in to comment.