Skip to content

Latest commit

 

History

History
118 lines (94 loc) · 4.92 KB

production.adoc

File metadata and controls

118 lines (94 loc) · 4.92 KB

Configuration for Production

Configuration of data source, Discourse integration and OAuth 2.0 security providers such as Google, Facebook or Twitter for production environment is externalized into file called mc-config.groovy.

Important
You always have to provide the mc-config.groovy file with at least Database Configuration present otherwise the catalogue will not start.

Configuration File Location

For local testing place your mc-config.groovy file into your $USER_HOME/.grails/ directory. For running on Tomcat place your mc-config.groovy file into your Tomcat’s conf directory ($CATALINA_BASE/conf/).

Database Configuration

For detailed information about setting the data source, please, follow the instruction in the DataSource section of the Grails Reference Documentation.

Note
Model Catalogue has been so far tested only using MySQL Database. Default configuration provides you the MySQL driver out of the box.
Sample MySQL Data Source Configuration
dataSource {
    pooled = true
    dbCreate = "update"
    url = "jdbc:mysql://localhost:3306/my_database?autoReconnect=true&useUnicode=yes"
    driverClassName = "com.mysql.jdbc.Driver"
    dialect = org.hibernate.dialect.MySQLDialect
    username = "username"
    password = "password"
    properties {
       jmxEnabled = true
       initialSize = 5
       maxActive = 50
       minIdle = 5
       maxIdle = 25
       maxWait = 10000
       maxAge = 10 * 60000
       timeBetweenEvictionRunsMillis = 5000
       minEvictableIdleTimeMillis = 60000
       validationQuery = "SELECT 1"
       validationQueryTimeout = 3
       validationInterval = 15000
       testOnBorrow = true
       testWhileIdle = true
       testOnReturn = false
       jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
       defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
    }
}

Mail Configuration

Mail plugin must be configured properly to allow user registration (enabled by grails.mc.allow.signup configuration property set to true).

For detailed information about setting the data source, please, follow the instruction in Grails Mail Plugin Documentation where you can see the configuration for most common mail providers. By default the application expects unsecured mail server running on the localhost.

OAuth 2.0 Configuration

Following three providers are included out of the box:

You must configure the provides to enable them. See the documentation for particular plugin for details.

Due issues in class loading following APIs implementation must be used:

  • org.modelcatalogue.repack.org.scribe.builder.api.FacebookApi

  • org.modelcatalogue.repack.org.scribe.builder.api.GoogleApi20

  • org.modelcatalogue.repack.org.scribe.builder.api.TwitterApi

Google OAuth 2.0 Configuration

  1. Create new project in Google Developers Console

  2. Open new project and navigate to menu:APIs & auth [Credentials]

  3. Press the btn:Create new Client ID, select Web Application and fill your website URL into Authorized JavaScript origins input and your website URL followed by /oauth/google/callback into Authorized redirect URIs

  4. Use generated Client ID and Client secret in the following configuration

Sample Google OAuth 2.0 Provider Configuration
oauth {
    providers {
        google {
            // this key is limited to localhost only so no need to hide it
            api = org.modelcatalogue.repack.org.scribe.builder.api.GoogleApi20
            key = 'change-to-key-from-console'
            secret = 'change-to-secret-from-console'
            successUri = '/oauth/google/success'
            failureUri = '/oauth/google/error'
            callback = "${grails.serverURL}/oauth/google/callback"
            scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'
        }
    }
}

Home Page Customisation

You can customize the text of the home page by setting HTML content into the mc.welcome.jumbo and mc.welcome.info configuration properties. The mc.welcome.jumbo replaces content in the big grey box, the mc.welcome.info the text under the big gray box.

Relationship Types Synchronization

Relationship types are crutial part of the model catalogue. If you want to stay always synchronized with their expected values, set mc.sync.relationshipTypes config property to true.