2016-02-12 by Axel Fontaine
In our previous post we introduced Boxfuse's new support for managing databases. In addition to being able to quickly fuse VM images and run those unchanged locally on VirtualBox and in the Cloud on AWS, Boxfuse now also makes it trivial to run the relational databases that those services need.
Today we are extending Boxfuse's database support beyond PostgreSQL and adding full support for MySQL.
No more management headaches for your MySQL databases. Boxfuse now takes care of provisioning, starting, stopping and deleting them for you (Boxfuse always creates a snapshot before deleting a database, so you can restore it at any time).
What do you need to do to enable this? You can either specify that you want a MySQL database when you create your app via your client of choice (Command-line tool, Maven plugin or Gradle plugin) or simply the Boxfuse Console:
However in most cases you won't need to even do this. If your application includes the MySQL JDBC driver
Boxfuse will detect it automatically for you and configure your application accordingly. If want to manage your
database yourself, this can of course be disabled by explicitly setting the database type to
when you create your app.
Boxfuse then automatically provisions a MySQL database for you. It does this both locally using the Boxfuse Dev VM and on AWS using RDS.
And just like for PostgreSQL, if your application is based on Spring Boot, Grails, Play or Dropwizard, Boxfuse will automatically configure your framework's default datasource with the correct database driver class name, URL, user and password. This works identically in every environment, both locally and on AWS.
Sometimes however you also want to access your database from outside the application itself. To make it easy to get the database url, user name, password and more we are introducing a new command called boxfuse info. This command gives you all the information you need:
> boxfuse info hello -env=test Info about myuser/hello in the test environment: App Type : Single Instance with Zero Downtime updates App URL : http://hello-test-myuser.boxfuse.io/ DB Type : PostgreSQL database DB URL : jdbc:postgresql://boxdb-myuser-test-hello.ca53c5vrhrzn.eu-central-1.rds.amazonaws.com:5432/hello DB Host : boxdb-myuser-test-hello.ca53c5vrhrzn.eu-central-1.rds.amazonaws.com DB Port : 5432 DB Database : hello DB User : qbGh5bYandLAYiXBHXp5L8jQliU9qwAkEFRf1R7JzJJ3azNwWmauKfYJe1TCoUW DB Password : JDBsCkFuDUCqLwDhbWZcZWmaeFCN7W8aAIzy0MjYA5ICXKCf3zMO7azw9092VFFqsnKayqWefAaklZchfATAbLsvShdsOWjKJBaU DB Status : available
You can then easily copy this information to configure the client of your choice.
While being to copy this information is nice, we think not having to copy-paste anything is even better!
To be able to quickly access the database (MySQL or PostgreSQL) of your app in any environment using that database's
native client (
psql) via a secure connection with the character encoring properly
set, we are introducing a new option to the open command: boxfuse open -db.
So now if you run an application on your test environment on AWS and you want to access its database (say PostgreSQL in this case) running on RDS securily via SSL, all you need to do is:
> boxfuse open hello -env=test -db Launching psql to access the myuser/hello PostgreSQL database in the test environment ... psql (9.4.5, Server 9.4.5) SSL connection (Cipher: ECDHE-RSA-AES256-SHA, Bits: 256) Type "help" for help. hello=>\conninfo You are connected with the database „hello“ as user „qbGh5bYandLAYiXBHXp5L8jQliU9qwAkEFRf1R7JzJJ3azNwWmauKfYJe1TCoUW“ on host „boxdb-myuser-test-hello.ca53c5vrhrzn.eu-central-1.rds.amazonaws.com“ on port „5432“. SSL connection (Cipher: ECDHE-RSA-AES256-SHA, Bits: 256) hello=>\q
And there you have it! You are now is a secure connection with your database using its native client. All the character encoding and RDS root certificate management is done automatically for you.
In this post, we introduced full MySQL support for Boxfuse's dead-easy database management capabilities.
Boxfuse now automatically detects the MySQL JDBC driver in your application and proceeds to provision MySQL databases both locally and on AWS RDS. Boxfuse exposes the database URL, user and password as environment variables within the application instances. And if your application is based on Spring Boot, Grails, Play or Dropwizard, Boxfuse automatically configures your framework's default datasource with those settings.
However sometimes you also want to access your database through some external tool, so we introduced boxfuse info to be able to quickly and conveniently get the information you need.
But if you want an even easier solution you can now use Boxfuse's new boxfuse open -db switch to drop straight into a secure connection to the database of your application in that environment using your database's native client.
So if you haven't already, start deploying your applications and their databases effortlessly with Boxfuse today. Simply log in to the Boxfuse Console with your GitHub id, download the Boxfuse Client and enjoy!