Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet committed Oct 2, 2024
1 parent 437697f commit 805c8e6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 70 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ The project is configured to publish the JAR file automatically to Maven Central

If you want to build a local maven image, use

````yaml
````shell
mvn spring-boot:build-image
````
## Maven Central repository
Expand Down
7 changes: 7 additions & 0 deletions kubenetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ A Postgres database is used. it can be replaced by a different database, or an H
## Connection to Zeebe
The deployment must be run in the same cluster as Zeebe. If it is a different cluster, then the zeebe connection must be adapted

# Operation

```shell
kubectl create -f cherry-runtime.yaml
```

kubectl port-forward svc/camunda-zeebe-gateway 26500:26500 -n camunda
114 changes: 48 additions & 66 deletions kubenetes/cherry-runtime.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cherry-runtime-deployment
spec:
replicas: 1
replicas: 3
selector:
matchLabels:
app: cherry-runtime
template:
metadata:
labels:
importer: cherry-runtime
app: camunda-platform
app.kubernetes.io/component: cherry-runtime
app: cherry-runtime
spec:
containers:
- env:
- name: cherry-runtime-container
image: ghcr.io/camunda-community-hub/zeebe-cherry-runtime:latest
ports:
- containerPort: 8080
env:
- name: CHERRY_CONNECTORSLIB_UPLOADPATH
value: /usr/local/cherry/upload
- name: CHERRY_CONNECTORSLIB_CLASSLOADERPATH
Expand All @@ -19,101 +26,76 @@ spec:
value: http://camunda-zeebe-gateway:26500
- name: SPRING_DATASOURCE_URL
value: "jdbc:postgresql://cherry-postgres/cherrydb"
- name: SPRING_DATASOURCE_USERVNAME
value: "camunda"
- name: SPRING_DATASOURCE_USERNAME
value: "cherryUser"
- name: SPRING_DATASOURCE_PASSWORD
value: "camunda"
value: "cherryPassword"
- name: SPRING_DATASOURCE_DRIVER-CLASS-NAME
value: "org.postgresql.Driver"
- name: "JPA_DATABASE-PLATFORM"
value: "org.hibernate.dialect.PostgreSQLDialect"

image: ghcr.io/camunda-community-hub/zeebe-cherry-runtime:latest
imagePullPolicy: IfNotPresent
name: cherry-runtime
ports:
- containerPort: 8080
name: http
protocol: TCP
resources:
limits:
cpu: "1"
memory: 100mb
requests:
cpu: "1"
memory: 100mb
volumeMounts:
- mountPath: /usr/local/cherry/upload
name: upload
- mountPath: /usr/local/cherry/classloader
name: classloader
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
fsGroup: 1001
runAsNonRoot: true
terminationGracePeriodSeconds: 30
volumes:
- emptyDir: {}
name: upload
- emptyDir: {}
name: classloader
---
apiVersion: v1
kind: Service
metadata:
name: cherry-runtime-service
spec:
selector:
matchLabels:
importer: cherry-runtime
app: cherry-runtime
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: ClusterIP

---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: postgres
name: cherry-postgres
spec:
serviceName: "cherry-postgres"
replicas: 1
selector:
matchLabels:
app: postgres
app: cherry-postgres
template:
metadata:
labels:
app: postgres
app: cherry-postgres
spec:
containers:
- name: postgres
image: postgres:15
image: postgres:latest
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: cherry
value: mydatabase
- name: POSTGRES_USER
value: camunda
value: "cherryUser"
- name: POSTGRES_PASSWORD
value: camunda
value: "cherryPassword"
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
volumeClaimTemplates:
- metadata:
name: postgres-storage
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "standard" # Replace with your storage class name if different
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
name: postgres
name: cherry-postgres-svc
spec:
selector:
app: postgres
app: cherry-postgres
ports:
- protocol: TCP
port: 5432
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ public class RunnerParameter {
public List<WorkerParameterChoice> choiceList;
public boolean visibleInTemplate = false;
public Group group;
/* -------------------------------------------------------- */
/* */
/* Attributes */
/* to facilitate the parameter management, connector can */
/* manage private attributes
/* */
/* -------------------------------------------------------- */
private Map<String, Object> attributes = new HashMap<>();

public RunnerParameter() {

Expand Down Expand Up @@ -217,6 +225,23 @@ public String getName() {
public Level getLevel() {
return level;
}

public void setAttribute(String name, Object value) {

attributes.put(name, value);
}

public Object getAttribute(String name) {
return attributes.get(name);
}

public int getAttributeInteger(String name, int defaultValue) {
if (attributes.get(name) instanceof Integer attributInteger)
return attributInteger.intValue();
return defaultValue;
}


/* -------------------------------------------------------- */
/* */
/* Conditions */
Expand Down Expand Up @@ -246,7 +271,7 @@ public RunnerParameter setVisibleInTemplate() {
/**
* Set the default value in the parameter
*
* @param defaultValue
* @param defaultValue use to set the default value
* @return a runnerParameter where the attribute is set to true
*/
public RunnerParameter setDefaultValue(Object defaultValue) {
Expand All @@ -268,7 +293,7 @@ public RunnerParameter setGsonTemplate(String gsonTemplate) {
*/
public RunnerParameter addCondition(String property, List<String> oneOf) {
this.condition = property;
this.conditionOneOf = oneOf;
this.conditionOneOf = oneOf==null? null: oneOf.stream().distinct().toList();
return this;
}

Expand Down Expand Up @@ -353,7 +378,7 @@ public Map<String, Object> toMap(String parameterNameForCondition) {

oneParameter.put(CherryInput.PARAMETER_MAP_VISIBLE_IN_TEMPLATE, visibleInTemplate);

logger.info("PdfParameters getMap:{}", oneParameter);
logger.info("getMap:{}", oneParameter);

return oneParameter;
}
Expand Down

0 comments on commit 805c8e6

Please sign in to comment.