1

I am struggling to start an aerogear unified push server in a docker environment with a mysql databases. I am following the Aerogear documentation here.

So I have started a mysql docker container

docker run --name aerogearsql -e MYSQL_ROOT_PASSWORD=sqlpwd -d mysql

on which I have applied what is said in aerogear documentation

docker exec -ti aerogearsql -u root -p
mysql> create database unifiedpush default character set = "UTF8" default collate = "utf8_general_ci";
mysql> create user 'unifiedpush'@'localhost' identified by 'unifiedpush';
mysql> GRANT SELECT,INSERT,UPDATE,ALTER,DELETE,CREATE,DROP ON unifiedpush.* TO 'unifiedpush'@'localhost';

Then I have prepared a docker image using the following docker file applying what is in aerogear documentation. Here is the docker file

FROM jboss/wildfly
MAINTAINER yves.nicolas@dynamease.com


ENV AEROGEAR_VERSION 1.0.3
ENV AEROGEAR_FILES /usr/local/share/aerogear
ENV AEROGEAR_DIR $AEROGEAR_FILES/aerogear-unifiedpush-server-$AEROGEAR_VERSION
ENV JBOSS_HOME /opt/jboss/wildfly


# Run everything below as root user
USER root

# Set the Java environment variable
ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk

RUN mkdir -p $AEROGEAR_FILES && chmod -R ugo+rwx $AEROGEAR_FILES

# Install Maven it will be needed for my SQL
RUN curl -L -o /etc/yum.repos.d/epel-apache-maven.repo http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo \
    && yum -y install apache-maven && yum clean all

# Switch back to jboss user
USER jboss


# Get Aerogear version
WORKDIR $AEROGEAR_FILES

RUN curl -L -o aerogear-unifiedpush-server-$AEROGEAR_VERSION-dist.tar.gz https://github.com/aerogear/aerogear-unifiedpush-server/releases/download/$AEROGEAR_VERSION/aerogear-unifiedpush-server
-$AEROGEAR_VERSION-dist.tar.gz \
    && tar -xvf aerogear-unifiedpush-server-$AEROGEAR_VERSION-dist.tar.gz  \
    && cp -r aerogear-unifiedpush-server-$AEROGEAR_VERSION/databases/src/main/resources/modules/com $JBOSS_HOME/modules/


# Do Sql Dependency maven
RUN mvn dependency:copy -Dartifact=mysql:mysql-connector-java:5.1.18 -DoutputDirectory=$JBOSS_HOME/modules/com/mysql/jdbc/main/

# can remove maven at this stage
USER root
RUN yum -y erase apache-maven && yum clean all

# Switch back to jboss user
USER jboss


WORKDIR $JBOSS_HOME

VOLUME $JBOSS_HOME

EXPOSE 8443

CMD ["/opt/jboss/wildfly/bin/standalone.sh","-b","0.0.0.0"]

From this image, I have started a container linked to the mysql

docker run  --name essaipush --link aerogearsql:mysql -v /home/yves:/host -p 8443:8443 yvnicolas/aerogear

Wildfly server starts well with nothing deployed yet Using docker exec, I have then applied the mysql cli script

$ ./path/to/SERVER_HOME/bin/jboss-cli.sh --file=/path/to/mysql-database-config-wildfly.cli

after I had updated the mysql-database-config-wildfly.cli to use mysql instead of localhost for the database access host.

Still using docker exec, I finally move the 2 war files into the standalone/deployment directory and this doesnt go well as it seems that it doesnt find the database.

Here is some of the copies of the exception raised. As I am not familiar with Hibernate and Jboss, I can not tell whether the root cause comes from this hibernate.dialect not set or from communication problems between the 2 containers.

20:07:47,524 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "unifiedpush-server-wildfly.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"unifiedpush-server-wildfly.war#unifiedpush-default\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"unifiedpush-server-wildfly.war#unifiedpush-default\": org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set"}}

aused by: java.sql.SQLException: Access denied for user 'unifiedpush'@'172.17.0.33' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1308)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:312)
Yves Nicolas
  • 6,901
  • 7
  • 25
  • 40
  • seems your mysql user is not allowed to login with `172.17.0.33`, have you tried to grant privileges to `'unifiedpush'@'172.17.0.33'`? – Freeznet Jul 15 '15 at 03:57
  • the 172.17.0.33 is the docker assigned ip adress for the container that has started with unified push. This error shows that somewhere there is a tentative access on localhost://3306 as if the change I have done in mysql-database-config-wildfly.cli was not enough. – Yves Nicolas Jul 16 '15 at 18:10

1 Answers1

0

we have now docker-compose yml file (for 1.1.0) https://github.com/aerogear/aerogear-unifiedpush-server/tree/master/databases/docker

and a bit of doc around that: https://staging.aerogear.org/docs/unifiedpush/ups_userguide/index/#Docker-databases

  • Thanks for the hint, that is a good start. Still needs some work to do to adapt what is in the doc to prepare the database, but I had my server started without Java error. I can still not access it thru my navigator. I have linked the docker container to port 8443 (-p 8443:8443) and accessing thru https://localhost:8443/ag-push gives me an error "The page you are trying to view cannot be shown because the authenticity of the received data could not be verified." Tried various firefox certificates options based on quick web reading bud was not able to fix it. Any clue? – Yves Nicolas Jul 16 '15 at 18:35
  • No luck here as well, I started the MySQL using docker-compose and then run the server, I get DB errors, tables not found, Android Variant not found and in the end it says: Services which failed to start: service jboss.persistenceunit."ag-push.war#unifiedpush-default". How do you configure the UnifiedPushServer to use the MySQL Servers created using the docker-compose? – bentzy Nov 17 '15 at 08:25