Cuba project setting best practices

Hi, we are now using the great CUBA platform from a few months, everything is going really good but we have two little questions that, even looking for a solution, has not a good answer so far.

  1. how manage the project settings, like mysql localhost and other setting, when you have more than one developer working on a single project? I mean, every time a developer push the project to the version control, overwrites the previous values… so how to work with that?

  2. in somehow linked to the first question, how we can manage the dev, qa, prod envs? We found a few threads speaking about it but not an “official” solution to this problem…

Thank you very much!

1 Like

Hi,

First of all, I have to ask, are you familiar with the IntelliJ IDEA’s concept of “VCS change lists”?
Personally in my practice when I alter contents of the file that I don’t want to commit back to version control, I create separate “dont commit” change list, put changed file to that list, and forget about the problem.

Second, in upcoming CUBA 7.2 there will be the option to store database connection properties in app.properties files. Connecting to Databases - CUBA Platform. Developer’s Manual

Overriding on the local machine such properties that are stored in the app.properties can be easier.
I would do the following:

  • create file “applocal.properties” near to the main app.properties file
  • put path to this file to the .gitignore configuration - so its contents will never be pushed to VCS
  • mention this new file in the appPropertiesConfig context parameter in the web.xml of the corresponding module, below main properties file. E.g.
    <!-- Application properties config files -->
    <context-param>
        <param-name>appPropertiesConfig</param-name>
        <param-value>
            classpath:com/company/playground/app.properties
            classpath:com/company/playground/applocal.properties
            /WEB-INF/local.app.properties
            "file:${catalina.base}/conf/app-core/local.app.properties"
        </param-value>
    </context-param>
  • put all developer-machine-local properties to the new applocal.properties file. All developers in the team will need to create and fill that file manually, because this file will not come to VCS.

In the upcoming CUBA 7.2 release notes you can find two new features to support dev/qa/prod separation:
https://files.cuba-platform.com/cuba/release-notes/7.2/

  1. Spring profiles can be used to customize application in different environments.
  1. OS environment variables can be used as a source of application properties values.

Spring profiles are the direct solution - you can define dev/qa/prod-specific Bean implementations or assign qa/prod-specific application property files.

OS environment variables can be used to pass secret variables (database credentials) to the application in qa / prod environments.

@AlexBudarov, Thank you very much I will check out everything. Thanks for your time.
Angelo