Skip to content

Commit 8c2f2d6

Browse files
authored
Merge pull request #203 from bcgov/qa
add docs up and verify master pipeline deploy
2 parents 3a6b3c4 + c6881cb commit 8c2f2d6

File tree

4 files changed

+326
-0
lines changed

4 files changed

+326
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33

44
The Truck Route Planner application for Translink built using the Simple Map Kit.
55

6+
## Updated OCP4 Deployment Steps
7+
Builds and Deployment Templates are provided in the Openshift Dir located in the root of this repo

openshift/caddy-run-bc.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
kind: BuildConfig
2+
apiVersion: build.openshift.io/v1
3+
metadata:
4+
name: caddy-run
5+
labels:
6+
app: caddy-run
7+
template: caddy-bc-smk
8+
spec:
9+
nodeSelector: null
10+
output:
11+
to:
12+
kind: ImageStreamTag
13+
name: 'caddy-run:latest'
14+
resources: {}
15+
successfulBuildsHistoryLimit: 5
16+
failedBuildsHistoryLimit: 5
17+
strategy:
18+
type: Docker
19+
dockerStrategy:
20+
from:
21+
kind: DockerImage
22+
name: 'alpine:3.8'
23+
postCommit: {}
24+
source:
25+
type: Dockerfile
26+
dockerfile: >-
27+
FROM alpine:3.8
28+
29+
#USER root
30+
31+
ENV ENABLE_TELEMETRY="false"
32+
33+
WORKDIR /app
34+
35+
RUN apk add --no-cache git openssh-client \
36+
&& adduser -S smk \
37+
&& chown -R smk:0 /app && chmod -R 770 /app
38+
USER smk
39+
40+
EXPOSE 8080
41+
42+
43+
ENTRYPOINT ["/bin/parent", "caddy"]
44+
45+
#CMD ["--conf", "/etc/Caddyfile", "--log", "stdout",
46+
"--agree=$ACME_AGREE"]
47+
48+
CMD ["--conf", "/conf/Caddyfile", "-quic"]
49+
50+
#CMD ["/go/caddy", "-quic", "--conf", "/conf/Caddyfile"]
51+
runPolicy: Serial
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
kind: BuildConfig
2+
apiVersion: build.openshift.io/v1
3+
metadata:
4+
name: truck-route-planner-dev-bc
5+
labels:
6+
app: truck-route-planner-dev
7+
nodeSelector: null
8+
output:
9+
to:
10+
kind: ImageStreamTag
11+
name: 'truck-route-planner-dev:latest'
12+
resources: {}
13+
successfulBuildsHistoryLimit: 5
14+
failedBuildsHistoryLimit: 5
15+
strategy:
16+
type: Docker
17+
dockerStrategy:
18+
pullSecret:
19+
name: artifactory-creds
20+
postCommit: {}
21+
source:
22+
type: Dockerfile
23+
dockerfile: >-
24+
FROM docker-remote.artifacts.developer.gov.bc.ca/alpine:edge
25+
26+
27+
RUN apk update \
28+
&& apk --no-cache add git openssh-client \
29+
&& apk --no-cache add --virtual devs tar curl
30+
31+
WORKDIR /app
32+
33+
34+
RUN git clone -b develop https://github.com/bcgov/smk-tlink.git
35+
/app/smk-tlink
36+
37+
38+
RUN adduser -S app
39+
40+
41+
RUN chown -R app:0 /app && chmod -R 770 /app
42+
43+
44+
RUN apk del --purge devs
45+
46+
47+
USER app
48+
triggers:
49+
- type: Generic
50+
generic:
51+
secretReference:
52+
name: github-smk-tlink-dev-webhook-key
53+
runPolicy: Serial
54+
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
apiVersion: template.openshift.io/v1
2+
kind: Template
3+
labels:
4+
template: truck-route-planner-template
5+
metadata:
6+
name: truck-route-planner-template
7+
8+
parameters:
9+
- name: "DEPLOY_NAMESPACE"
10+
description: "ocp namespace to be deployed"
11+
value: namespace
12+
- name: "APP_NAME"
13+
description: "name of app"
14+
value: truck-route-planner
15+
- name: "ENV"
16+
description: "environment"
17+
value: dev
18+
- name: "GIT_URL"
19+
description: "github repo rul"
20+
value: https://github.com/bcgov/smk-tlink.git
21+
- name: "GIT_BRANCH"
22+
description: "github repo branch"
23+
value: dev
24+
- name: "TOOLS_NAMESPACE"
25+
description: "tools namespace where build will be"
26+
value: tools_namespace
27+
- name: "API_KEY"
28+
description: "Route Planner Service API Key"
29+
value: secret
30+
31+
objects:
32+
33+
- apiVersion: route.openshift.io/v1
34+
kind: Route
35+
metadata:
36+
labels:
37+
app: ${APP_NAME}-${ENV}
38+
name: ${APP_NAME}-${ENV}-route
39+
spec:
40+
host: ${APP_NAME}-${ENV}.apps.silver.devops.gov.bc.ca
41+
port:
42+
targetPort: http-proxy
43+
tls:
44+
termination: edge
45+
to:
46+
kind: Service
47+
name: ${APP_NAME}-${ENV}-service
48+
weight: 100
49+
wildcardPolicy: None
50+
51+
- apiVersion: v1
52+
kind: Service
53+
metadata:
54+
labels:
55+
app: ${APP_NAME}-${ENV}
56+
name: ${APP_NAME}-${ENV}-service
57+
spec:
58+
ports:
59+
- name: http-proxy
60+
port: 8080
61+
protocol: TCP
62+
targetPort: 8080
63+
selector:
64+
app: ${APP_NAME}-${ENV}
65+
sessionAffinity: None
66+
type: ClusterIP
67+
68+
- apiVersion: v1
69+
data:
70+
caddifile: |-
71+
0.0.0.0:8080 {
72+
root /app/smk
73+
gzip
74+
log stdout
75+
errors stdout
76+
}
77+
kind: ConfigMap
78+
metadata:
79+
labels:
80+
app: ${APP_NAME}-${ENV}
81+
name: ${APP_NAME}-${ENV}-caddyfile
82+
83+
- apiVersion: v1
84+
data:
85+
api-key: |-
86+
{
87+
"tools": [
88+
{
89+
"type": "directions",
90+
"routePlannerService": {
91+
"apiKey": "${API_KEY}"
92+
}
93+
}
94+
]
95+
}
96+
kind: ConfigMap
97+
metadata:
98+
name: ${APP_NAME}-${ENV}-api-key
99+
100+
- apiVersion: apps/v1
101+
kind: Deployment
102+
metadata:
103+
generation: 10
104+
labels:
105+
app: ${APP_NAME}-${ENV}
106+
name: ${APP_NAME}-${ENV}-dc
107+
spec:
108+
progressDeadlineSeconds: 600
109+
replicas: 2
110+
revisionHistoryLimit: 10
111+
selector:
112+
matchLabels:
113+
app: ${APP_NAME}-${ENV}
114+
strategy:
115+
rollingUpdate:
116+
maxSurge: 1
117+
maxUnavailable: 1
118+
type: RollingUpdate
119+
template:
120+
metadata:
121+
creationTimestamp: null
122+
labels:
123+
app: ${APP_NAME}-${ENV}
124+
spec:
125+
containers:
126+
- command:
127+
- /go/caddy
128+
- '-quic'
129+
- '-conf'
130+
- /conf/Caddyfile
131+
env:
132+
- name: hookPath
133+
value: /webhook
134+
- name: hookKey
135+
valueFrom:
136+
secretKeyRef:
137+
key: caddy.webhook
138+
name: ${APP_NAME}-${ENV}-webhook-key
139+
image: 'image-registry.openshift-image-registry.svc:5000/${TOOLS_NAMESPACE}/caddy-run:latest'
140+
imagePullPolicy: Always
141+
name: www
142+
resources: {}
143+
terminationMessagePath: /dev/termination-log
144+
terminationMessagePolicy: File
145+
volumeMounts:
146+
- mountPath: /go
147+
name: bin-volume
148+
- mountPath: /conf
149+
name: caddy-conf
150+
- mountPath: /app/smk/trp
151+
name: site-data
152+
- mountPath: /app/smk/trp/config/key/
153+
name: volume-xy8eh
154+
dnsPolicy: ClusterFirst
155+
initContainers:
156+
- command:
157+
- cp
158+
- /usr/bin/caddy
159+
- /dist
160+
image: 'image-registry.openshift-image-registry.svc:5000/b16795-tools/caddy-build:latest'
161+
imagePullPolicy: Always
162+
name: installcaddy
163+
resources: {}
164+
terminationMessagePath: /dev/termination-log
165+
terminationMessagePolicy: File
166+
volumeMounts:
167+
- mountPath: /dist
168+
name: bin-volume
169+
- resources: {}
170+
terminationMessagePath: /dev/termination-log
171+
name: git-cloner
172+
command:
173+
- cp
174+
- '-r'
175+
- /app/smk-tlink/.
176+
- /app/smk/trp/
177+
imagePullPolicy: Always
178+
volumeMounts:
179+
- name: site-data
180+
mountPath: /app/smk/trp
181+
image: >-
182+
image-registry.openshift-image-registry.svc:5000/${TOOLS_NAMESPACE}/${APP_NAME}-${ENV}:latest
183+
restartPolicy: Always
184+
schedulerName: default-scheduler
185+
securityContext: {}
186+
terminationGracePeriodSeconds: 30
187+
volumes:
188+
- emptyDir: {}
189+
name: bin-volume
190+
- configMap:
191+
defaultMode: 420
192+
items:
193+
- key: caddifile
194+
path: Caddyfile
195+
name: ${APP_NAME}-${ENV}-caddyfile
196+
name: caddy-conf
197+
- name: site-data
198+
persistentVolumeClaim:
199+
claimName: ${APP_NAME}-${ENV}-pvc
200+
- configMap:
201+
defaultMode: 420
202+
items:
203+
- key: api-key
204+
path: route-planner.json
205+
name: ${APP_NAME}-${ENV}-api-key
206+
name: volume-xy8eh
207+
208+
- apiVersion: v1
209+
kind: PersistentVolumeClaim
210+
metadata:
211+
name: ${APP_NAME}-${ENV}-pvc
212+
spec:
213+
accessModes:
214+
- ReadWriteMany
215+
resources:
216+
requests:
217+
storage: 1Gi
218+
storageClassName: netapp-file-standard
219+

0 commit comments

Comments
 (0)