Wednesday, October 23, 2019

MySQL docker volumes on Docker Desktop Windows 10

Using MySQL docker image is a quick and easy way to spin up an MySQL database for your application development and testing. However, if you are running on Windows Docker Desktop on Windows 10, if you do not have a correct volume setup, then the MySQL data volume will be embbed in the HyperV virual disk and is is very hard to reset/clean up. To mitigate the aforementioned problem, you can setup the correct volume on your host and share it with the Docker Desktop, this gives you full control for the MySQL data volume running in the Docker. Here are the steps:

  • create a local folder to hold the MySQL data volume:
    • mkdir c:\tmp\mysql
  • In your Docker Desktop via Settings -> Shared Drives mark your c: drive shared with Docker Desktop
  • Start your MySQL docker container:
    • docker run --net=mysql-network --name mysql -v c:/tmp/mysql:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=***** -d mysql:latest
  • Start MySQL client docker container:
    • docker run -it --network mysql-network --rm mysql:latest mysql -hmysql -uroot -p*****
  • If you do want to blow away the MySQL data volume, now you can easily do it on your host machine.

Friday, October 18, 2019

How to use Intellij to debug Lagom application

When you are learning and running Lagom project, you may want to setup debug in your IDE - Intellij to be able to debug the Lagom application to get some insight on what is going on under the hood. Here is one way how you can setup the Intellij Remote debug to debug Lagom application:

  • First in your terminal run:
    • sbt -jvm-debug 5005
      • this will start the sbt shell with JDWP server on 5005
      • you can use IntelliJ Remote debug to attach the JVM
    • in sbt shell, run: 
      • runAll
  • From then on you should be able to setup break point and debugging on.

Thursday, October 17, 2019

Thingsboard install_dev_db HSQLDB spring.datasource.hikari.maximumPoolSize problem

Thingsboard is a fantastic open source IoT data gathering and visualization platform. I was trying to setup the local development mode for Thingsboard and always step on the mines, so I just want to document the problem and solution for install_dev_db. When you check out the Thingsboard source from github, you need to build the project on your computer:

  • mvn clean install -DskipTests
Then you try to run the application by using your IDE to run java main file: org.thingsboard.server.ThingsboardServerApplication, you will get the following error:
Schema-validation: missing table [admin_settings]

This is an indication that you don't have the database setup, for running in dev mode, we need to swith the DB to HSQLDB by commenting out the Postgres DB configuration and plug in the HSQLDB configuration found here.

When you try to run the install_dev_db.bat you may run into the following error:

Error creating bean with name 'baseTimeseriesService': Unsatisfied dependency expressed through field 'timeseriesDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaTimeseriesDao': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.hikari.maximumPoolSize' in value "${spring.datasource.hikari.maximumPoolSize}"

To solve the aforementioned error, you need add the following configuration in your thingsboard.yml under the spring.datasource:


hikari:
  maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:50}"
This will let you successfully setup the dev DB for thingsboard.

Full Guide for using Bitnami Prometheus Operator Helm Chart with Additional Scrape Configuration

"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of...