Skip to content

Commit

Permalink
chore(scripts): add run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhnm committed Aug 30, 2023
1 parent 95fbdc8 commit 3f46802
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 70 deletions.
12 changes: 12 additions & 0 deletions .run/No Profiles.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="No Profiles" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
<option name="sourceFilePath" value="timesync-stack/docker-compose.yml" />
<option name="upRemoveOrphans" value="true" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
23 changes: 23 additions & 0 deletions .run/TimeSyncCamunda7Application.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TimeSyncCamunda7Application" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<module name="timesync-camunda7" />
<selectedOptions>
<option name="environmentVariables" />
</selectedOptions>
<option name="SPRING_BOOT_MAIN_CLASS" value="io.miragon.timesync.TimeSyncCamunda7Application" />
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH="timesync-stack/.env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
17 changes: 17 additions & 0 deletions .run/With Profile.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="With Profile" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
<option name="profiles">
<list>
<option value="worker" />
</list>
</option>
<option name="sourceFilePath" value="timesync-stack/docker-compose.yml" />
<option name="upRemoveOrphans" value="true" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
141 changes: 71 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,49 @@ The process involves synchronizing time-related data within the HRworks system.
- **Notify about error** user task informs the user about an error in the process.
4. Depending on the outcome, the subprocess concludes with either a successful `Times synced` end event or an `Error detected` end event.

## Run the Stack

To run the Camunda Platform with the history plugin and a PostgreSQL database, follow these steps:

### Step 1: Build the Docker Image

First navigate to the hrworks-showcase-c7 directory:

```bash
cd stack/hrworks-showcase-c7
```

Then build the Docker image using the following command:

```bash
docker compose build
```

### Step 2: Start the Stack

Once the Docker image is built, use `docker-compose` to start the Camunda Platform along with the PostgreSQL database:

```bash
docker compose up
```
The Camunda Platform and the PostgreSQL database will now be up and running in a containerized environment.
## Quick Start

1. Clone the Repository

```shell
git clone https://github.com/Miragon/hrworks-showcase.git
cd hrworks-showcase
```

2. Build the Project

```shell
mvn clean package
```

3. Add Environment Variables

```shell
cd timesync-stack
touch .env
```

Add the following environment variables to the `.env` file:

```text
# Clockify
CLOCKIFY_API_KEY=<API-KEY>
# HRWorks
HRWORKS_AC_KEY=<ACCESS-KEY>
HRWORKS_SAC_KEY=<SECRET-ACCESS-KEY>
```

> Note: See [Find/Generate Credentials](#findgenerate-credentials) for more information about the credentials.
4. Start the Stack

```bash
cd timesync-stack
docker compose --profile worker up
```

5. Deploy the Artifacts (see [Deploy Artifacts](#deploy-artifacts))

### Accessing Camunda Web Applications

Expand All @@ -73,64 +90,48 @@ After starting the stack, you can access the Camunda Web Applications using the
* [Camunda Cockpit](http://localhost:8080/camunda/app/cockpit/default/#/dashboard)
* [Camunda Admin](http://localhost:8080/camunda/app/admin/default/#/)

## Project Setup

To run this project, you need to have a running instance of Camunda Platform 7.
Set the base URL to it in the `application.yml` of the `timesync-camunda7` module:

```yaml
# Camunda Platform 7
camunda:
bpm:
client:
base-url: http://localhost:8080/engine-rest
```
Additionally, you must set the Clockify API key in the `application.yml`:
## Deploy artifacts

```yaml
# Clockify
clockify:
apiKey: "<API-KEY>"
```
You can use the [Camunda Modeler](https://camunda.com/de/download/modeler/) to deploy the process.
1. Open the [bpmn file](./timesync/timesync-camunda7/src/main/resources/bpmn/hrworks-timesync.bpmn)
2. Add the [form](./timesync/timesync-camunda7/src/main/resources/.camunda/forms/error.form) to your deployment

<img src="images/deployment.png" alt="deployment" width=180>

3. Click on `Deploy`

The Clockify API key can be found on the [Clockify website under "User Settings"](https://app.clockify.me/user/settings).
For convenience, we have set up two test accounts, and the credentials can be found in 1Password.
## Find/Generate Credentials

Moreover, you need to set the HRWorks `accessKey` and `secretAccessKey` inside the `application.yml`:
The **Clockify API** key can be found on the [Clockify website under "User Settings"](https://app.clockify.me/user/settings).

```yaml
# HRWorks
hrworks:
accessKey: "<ACCESS-KEY>"
secretAccessKey: "<SECRET-ACCESS-KEY>"
```
The HRWorks keys can be generated on the HRWorks admin page at https://ssl1.hrworks.de/demo-a03/HrwScStartView under
The **HRWorks Keys** can be generated on the HRWorks admin page at https://ssl1.hrworks.de/demo-a03/HrwScStartView under
"Grundlagen" > "Integration" > "HRWorks-API".

Please ensure that you have obtained the necessary credentials and correctly configured the `application.yml` before
running the project.
## Development

## Running the Project
This project comes with a [run script](.run/TimeSyncCamunda7Application.run.xml) for *IntelliJ IDEA*.
This script expects a `.env` file under [timesync-stack](./timesync-stack) with the following environment variables:

After following the [Project Setup](#project-setup) you should be able to simply start the `TimeSyncCamunda7Application`.

## Deploy artifacts
```text
# Clockify
CLOCKIFY_API_KEY=<API-KEY>
You can use the [Camunda Modeler](https://camunda.com/de/download/modeler/) to deploy the process.
1. Open the [bpmn file](./timesync/timesync-camunda7/src/main/resources/bpmn/hrworks-timesync.bpmn)
2. Add the [form](./timesync/timesync-camunda7/src/main/resources/.camunda/forms/error.form) to your deployment
<img src="images/deployment.png" alt="deployment" width=180>
3. Click on `Deploy`
# HRWorks
HRWORKS_AC_KEY=<ACCESS-KEY>
HRWORKS_SAC_KEY=<SECRET-ACCESS-KEY>
```

## Run Tests
> Note: See [Find/Generate Credentials](#findgenerate-credentials) for more information about the credentials.
To run the tests for this showcase, execute the following command:
If you have obtained the necessary credentials, you can start the stack.

```bash
mvn clean test
```shell
cd timesync-stack
docker compose up
```

If the stack is running, you can start the application using the run script.

## License

This showcase is licensed under the [MIT License](LICENSE).

0 comments on commit 3f46802

Please sign in to comment.