Skip to content

Commit

Permalink
Merge pull request #291 from OntimizeWeb/release/15.3.0
Browse files Browse the repository at this point in the history
Release 15.3.0
  • Loading branch information
daniel-grana committed Mar 27, 2024
2 parents 73d5b47 + 7bb5fc8 commit 474e48d
Show file tree
Hide file tree
Showing 18 changed files with 505 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Compiled output
/dist
**/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
**/node_modules/
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
.git
npm-debug.log
.coverage
.coverage.*
.env

# System files
.DS_Store
Thumbs.db
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# all users in this group will be requested
# for review when someone opens a pull request.

# Default reviewers
* @OntimizeWeb/Developer

# CI/CD workflows reviewers
.github/workflows/* @OntimizeWeb/Admin
7 changes: 4 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
CI_EMAIL: ontimize-web@imatia.com
CI_USERNAME: ontimize-web
DEVELOP_BRANCH: 15.x.x
REPO_NAME: ${{ github.event.repository.name }}

jobs:
build:
Expand Down Expand Up @@ -116,10 +117,10 @@ jobs:
run: |
npm version $(npm version minor --no-git-tag-version)-SNAPSHOT-0 --no-git-tag-version
- name: bumping version in internal package.json
working-directory: .
- name: Update Chart values.yml
run: |
npm version $(npm version minor --no-git-tag-version)-SNAPSHOT-0 --no-git-tag-version
version=$(cat ./charts/$REPO_NAME/values.yaml | grep version: | awk '{print $2}')
sed -i "s#$version#${{ env.DEVELOP_BRANCH }}#" ./charts/$REPO_NAME/values.yaml
- name: Create sync branch
run: |
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Create and publish Docker image

on:
push:
branches: ['15.x.x']
tags:
- 15.*

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
MAIN_BRANCH: main.15.x

jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ontimize-web
password: ${{ secrets.OWEB_GH_TOKEN_PUSH }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# branch event
type=ref,event=branch
# push tag event
type=semver,pattern={{version}}
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.MAIN_BRANCH ) }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
CI_USERNAME: ontimize-web
MAIN_BRANCH: main.15.x
DEVELOP_BRANCH: 15.x.x
REPO_NAME: ${{ github.event.repository.name }}

jobs:
build:
Expand Down Expand Up @@ -78,6 +79,11 @@ jobs:
npm version patch --no-git-tag-version
echo "RELEASE_VERSION=$(node -pe "require('./package.json')['version']")" >> $GITHUB_ENV
- name: Update Chart values.yml
run: |
version=$(cat ./charts/$REPO_NAME/values.yaml | grep version: | awk '{print $2}')
sed -i "s#$version#${{ env.RELEASE_VERSION }}#" ./charts/$REPO_NAME/values.yaml
- name: Create release branch
if: ${{ steps.parameters.outputs.isHotfix == false }}
run: |
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Stage 1: Compile and Build angular codebase
# Use official node image as the base image
FROM node:18.10.0-alpine as build

# Set the working directory
WORKDIR /usr/local/app

COPY package*.json .

# Install all the dependencies
RUN npm install

COPY . .

# Generate the build of the application
RUN npm run production


# Stage 2: Serve app with nginx server

# Use official nginx image as the base image
FROM nginx:latest

# Copy the build output to replace the default nginx contents.
COPY --from=build /usr/local/app/dist /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80
EXPOSE 80
21 changes: 21 additions & 0 deletions charts/ontimize-web-ngx-playground/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: ontimize-web-ngx-playground
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.0.1
19 changes: 19 additions & 0 deletions charts/ontimize-web-ngx-playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## DESCRIPCIÓN

Generic Helm template to create a Deployment of an Ontimize Application (service).

To deploy in a K8s Cluster ArgoCD is used. (development environment https://argocd.dev.imatia.cloud). Access is granted using Azure AD credentials (Imatia domain).

Values can be customized in values.yaml, but after the application sources are generated a standard configuration ready to run is provided.

See values.yaml to get detailed information of parameters.

Ingress and TLS are enabled by default. Value in host is provided as HOST environment variable to the pod.

Also prometheus annotations, probe paths, kafka, keycloak and other parameters are configured by default, and setup with required configuration for K8s Imatia development cluster. Configuration is provided as environment variables to the pod (and so available to the Ontimize application as defined in application-xx.yaml files).

Resources (CPU, Memory can be customized as needed).

Also using configmap section in values.yaml it is easy to provide environment values to the pod, adapting deployment.yaml.

If in the configmap.data section a key "environment-profile" exists, its value will be injected as ENVIRONMENT_PROFILE variable. This can be used to differentiate between staging and production environments easily.
21 changes: 21 additions & 0 deletions charts/ontimize-web-ngx-playground/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helm-example.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "helm-example.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helm-example.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-example.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
52 changes: 52 additions & 0 deletions charts/ontimize-web-ngx-playground/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "labels" -}}
helm.sh/chart: {{ include "chart" . }}
{{ include "selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "selectorLabels" -}}
app.kubernetes.io/name: {{ include "name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/ontimize-web-ngx-playground/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.configmap.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.configmap.name | default (printf "%s-config" (include "fullname" .)) }}
data:
{{- if .Values.configmap.data }}
{{ toYaml .Values.configmap.data | indent 2 }}
{{- end }}
{{- end }}

0 comments on commit 474e48d

Please sign in to comment.