Search code examples
cloudcaptain

boxfuse dev db not provisioned correctly


I'm just starting with boxfuse and can't seem to find a way to get my dev database to be provisioned.

In my boxfuse.yml I have (for the database section):

database:
  # the name of your JDBC driver
  driverClass: com.mysql.jdbc.Driver

  # the username
  user: root

  # the password
  password: <password>

  # the JDBC URL
  url: jdbc:mysql://10.0.0.84:3306/dmsdb

  # any properties specific to your JDBC driver:
  properties:
    charSet: UTF-8
    hibernate.dialect: org.hibernate.dialect.MySQLInnoDBDialect

  # the maximum amount of time to wait on an empty pool before throwing an exception
  maxWaitForConnection: 1s

  # the SQL query to run when validating a connection's liveness
  validationQuery: "/* MyApplication Health Check */ SELECT 1"

  # the minimum number of connections to keep open
  minSize: 8

  # the maximum number of connections to keep open
  maxSize: 32

  # whether or not idle connections should be validated
  checkConnectionWhileIdle: false

If I try running it (boxfuse run), my application doesn't work at all.

boxfuse info produces the following:

oxfuse client v.1.18.7.938 Copyright 2016 Boxfuse GmbH. All rights reserved.

Account: mlr11 (mlr11)

Info about mlr11/dms-service in the dev environment:

App Type    : Single Instance with Zero Downtime updates
App URL     : http://127.0.0.1:8082
DB Type     : MySQL database
DB URL      : jdbc:mysql://localhost:3306/boxfuse-dev-db
DB Host     : localhost
DB Port     : 3306
DB Database : boxfuse-dev-db
DB User     : boxfuse-dev-db
DB Password : boxfuse-dev-db
DB Status   : available

Which is very different than what I was expecting. URL, Database, User, Password) are not matching my boxfuse.yml file.

What I am missing. I know it must be something simple. I did all kind of search and read the doc a few times. I can't seem to find what's wrong. Any pointers will be appreciated.


Solution

  • From the config file you posted I am assuming this is a dropwizard app.

    Since your Boxfuse app was configured to use a MySQL database, Boxfuse automatically provisions a database in each environment when you first deploy your application there. In your case you can see the connection info for that database in the dev environment in the output you post in your question.

    Boxfuse exposes these values (db url, user, password, ...) as environment variables (https://cloudcaptain.sh/docs/databases#envvars) and automatically configures your framework (Dropwizard I assume) to use those instead of the ones included in your config file. It will do so by passing -Ddw.database.url=$BOXFUSE_DATABASE_URL -Ddw.database.user=$BOXFUSE_DATABASE_USER -Ddw.database.password=$BOXFUSE_DATABASE_PASSWORD as arguments to the JVM.

    Also doublecheck in the VirtualBox GUI that your VirtualBox installation is fully functional and able to start VMs and that both the Boxfuse Dev VM and the instance of your application are started properly.