Skip to content

Commit 85f684a

Browse files
authored
Add workflow for deploying "ui.agiletoolkit.org" automatically. (#873)
* Added working Dockerfile * add codefresh build * fix * wip * added helm * wip * add lock file for easier install * wip * wip * wip * wip * wip * wip
1 parent 9fc7914 commit 85f684a

14 files changed

+4819
-1
lines changed

.codefresh/ui-build-deploy.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "1.0"
2+
stages:
3+
- clone
4+
- build
5+
- push
6+
- deploy
7+
steps:
8+
main_clone:
9+
type: git-clone
10+
stage: clone
11+
repo: atk4/ui
12+
revision: "${{CF_BRANCH}}"
13+
build:
14+
type: build
15+
stage: build
16+
image_name: atk4/ui
17+
push:
18+
type: push
19+
stage: push
20+
image_name: atk4/ui
21+
registry: cfcr
22+
candidate: "${{build}}"
23+
tags:
24+
- "${{CF_BRANCH_TAG_NORMALIZED}}"
25+
- "${{CF_REVISION}}"
26+
deploy:
27+
type: deploy
28+
stage: deploy
29+
arguments:
30+
kind: kubernetes
31+
cluster: atk
32+
namespace: apps
33+
service: ui-agiletoolkit-org-atk-demo

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

.github/workflows/ui-demo.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Deploy ui.agiletoolkit.org'
2+
inputs:
3+
who-to-greet: # id of input
4+
description: 'Who to greet'
5+
required: true
6+
default: 'World'
7+
outputs:
8+
time: # id of output
9+
description: 'The time we greeted you'
10+
runs:
11+
using: 'docker'
12+
image: 'Dockerfile'
13+
args:
14+
- ${{ inputs.who-to-greet }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/public/jquery
88
/vendor
99
docs/build
10-
/composer.lock
1110
/demos/db.php
1211
/build
1312
.DS_Store

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM php:apache
2+
3+
RUN apt-get update && apt-get install -y \
4+
libicu-dev \
5+
&& docker-php-ext-configure intl \
6+
&& docker-php-ext-install intl
7+
8+
RUN apt-get install -y git
9+
10+
WORKDIR /var/www/html/
11+
COPY . .
12+
#RUN rm demos/coverage.php
13+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
14+
15+
RUN composer install --no-dev
16+
17+

atk4-ui-helm/.helmignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

atk4-ui-helm/Chart.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for Kubernetes
4+
name: atk4-ui-helm
5+
version: 0.1.0

atk4-ui-helm/templates/NOTES.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range .Values.ingress.hosts }}
4+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5+
{{- end }}
6+
{{- else if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "atk4-ui-helm.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status of by running 'kubectl get svc -w {{ template "atk4-ui-helm.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "atk4-ui-helm.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "atk4-ui-helm.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
echo "Visit http://127.0.0.1:8080 to use your application"
18+
kubectl port-forward $POD_NAME 8080:80
19+
{{- end }}

atk4-ui-helm/templates/_helpers.tpl

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "atk4-ui-helm.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "atk4-ui-helm.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "atk4-ui-helm.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "atk4-ui-helm.fullname" . }}
5+
labels:
6+
app: {{ template "atk4-ui-helm.name" . }}
7+
chart: {{ template "atk4-ui-helm.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
selector:
13+
matchLabels:
14+
app: {{ template "atk4-ui-helm.name" . }}
15+
release: {{ .Release.Name }}
16+
template:
17+
metadata:
18+
labels:
19+
app: {{ template "atk4-ui-helm.name" . }}
20+
release: {{ .Release.Name }}
21+
spec:
22+
containers:
23+
- name: {{ .Chart.Name }}
24+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
25+
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
ports:
27+
- name: http
28+
containerPort: 80
29+
protocol: TCP
30+
livenessProbe:
31+
httpGet:
32+
path: /
33+
port: http
34+
readinessProbe:
35+
httpGet:
36+
path: /
37+
port: http
38+
resources:
39+
{{ toYaml .Values.resources | indent 12 }}
40+
{{- with .Values.nodeSelector }}
41+
nodeSelector:
42+
{{ toYaml . | indent 8 }}
43+
{{- end }}
44+
{{- with .Values.affinity }}
45+
affinity:
46+
{{ toYaml . | indent 8 }}
47+
{{- end }}
48+
{{- with .Values.tolerations }}
49+
tolerations:
50+
{{ toYaml . | indent 8 }}
51+
{{- end }}

atk4-ui-helm/templates/ingress.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "atk4-ui-helm.fullname" . -}}
3+
{{- $servicePort := .Values.service.port -}}
4+
{{- $ingressPath := .Values.ingress.path -}}
5+
apiVersion: extensions/v1beta1
6+
kind: Ingress
7+
metadata:
8+
name: {{ $fullName }}
9+
labels:
10+
app: {{ template "atk4-ui-helm.name" . }}
11+
chart: {{ template "atk4-ui-helm.chart" . }}
12+
release: {{ .Release.Name }}
13+
heritage: {{ .Release.Service }}
14+
{{- with .Values.ingress.annotations }}
15+
annotations:
16+
{{ toYaml . | indent 4 }}
17+
{{- end }}
18+
spec:
19+
{{- if .Values.ingress.tls }}
20+
tls:
21+
{{- range .Values.ingress.tls }}
22+
- hosts:
23+
{{- range .hosts }}
24+
- {{ . }}
25+
{{- end }}
26+
secretName: {{ .secretName }}
27+
{{- end }}
28+
{{- end }}
29+
rules:
30+
{{- range .Values.ingress.hosts }}
31+
- host: {{ . }}
32+
http:
33+
paths:
34+
- path: {{ $ingressPath }}
35+
backend:
36+
serviceName: {{ $fullName }}
37+
servicePort: http
38+
{{- end }}
39+
{{- end }}

atk4-ui-helm/templates/service.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "atk4-ui-helm.fullname" . }}
5+
labels:
6+
app: {{ template "atk4-ui-helm.name" . }}
7+
chart: {{ template "atk4-ui-helm.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
type: {{ .Values.service.type }}
12+
ports:
13+
- port: {{ .Values.service.port }}
14+
targetPort: http
15+
protocol: TCP
16+
name: http
17+
selector:
18+
app: {{ template "atk4-ui-helm.name" . }}
19+
release: {{ .Release.Name }}

atk4-ui-helm/values.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Default values for atk4-ui-helm.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: nginx
9+
tag: stable
10+
pullPolicy: IfNotPresent
11+
12+
service:
13+
type: ClusterIP
14+
port: 80
15+
16+
ingress:
17+
enabled: true
18+
annotations: {}
19+
# kubernetes.io/ingress.class: nginx
20+
# kubernetes.io/tls-acme: "true"
21+
path: /
22+
hosts:
23+
- ui.agiletoolkit.org
24+
- ui2.agiletoolkit.org
25+
tls: []
26+
# - secretName: chart-example-tls
27+
# hosts:
28+
# - chart-example.local
29+
30+
resources: {}
31+
# We usually recommend not to specify default resources and to leave this as a conscious
32+
# choice for the user. This also increases chances charts run on environments with little
33+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
34+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
35+
# limits:
36+
# cpu: 100m
37+
# memory: 128Mi
38+
# requests:
39+
# cpu: 100m
40+
# memory: 128Mi
41+
42+
nodeSelector: {}
43+
44+
tolerations: []
45+
46+
affinity: {}

0 commit comments

Comments
 (0)