Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request : adding jdbc sources via JNDI and volumes #20

Open
jguay opened this issue Jun 4, 2019 · 0 comments
Open

Enhancement Request : adding jdbc sources via JNDI and volumes #20

jguay opened this issue Jun 4, 2019 · 0 comments

Comments

@jguay
Copy link

jguay commented Jun 4, 2019

At the moment beside creating a new image/Dockerfile, it is not possible to add a JDBC source at container level via environment variables or volume

** similar issue : **
#11

** Description of limitation : **
I try to use this doc to add a jdbc datasource in server.xml

docker-compose.yml

version: "3.6"
services:
  BI_knowage0:
    container_name: BI_knowage0
    image: knowagelabs/knowage-server-docker:6.3.3
    ports:
    - 8080:8080
    environment:
    - WAIT_MYSQL=true
    - DB_ENV_MYSQL_USER=dbuser
    - DB_ENV_MYSQL_DATABASE=knowagedb
    - DB_ENV_MYSQL_PASSWORD=p6ssword
    - DB_PORT_3306_TCP_ADDR=BI_mysql0
    - DB_PORT_3306_TCP_PORT=3306
    depends_on:
    - BI_mysql0
    volumes:
    - ./config/knowage.xml:/home/knowage/apache-tomcat-8.5.37/conf/server.xml
    - ./config/some-jdbc-package.jar:/home/knowage/apache-tomcat-8.5.37/lib/some-jdbc-package.jar
  BI_mysql0:
    image: mysql:5.6
    container_name: BI_mysql0
    environment:
    - MYSQL_USER=dbuser
    - MYSQL_PASSWORD=p6ssword
    - MYSQL_DATABASE=knowagedb
    - MYSQL_ROOT_PASSWORD=p6ssword

Then I run :

docker-compose up BI_knowage0

This results in infamous sed error:

BI_knowage0      | sed: cannot rename /home/knowage/apache-tomcat-8.5.37/conf/sedwHVP0f: Device or resource busy
BI_knowage0 exited with code 4

** Possible solution : adding feature in entrypoint.sh : **

Current code :
https://github.com/KnowageLabs/Knowage-Server-Docker/blob/master/entrypoint.sh#L42 :

I add a random location whereby any file will be added to server.xml after line 42

sed -i "s|${old_connection}|${new_connection}|" ${KNOWAGE_DIRECTORY}/${APACHE_TOMCAT_PACKAGE}/conf/server.xml
# Adding all content of customJNDIs folder to server.xml
sed -i '/<!-- KNOWAGE -->/r'<(cat ${KNOWAGE_DIRECTORY}/${APACHE_TOMCAT_PACKAGE}/customJNDIs/*) -i -- ${KNOWAGE_DIRECTORY}/${APACHE_TOMCAT_PACKAGE}/conf/server.xml

•• Testing solution works : **

In this case to test this is working, I added the code overwriting the entrypoint.sh and then my jdbc file according to

version: "3.6"
services:
  BI_knowage0:
    container_name: BI_knowage0
    image: knowagelabs/knowage-server-docker:6.3.3
    ports:
    - 8080:8080
    environment:
    - WAIT_MYSQL=true
    - DB_ENV_MYSQL_USER=dbuser
    - DB_ENV_MYSQL_DATABASE=knowagedb
    - DB_ENV_MYSQL_PASSWORD=p6ssword
    - DB_PORT_3306_TCP_ADDR=BI_mysql0
    - DB_PORT_3306_TCP_PORT=3306
    depends_on:
    - BI_mysql0
    volumes:
    - ./config/some-new-jdbc-datasource.xml:/home/knowage/apache-tomcat-8.5.37/customJNDIs/some-new-jdbc-datasource.xml
    - ./config/some-jdbc-package.jar:/home/knowage/apache-tomcat-8.5.37/lib/some-jdbc-package.jar
    - ./config/knowage-entrypoint.sh:/home/knowage/apache-tomcat-8.5.37/bin/entrypoint.sh
  BI_mysql0:
    image: mysql:5.6
    container_name: BI_mysql0
    environment:
    - MYSQL_USER=dbuser
    - MYSQL_PASSWORD=p6ssword
    - MYSQL_DATABASE=knowagedb
    - MYSQL_ROOT_PASSWORD=p6ssword

Then I run :

docker-compose up -d BI_knowage0 && sleep 5 && docker-compose exec BI_knowage0 more /home/knowage/apache-tomcat-8.5.37/conf/server.xml

Knowage starts without issue this shows my jdbc source which I added as JNDI source... I'm just learning through knowage so I am yet to use it (I'm automating as much as possible so will try to see if I can automate the JNDI datasource creation and a report next... I just thought maybe the enhancement request makes sense to at least provide a way to add snippet into server.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant