diff --git a/README.md b/README.md index 0ce82d35..3065513a 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,18 @@ Instructions from https://access.redhat.com/documentation/en-us/red_hat_fuse/7.3 1. once the import has finished, click the `Build & Install` button from the upper right `Build` menu 1. once the build has been successfully done, click on the `Deploy` button +# Development + +## How to deploy local code to local OKD instance +build an image with your local code: + +`mvn -gs ./configuration/settings.xml clean package fabric8:deploy -DskipTests` + +once the it finishes, the deployment of a new integration pod to run the new image will start automatically in your OKD instance + +**NOTE: Do not use this method for deploying your code to production.** + + # Manage ## PostgreSQL diff --git a/pom.xml b/pom.xml index df92664e..6bdeccf9 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,10 @@ 3.6.0 2.19.1 + + analytics-integration + ${project.fabric8.name} + ${project.fabric8.name} @@ -230,6 +234,17 @@ + + + src/main/fabric8 + true + + + src/main/resources + false + + + org.apache.maven.plugins diff --git a/src/main/fabric8/deployment.yml b/src/main/fabric8/deployment.yml index 0a381294..d6d837ec 100644 --- a/src/main/fabric8/deployment.yml +++ b/src/main/fabric8/deployment.yml @@ -1,23 +1,96 @@ +kind: DeploymentConfig +apiVersion: apps.openshift.io/v1 +metadata: + name: analytics-integration spec: + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - analytics-integration + from: + kind: ImageStreamTag + name: analytics-integration:latest + replicas: 1 + selector: + deploymentconfig: analytics-integration template: + metadata: + labels: + deploymentconfig: analytics-integration spec: containers: - - + - name: analytics-integration + image: library/analytics-integration:latest + ports: + - name: jolokia + containerPort: 8778 + protocol: TCP + - name: rest + containerPort: 8080 + protocol: TCP + env: + - name: KUBERNETES_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: KIESERVER_SERVICE + value: analytics-kieserver + - name: KIESERVER_USERNAME + value: executionUser + - name: KIESERVER_PASSWORD + value: rksxsp2! + - name: KIESERVER_PATH + value: services/rest/server/containers/instances/${kieserver.container} + - name: KIESERVER_CONTAINER + value: sample-analytics_1.0.0-SNAPSHOT + - name: POSTGRESQL_USER + valueFrom: + secretKeyRef: + name: "postgresql" + key: database-user + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: "postgresql" + key: database-password + - name: POSTGRESQL_DATABASE + valueFrom: + secretKeyRef: + name: "postgresql" + key: database-name + - name: AMQ_SERVER + value: broker-amq-tcp resources: - requests: - cpu: "0.2" - memory: 256Mi limits: - cpu: "1.0" - memory: 256Mi - env: - - name: SPRING_APPLICATION_JSON - value: '{"server":{"undertow":{"io-threads":1, "worker-threads":2 }}}' - - name: MYSQL_SERVICE_NAME - value: mysql - - name: MYSQL_SERVICE_DATABASE - value: sampledb - - name: MYSQL_SERVICE_USERNAME - value: ${mysql-service-username} - - name: MYSQL_SERVICE_PASSWORD - value: ${mysql-service-password} \ No newline at end of file + cpu: '1' + memory: 512Mi + requests: + cpu: 200m + memory: 512Mi + livenessProbe: + httpGet: + path: "/health" + port: 8081 + scheme: HTTP + initialDelaySeconds: 180 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + httpGet: + path: "/health" + port: 8081 + scheme: HTTP + initialDelaySeconds: 10 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + terminationMessagePath: "/dev/termination-log" + terminationMessagePolicy: File + imagePullPolicy: Always diff --git a/src/main/fabric8/route.yml b/src/main/fabric8/route.yml new file mode 100644 index 00000000..27090bb8 --- /dev/null +++ b/src/main/fabric8/route.yml @@ -0,0 +1,10 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: ${project.fabric8.name} +spec: + port: + targetPort: http + to: + kind: Service + name: ${project.fabric8.name} diff --git a/src/main/fabric8/svc.yml b/src/main/fabric8/svc.yml new file mode 100644 index 00000000..c853c26f --- /dev/null +++ b/src/main/fabric8/svc.yml @@ -0,0 +1,14 @@ +kind: Service +apiVersion: v1 +metadata: + name: ${project.fabric8.name} +spec: + ports: + - name: http + protocol: TCP + port: 8080 + targetPort: 8080 + selector: + deploymentconfig: ${project.fabric8.name} + type: ClusterIP + sessionAffinity: None