Supporting MariaDB with OpenMRS 2.3 release?

@cintiadr,

Could you help me out here. I’m still getting the connection refused error with the MySQL docker container. I don’t know what I may be doing wrong here.

Thanks,

Hi @dkayiwa @cintiadr, I have fixed the issues with the MySQL build and it works against MySQL and MariaDB. I will like to proceed to the next steps. As @burke stated

Create a CI plan to build openmrs-core against MySQL, failing if build fails. (DONE!) Create a CI plan to build openmrs-core against MariaDB, failing if build fails. (DONE!) Make sure MySQL plan runs integration tests, failing if tests fail (CURRENT) Make sure MariaDB plan runs integration tests, failing if tests fail (CURRENT) Enhance MySQL plan to do first-time setup of reference application, failing if setup fails Enhance MariaDB plan to do first-time setup of reference application, failing if setup fails Enhance MySQL plan to run refapp integration tests Enhance MariaDB plan to run refapp integration tests

I am currently working on adding the integration tests to the tests. I will need your assistance with this.

@ch3ck, it’s great to see you making progress on this!

Would you mind giving the URLs to the bamboo plans for the things you have completed?

@darius, These are the links are shared last time. Just check them out and give me feedback.

@ch3ck, this thread is long (and confusing for those of us who haven’t been following it closely!)

Would you mind posting the URLs again of the 4 thing you said are done or in progress, in one consolidated message?

1 Like

Here is MariaDB: https://ci.openmrs.org/browse/TRUNK-OOM As for MySQL: https://ci.openmrs.org/browse/TRUNK-MWO-9

The first part works. Now I have to move on to writing scripts for next steps.

Thanks @ch3ck for you help with this. Where do things stand today?

/cc @dkayiwa

Hi @burke, I have finished the first part, I’m trying to run the integration tests for both plans and the ref App tests setup. Once I’m done with this. It should be all good.

Hi @cintiadr @dkayiwa

I am having an issue running the integration tests. I am constantly getting this error:

>   /bin/sh: 1: -DdatabaseUsername=test: not found

I properly configured the user names and password to test, but I don’t understand the error here.

I also get this error activation the integration tests, https://paste.kde.org/p3dcl56mz

Cheers!

Probably it’s missing a \ before the previous line. I assume it’s something which is supposedly one single line, but there’s an endline when it shoudln’t.

Can you give me the link to the build?

Hi @cintiadr,

Here are the links:

Here is MariaDB: https://ci.openmrs.org/browse/TRUNK-OOM
As for MySQL: https://ci.openmrs.org/browse/TRUNK-MWO-9 

Just let me know how it goes.

Thanks, Nyah

In https://ci.openmrs.org/browse/TRUNK-MWO-112/log

“Cannot execute mojo: resources. It requires a project with an existing pom.xml, but the build is not using one.”

I don’t know where you are running maven, but you don’t seem to have a maven project on that folder. I can see the ‘Integration test for OpenMRS’ task trying to run maven, but it absolutely needs somehow a checkout of a maven repository before.

Looking the other one now.

The other one, https://ci.openmrs.org/browse/TRUNK-OOM-JOB1-67/log

You are trying to run a docker registry named ‘maria’, which doesn’t exist: '05-Nov-2015 11:48:57 Unable to find image ‘maria:latest’ locally 05-Nov-2015 11:48:59 Pulling repository maria 05-Nov-2015 11:48:59 time=“2015-11-05T11:48:59Z” level=fatal msg=“Error: image library/maria:latest not found” ’

Mariadb is the name: https://hub.docker.com/_/mariadb/ It’s running now.

One thing is that you are creating the openmrs dockers with the same names in two different builds. They are going to collide pretty soon.

The builds are stopping the containers, but not removing them. I just went to the agent and removed them all, but we should change it on the build too.

Now the mariadb is failing to get the 3307 port, but I don’t get it, shouldn’t it use 3306?

@cintiadr,

I used port 3307 because of the collisions that occurred with the containers It’s like some of the ports were already in use. that’s what caused me to change the ports. Let me check the updates you’ve made so far.

Thanks, Nyah

I will take a look over the weekend, will let you know.

But can you please let me know the repository where the integration tests are, and how to run them against some specific running instance?

That will be great @cintiadr,

Here is what was using: 1.) https://wiki.openmrs.org/display/docs/Behavior+Driven+Design+in+OpenMRS 2.) https://github.com/openmrs/openmrs-distro-referenceapplication

Just let me know how it goes.

Thanks, Nyah

@raff, I need your help with the SDK.

So, in a docker container, I’m running:

mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.3:setup \
-B -e \
-DserverId=4 \
-Dversion=2.3 \
-DdbDriver=mysql \  
-DdbUri=jdbc:mysql://172.17.0.1:3306/openmrs-4 \
-DdbUser=root \
-DdbPassword=openmrs

I can see it created the installation.properties file

root@d11ca3f8bcfe:~# cat /root/openmrs/4/installation.properties
#Mon Nov 09 00:57:58 UTC 2015
openmrs.platform.version=2.3
create_database_user=false
connection.username=root
connection.url=jdbc\:mysql\://172.17.0.1\:3306/openmrs-4
server.id=4
connection.driver_class=com.mysql.jdbc.Driver
admin_user_password=Admin123
connection.password=openmrs
install_method=auto
module_web_admin=true
add_demo_data=false
create_tables=true
has_current_openmrs_database=true
openmrs.version=1.11.4
database_name=openmrs-4
auto_update_database=false

And then I try to run the run command:

$ mvn \
org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.3:run \
-B -e \
-DserverId=4

(.... downloads the internet...)
[INFO] Configuring Jetty for project: Maven Stub Project (No POM)
[INFO] Context path = /openmrs
[INFO] Tmp directory = /root/openmrs/4/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
2015-11-09 07:08:24.941:INFO:oejs.Server:main: jetty-9.0.4.v20130625
2015-11-09 07:08:28.165:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
2015-11-09 07:08:36.801:INFO:/openmrs:main: No Spring WebApplicationInitializer types detected on classpath
2015-11-09 07:08:37.595:INFO:/openmrs:main: Set web app root system property: 'webapp.root' = [/root/openmrs/4/tmp/webapp]
2015-11-09 07:08:37.598:INFO:/openmrs:main: Initializing log4j from [classpath:log4j.xml]
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2669) |2015-11-09 07:08:37,678| Unable to find a runtime properties file at /root/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2697) |2015-11-09 07:08:37,697| Unable to find properties file: /root/openmrs/4/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimeProperties(2630) |2015-11-09 07:08:37,699| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2669) |2015-11-09 07:08:38,168| Unable to find a runtime properties file at /root/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2697) |2015-11-09 07:08:38,171| Unable to find properties file: /root/openmrs/4/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimeProperties(2630) |2015-11-09 07:08:38,172| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.
ERROR - UpdateFilterModel.updateChanges(77) |2015-11-09 07:08:42,496| Unable to get the database changes
java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database.  Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set
    at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:637)
    at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:594)
    at org.openmrs.web.filter.update.UpdateFilterModel.updateChanges(UpdateFilterModel.java:69)
    at org.openmrs.web.filter.update.UpdateFilterModel.<init>(UpdateFilterModel.java:47)
    at org.openmrs.web.filter.update.UpdateFilter.init(UpdateFilter.java:457)
    at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:135)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:800)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:288)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1322)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:731)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:490)
    at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:280)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:175)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.server.Server.start(Server.java:342)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.server.Server.doStart(Server.java:290)
    at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:68)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:556)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:352)
    at org.eclipse.jetty.maven.plugin.JettyRunWarMojo.execute(JettyRunWarMojo.java:69)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:94)
    at org.openmrs.maven.plugins.Run.execute(Run.java:113)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.Exception: Unable to get a connection to the database.  Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set
    at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:369)
    at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:623)
    ... 55 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
    at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2395)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2316)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at org.openmrs.util.DatabaseUpdater.getConnection(DatabaseUpdater.java:431)
    at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:366)
    ... 56 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1129)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:358)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)
    at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2334)
    ... 70 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:244)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:308)
    ... 72 more
2015-11-09 07:08:46.567:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@6ac0b715{/openmrs,file:/root/openmrs/4/tmp/webapp/,AVAILABLE}{/root/openmrs/4/openmrs-1.11.4.war}
2015-11-09 07:08:46.615:INFO:oejs.ServerConnector:main: Started ServerConnector@3bf24519{HTTP/1.1}{0.0.0.0:8080}
[INFO] Started Jetty Server

And then I’m not sure why it’s failing. I can really login using that user, I tried both root and the owner of the database, test/test. I can login using mysql client in another docker container using that IP/username/password/database.

Should I pass some other option? How to debug this?

In case you want to reproduce, after cloning https://github.com/cintiadr/docker-openmrs:

~/checkouts/docker-openmrs (master:git) $ vagrant up  # run the openmrs:setup and wait for a loooong time
~/checkouts/docker-openmrs (master:git) $ vagrant ssh
vagrant@vagrant:~$ sudo -i
root@vagrant:~# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
d11ca3f8bcfe        openmrs-mysql       "/bin/sh -c /bin/run-"   6 hours ago         Up 6 hours          0.0.0.0:32768->8080/tcp   openmrs-mysql-4
fb030b3d5808        mysql               "/entrypoint.sh mysql"   6 hours ago         Up 6 hours          3306/tcp                  mysql-4
root@vagrant:~# docker exec -it d11ca3f8bcfe /bin/bash  #(copy the container ID of the openmrs-mysql)
root@d11ca3f8bcfe:/# cd ~
root@d11ca3f8bcfe:~# mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.3:run -B -e -DserverId=4

Did you try to open up a web browser after the [INFO] Started Jetty Server message? What page you see? Is the maven process running or died?

I would also check, if the openmrs-4 database exists after running the setup command. Please make sure it is newly created by the setup command i.e. it has no tables yet.

Looking at logs in /root/openmrs/4/openmrs.log could also help to troubleshoot.

Thanks for the answer.

The maven process continues.

The index page redirects to: http://localhost:8080/openmrs/initialsetup

The database is supposed to be working fine, I can connect using mysql client with those same creds and database. It’s empty as it’s a new docker container running every time.

The thing is, I cannot find anywhere on the logs where it’s loading the installation.properties. Also, i couldn’t find that log you mentioned o.O, no idea how or why