Deploy CUBA to Heroku in ten steps

Hi,

I recently released a new blog post about deploying a CUBA application to Heroku. With the latest changes in 7.2 it even got easier to perform the deployment. In combination with Heroku it really becomes an easy, fast and reliable way of hosting your CUBA application.

In the blog post you will learn the difference between IaaS and PaaS like Heroku. Then I go ahead and explain the “PaaS experience” on the concrete example of deploying the Petclinic app to Heroku.

read more: Road to CUBA and beyond: CUBA to Heroku in ten steps

Alternatively, if you are more into video tutorials I captured the steps in this youtube vid as well:
Youtube - How to deploy a CUBA Platform application to Heroku in 10 steps

Cheers
Mario

9 Likes

Hi @mario .

Like always, your how to’s are the best!
I have my application running on Heroku very well by following your steps.

Now I have a question: what is the best way to add production params in this case, like:

[‘cuba.web.loginDialogDefaultUser’:’’,
‘cuba.web.loginDialogDefaultPassword’:’’,
‘cuba.web.productionMode’:true]

Hi,

You can just put those into the prod-app.properties file.

Cheers
Mario

@mario,

I tried to put:

cuba.web.loginDialogDefaultUser =
cuba.web.loginDialogDefaultPassword =
cuba.web.productionMode = true

in my prod-app.properties (795 Bytes) file but it didn’t work.
Am I doing something wrong?

Thank you again.

See in the docs:
https://doc.cuba-platform.com/manual-7.2/app_properties_reference.html#cuba.web.loginDialogDefaultUser

This property should be set to <disabled> value in production environment.

Hi @AlexBudarov,

I’m really sorry for my difficult, but it still not working. I’m confused with properties files.

My project have:

And I also have the lines:

def webProperties = new File(webConfDir, ‘local.app.properties’)
webProperties.text = ‘’’ cuba.webContextName = / ‘’’

in the build.gradle (5.4 KB) file.

So, what I don’t know is where and how I need to include the properties that I want to exists only on my Heroku production environment.

Thank you so much!

Oops.
Default login user and password and cuba.web.productionMode belong to web module, so you can’t put them to prod-app.properties.

You should create prod-web-app.properties file in the same directory as web-app.properties.
And put production parameter values there.

1 Like

Oww… now it’s perfect!
Thank you, @AlexBudarov! :facepunch:

Hi @mario

I followed your steps for deploying cuba apps to the heroku environment, However I’m running into an issue regarding the dataSource or database connection.
image

cuba.dataSource.jdbcUrl=${JDBC_DATABASE_URL} appears as unused.

an extract from the logs: Caused by: java.lang.RuntimeException: Failed to load driver class org.postgresql.Driver in either of HikariConfig class loader or Thread context classloader

I’m using MySQL for developement.
Thanks

Hi,

Probably you are using outdated CUBA Studio version.

If you are using MySQL, of course you need to change database connection settings.
E.g. cuba.dbmsType = mysql in prod-app.properties.

Hi @AlexBudarov

Thank you for the reply, I have installed the latest version and cuba.dataSource.jdbcUrl=${JDBC_DATABASE_URL} is now active.

It seems like heroku doesn’t have free mysql database options equivalent to Heroku Postgres. The available Mysql options are all asking for credit card info.

I’m now busy installing Postgres on my machine.
I will revert with feedback.

@AlexBudarov I install Postgres, All is working now.
Thanks