Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced the way Developers deploy new versions to OKD #32

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<!-- maven plugin versions -->
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>

<project.fabric8.name>analytics-integration</project.fabric8.name>
<fabric8.generator.name>${project.fabric8.name}</fabric8.generator.name>
<fabric8.generator.alias>${project.fabric8.name}</fabric8.generator.alias>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -230,6 +234,17 @@


<build>
<resources>
<resource>
<directory>src/main/fabric8</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
107 changes: 90 additions & 17 deletions src/main/fabric8/deployment.yml
Original file line number Diff line number Diff line change
@@ -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}
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
10 changes: 10 additions & 0 deletions src/main/fabric8/route.yml
Original file line number Diff line number Diff line change
@@ -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}
14 changes: 14 additions & 0 deletions src/main/fabric8/svc.yml
Original file line number Diff line number Diff line change
@@ -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