Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
364 lines (364 sloc) 9.32 KB
apiVersion: v1
kind: Template
metadata:
name: galleon-s2i
annotations:
iconClass: icon-wildfly
openshift.io/display-name: App built with Galleon S2I image and optionally connect to DB
openshift.io/provider-display-name: Red Hat, Inc.
template.openshift.io/long-description: Provision WildFly server image using galleon and build/deploy app.
description: Provision WildFly server image using galleon and build/deploy app.
message: Builds created.
labels:
template: galleon-s2i
parameters:
- name: APP_NAME
description: The application name. Name is assigned to all of the application objects defined in this template.
displayName: Image Name
required: true
value: my-galleon-s2i-app
- name: GIT_REPO
description: The application git repository
displayName: git repository
required: true
value: https://github.com/jorgemoralespou/s2i-wildfly-galleon
- name: GIT_CONTEXT_DIR
description: The application git repository sub directory
displayName: git repository sub directory
required: false
value: test/test-app
- name: GIT_BRANCH
description: The application git branch
displayName: git branch
required: true
value: master
- name: IMAGE_VERSION
description: Image version to use (latest, full, 16.0.0.Final)
displayName: Image version
required: true
value: 16.0.0.Final
- name: DB_URL_CONNECTION
description: The database jdbc URL.
displayName: jdbc URL
required: false
value: jdbc:postgresql://postgresql:5432/demo
- name: DB_USER
description: The database user name
displayName: Database user name
required: false
value: demo
- name: DB_PASSWORD
description: The database user password
displayName: Database user password
required: false
value: demo
objects:
- apiVersion: v1
kind: Secret
metadata:
name: '${APP_NAME}-db-secret'
stringData:
database-url: '${DB_URL_CONNECTION}'
database-password: '${DB_PASSWORD}'
database-user: '${DB_USER}'
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-development
spec:
output:
to:
kind: ImageStreamTag
name: ${APP_NAME}:development
runPolicy: Serial
source:
git:
ref: ${GIT_BRANCH}
uri: ${GIT_REPO}
contextDir: ${GIT_CONTEXT_DIR}
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: s2i-wildfly-galleon:${IMAGE_VERSION}
type: Source
triggers:
- imageChange:
type: ImageChange
- type: ConfigChange
- generic:
secret: secret101
type: Generic
- github:
secret: secret101
type: GitHub
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-production
spec:
output:
to:
kind: ImageStreamTag
name: ${APP_NAME}:production
source:
dockerfile: |-
FROM openjdk:8-jre
COPY /wildfly /wildfly
COPY /deployments /wildfly/standalone/deployments
RUN chown -R 1001:0 /wildfly && chmod -R ug+rwX /wildfly
USER 1001
EXPOSE 8080 9090 8443
CMD ["/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
images:
- from:
kind: ImageStreamTag
name: ${APP_NAME}:development
paths:
- sourcePath: /output/wildfly
destinationDir: "."
- sourcePath: /output/deployments
destinationDir: "."
strategy:
dockerStrategy:
type: Docker
triggers:
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: ${APP_NAME}:development
- type: ConfigChange
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-development
spec:
replicas: 1
selector:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-development
strategy:
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-development
spec:
containers:
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: database-user
name: '${APP_NAME}-db-secret'
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: '${APP_NAME}-db-secret'
- name: DB_URL_CONNECTION
valueFrom:
secretKeyRef:
key: database-url
name: '${APP_NAME}-db-secret'
image: ${APP_NAME}:development
imagePullPolicy: Always
name: ${APP_NAME}
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
livenessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- ${APP_NAME}
from:
kind: ImageStreamTag
name: ${APP_NAME}:development
type: ImageChange
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-production
spec:
replicas: 0
selector:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-production
strategy:
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
labels:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-production
spec:
containers:
- env:
- name: DB_USER
valueFrom:
secretKeyRef:
key: database-user
name: '${APP_NAME}-db-secret'
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: '${APP_NAME}-db-secret'
- name: DB_URL_CONNECTION
valueFrom:
secretKeyRef:
key: database-url
name: '${APP_NAME}-db-secret'
image: ${APP_NAME}:production
imagePullPolicy: Always
name: ${APP_NAME}
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
livenessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- ${APP_NAME}
from:
kind: ImageStreamTag
name: ${APP_NAME}:development
type: ImageChange
- apiVersion: v1
kind: Service
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-development
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-development
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Service
metadata:
labels:
app: ${APP_NAME}
name: ${APP_NAME}-production
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: ${APP_NAME}
deploymentconfig: ${APP_NAME}-production
sessionAffinity: None
type: ClusterIP
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: ${APP_NAME}
labels:
app: ${APP_NAME}
spec:
to:
kind: Service
name: ${APP_NAME}-development
weight: 100
alternateBackends:
- kind: Service
name: ${APP_NAME}-production
weight: 0
port:
targetPort: 8080-tcp
wildcardPolicy: None
You can’t perform that action at this time.