Plugin allows to use embedded postgres in application.
Owner: relaximus | 1.1.2 | Jan 17, 2019 | Package | Issues | Source | License: Apache-2.0
dependencies {
compile 'embedded.postgres:embedded-postgres:1.1.2'
}
embedded-postgres-grails-plugin
Plugin replaces default embedded H2 datasource in awesome Grails framework to Postgres. Plugin uses already existing solution otj-pg-embedded.
This plugin is not for production use, the main idea to have your development and u-test environment similar to the standalone production Postgres (of course, if you use this DB in the project).
Getting Started
To get started with the minimum of configuration start from the following: Add to your build.gradle
repositories {
maven {
url "https://dl.bintray.com/grails/plugins"
}
}
compile 'org.grails.plugins:embedded-postgres:1.1.2'
In your application.yml change the dataSource settings to the next one:
dataSource:
embeddedPostgres: true
Prerequisites
Plugin configured to work with Grails 3.0.0 or higher, but theoretically can be used even for older version of it. But this was not checked properly, so contributing is welcome.
Configuration
Plugin uses next parameters in DataSource section:
|Parameter name|Description|Default value|
|--------------|-----------|-------------|
| embeddedPostgres | Enabling of the plugin, main switcher. | false |
| embeddedPort | You can define the particular port, which will be used by Postgres instance | random free port |
| url | You can specify the url with any additional parameters, which Postgres understands | jdbc:postgresql://localhost:
All other parameters common for the Grails Datasource configuration section are being used by grails dataSource plugin. For example, you can set
dataSource:
pooled: true
embeddedPostgres: true
In this case embedded Postgres will be created with connection pool in front of it.
License
Acknowledgments
- Great respect to the otj-pg-embedded for Embedded Postgres implementation.