https://github.com/npdeehan/camunda-postgrest-example
This is an example of how to connect a postgres database to a Camunda Spring Boot application
https://github.com/npdeehan/camunda-postgrest-example
Last synced: 10 months ago
JSON representation
This is an example of how to connect a postgres database to a Camunda Spring Boot application
- Host: GitHub
- URL: https://github.com/npdeehan/camunda-postgrest-example
- Owner: NPDeehan
- Created: 2021-05-10T08:47:22.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-10T08:49:00.000Z (about 5 years ago)
- Last Synced: 2025-01-23T01:34:34.521Z (over 1 year ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Camunda Spring Boot Application
Spring Boot Application using [Camunda](http://docs.camunda.org).
This is a simple example which shows how you can connect Camunda to a postgres database.
## How does it work?
### Runing a Postgres Database
If you don't already have a postgres database up and running you do so by [installing docker](https://docs.docker.com/get-docker/) and using the `docker-compose.yml` file in the `resources` folder.
To start the database simple navegate to the directory
``../src/main/resources`` and run `docker-compose up`
That will download a postgres image from docker hub and start it up. Once it's finished you'll have a postgres database with the following settings:
```yaml
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
```
### Connecting Camunda to the Database
Connecting the database involves two changes, firstly you have to define the datasource in the `application.yaml` file.
```yaml
spring.datasource:
type: org.postgresql.ds.PGSimpleDataSource
username: postgres
password: postgres
url: jdbc:postgresql://localhost:5432/postgres
```
Then you should get the driver by adding this dependency to your `pom.xml`
```XML
org.postgresql
postgresql
```
### Running the application
You can also build and run the process application with Spring Boot.
#### Manually
1. Build the application using:
```bash
mvn clean package
```
2. Run the *.jar file from the `target` directory using:
```bash
java -jar target/Camunda-Postgrest-Example.jar
```
For a faster 1-click (re-)deployment see the alternatives below.
#### Maven Spring Boot Plugin
1. Build and deploy the process application using:
```bash
mvn clean package spring-boot:run
```
#### Your Java IDE
1. Run the project as a Java application in your IDE using CamundaApplication as the main class.
### Run and Inspect with Tasklist and Cockpit
Once you deployed the application you can run it using
[Camunda Tasklist](http://docs.camunda.org/latest/guides/user-guide/#tasklist)
and inspect it using
[Camunda Cockpit](http://docs.camunda.org/latest/guides/user-guide/#cockpit).
## Environment Restrictions
Built and tested against Camunda Platform version 7.15.0.
## License
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).