1

As Multi-Tenant Functionality for Moqui Framework 2.0.0 has been removed, I am trying to implement same with Docker.

  1. I just created image using- $ ./docker-build.sh
  2. Modified- moqui-ng-my-compose.yml
  3. ./compose-run.sh moqui-ng-my-compose.yml
  4. Exception occurred: | 08:07:47.864 INFO main .moqui.i.c.TransactionInternalBitronix Initializing DataSource transactional_DS (mysql) with properties: [uri:jdbc:mysql://127.0.0.1:3306/moquitest_20161126?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8, user:root] moqui-server | 08:07:51.868 ERROR main o.moqui.i.w.MoquiContextListener Error initializing webapp context: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named transactional_DS moqui-server | bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named transactional_DS moqui-server | at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:91) ~[btm-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT] moqui-server | at org.moqui.impl.context.TransactionInternalBitronix.getDataSource(TransactionInternalBitronix.groovy:129) ~[moqui-framework-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] moqui-server | at org.moqui.impl.entity.EntityDatasourceFactoryImpl.init(EntityDatasourceFactoryImpl.groovy:84) ~[moqui-framework-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] moqui-server | at org.moqui.impl.entity.EntityFacadeImpl.initAllDatasources(EntityFacadeImpl.groovy:193) ~[moqui-framework-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] moqui-server | at org.moqui.impl.entity.EntityFacadeImpl.<init>(EntityFacadeImpl.groovy:120) ~[moqui-framework-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] moqui-server | at org.moqui.impl.context.ExecutionContextFactoryImpl.<init>(ExecutionContextFactoryImpl.groovy:198) ~[moqui-framework-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]

Here is my moqui-ng-my-compose.yml file-

version: "2"
services:
  nginx-proxy:
    # For documentation on SSL and other settings see:
    # https://github.com/jwilder/nginx-proxy
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - 80:80
      # - 443:443
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      # - /path/to/certs:/etc/nginx/certs
  moqui-server:
    image: moqui
    container_name: moqui-server
    command: conf=conf/MoquiDevConf.xml
    restart: unless-stopped
    links:
     - mysql-moqui
    volumes:
     - ./runtime/conf:/opt/moqui/runtime/conf
     - ./runtime/lib:/opt/moqui/runtime/lib
     - ./runtime/classes:/opt/moqui/runtime/classes
     - ./runtime/ecomponent:/opt/moqui/runtime/ecomponent
     - ./runtime/log:/opt/moqui/runtime/log
     - ./runtime/txlog:/opt/moqui/runtime/txlog
     # this one isn't needed: - ./runtime/db:/opt/moqui/runtime/db
     - ./runtime/elasticsearch:/opt/moqui/runtime/elasticsearch
    environment:
     - entity_ds_db_conf=mysql
     - entity_ds_host=localhost
     - entity_ds_port=3306
     - entity_ds_database=moquitest_20161126
     - entity_ds_user=root
     - entity_ds_password=123456
     # CHANGE ME - note that VIRTUAL_HOST is for nginx-proxy so it picks up this container as one it should reverse proxy
     - VIRTUAL_HOST=app.visvendra.hyd.company.com
     - webapp_http_host=app.visvendra.hyd.company.com
     - webapp_http_port=80
     # - webapp_https_port=443
     # - webapp_https_enabled=true

  mysql-moqui:
    image: mysql:5.7
    container_name: mysql-moqui
    restart: unless-stopped
    # uncomment this to expose the port for use outside other containers
    # ports:
    #  - 3306:3306
    # edit these as needed to map configuration and data storage
    volumes:
     - ./db/mysql/data:/var/lib/mysql
     # - /my/mysql/conf.d:/etc/mysql/conf.d
    environment:
     - MYSQL_ROOT_PASSWORD=123456
     - MYSQL_DATABASE=moquitest_20161126
     - MYSQL_USER=root
     - MYSQL_PASSWORD=123456

Please let me know if any other information required.

Thanks in advance!!

  • First it looks like you are using a 2.0.0-SNAPSHOT version of Moqui. I recommend updating to the 2.0.0 release or the current code (2.0.1-SNAPSHOT). You may be using an older code snapshot that had issues with Docker deployment (ie picked up a version when it was incomplete or was broken along the way before the final release). – David E. Jones Jan 24 '17 at 19:49
  • To find the real issue more is needed from the log. The error and stack trace you included only has the top level exception and not the root cause. You'll also want to look at the logs for other Docker instances, especially the mysql-moqui one to make sure MySQL started successfully. On a side note, using the MySQL root user is not recommended, that is why the MySQL container supports init with a new user (ie the MYSQL_USER env var). – David E. Jones Jan 24 '17 at 19:53
  • BTW, there is an article on setting this up on LinkedIn: https://www.linkedin.com/pulse/multi-instance-moqui-docker-david-e-jones – David E. Jones Jan 25 '17 at 05:28
  • Thanks @DavidE.Jones. I'll try with latest code base and will revert back. And, the url that you shared - "this article is no longer available". https://www.linkedin.com/pulse/multi-instance-moqui-docker-david-e-jones – Visvendra Singh Rajpoot Jan 25 '17 at 10:38
  • @DavidE.Jones it will be great if you can share such document/link. it will definitely save my time. – Visvendra Singh Rajpoot Jan 27 '17 at 06:09
  • That link is working fine for me, not sure what to say other than over time more and more I really don't like all the limitations of LinkedIn and find issues with it frequently. You may need to have a LinkedIn account and be signed in to see it. – David E. Jones Jan 31 '17 at 18:34
  • I would also recommend trying it with the stock Docker Compose files, get it working, and then try modifying them. Unless you are extremely familiar with Docker and know what the changes you are making will do it is risky to try changing things in your first attempt to test it, and no point in doing it either. – David E. Jones Jan 31 '17 at 18:36

0 Answers0