Skip to content

Commit

Permalink
Make API container fully stateless and independent of frontend (#8708)
Browse files Browse the repository at this point in the history
* configure dev pipeline to use kong gateway

* fix make run and use kong gateway to expose dashboard

* update auth service and web

* add todo

* update web serve

* skip posinstall for dev serve

* build api in docker

* build apps in docker to simplify docker handling and release pipeline

* remove plugins

* fix run/serve

* add common client

* move settings to web container

* make api fully stateless and use common client

* refactor

* refactor settings

* refactor settings

* fix api unit tests

* minor updates

* refactor api types and helpers into common packages

* fix serve and update angular proxy config

* multiple fixes

* fix patch

* add version endpoint to be used in footer

* refactor pinned resources

* fix pinned resources

* rename

* add version support to module dockerfiles and fix locale handler

* keep only token auth

* make fix

* update workflows

* run go lint for the whole project

* Refactor csrf protection handling

* fix autologout on token expiration

* update login guard

* do not log sensitive data for lower log levels

* fix some cross-site scripting issues

* add noopener and noreferer to missing external links

* fix i18n and angular checks

* update checks

* fix checks

* fix tests

* make fix & yarn fix

* fix APILogLevel getter

* clean up build pipeline

* fix static check

* fix int conversion issue

* fix codecov

* Remove single yaml installation

* update helm ci/cd

* fix helm ci

* fix helm ci

* fix helm ci

* fix helm ci

* fix helm ci

* fix helm ci

* fix codecov

* bump codecov and use correct token

* fix web unit tests

* fix static check

* fix web ts check

* update workflows

* clean helm workflow

* disable cd until fixed

* update docs

* use eslint directly, without gts

* use prettier for stylesheets formatting

* use prettier for html formatting

* update dependencies

* update documentation

* update overview image

* remove file

* fix web build

* fix i18n and scss

* fix scss

* fix static check

---------

Co-authored-by: Marcin Maciaszczyk <[email protected]>
  • Loading branch information
floreks and maciaszczykm authored Mar 1, 2024
1 parent 2878d15 commit d5fe8fa
Show file tree
Hide file tree
Showing 663 changed files with 28,270 additions and 28,573 deletions.
3 changes: 1 addition & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.
#
codecov:
notify:
require_ci_to_pass: yes
require_ci_to_pass: true

coverage:
precision: 2
Expand Down
5 changes: 2 additions & 3 deletions charts/helm-chart/.helm-chart-testing.yaml → .ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
chart-dirs:
- charts/helm-chart

chart-repos:
- metrics-server=https://kubernetes-sigs.github.io/metrics-server/
- cert-manager=https://charts.jetstack.io
- ingress-nginx=https://kubernetes.github.io/ingress-nginx
debug: false
# additional-commands:
# - helm kubeconform {{ .Path }} --config charts/helm-chart/.kubeconforma
# - helm kubeconform {{ .Path }} --config charts/helm-chart/.kubeconform
10 changes: 5 additions & 5 deletions hack/gateway/Dockerfile → .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM nginx

COPY hack/gateway/config /etc/nginx
COPY .dist/certificates/private.key /etc/ssl/private/localhost.key
COPY .dist/certificates/public.crt /etc/ssl/certs/localhost.crt
# Web module
modules/web/.angular/
modules/web/node_modules/
modules/web/dist/
modules/web/tmp/
111 changes: 62 additions & 49 deletions .github/workflows/cd-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: CD / Helm
on:
push:
branches: [master]
paths:
- "charts/helm-chart/**"
- "hack/scripts/helm-release-chart.sh"
- ".github/workflows/cd-helm.yml"
permissions:
contents: write
pull-requests: write
jobs:
release:
name: Helm chart release
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git user
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Release new Helm chart
shell: bash
run: hack/scripts/helm-release-chart.sh
env:
TERM: xterm-256color

- name: Check out gh-pages-pull-request branch # It will fail if branch already exists
run: git checkout -b gh-pages-pull-request

- name: Push changes to gh-pages-pull-request branch # It will silently fail if pull request already exists
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages-pull-request

- name: Create pull request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: gh-pages-pull-request
destination_branch: gh-pages
pr_title: "Update Helm repository"
pr_body: "Automatically created from Helm CD workflow."
# TODO: Enable once helm chart is updated
#name: CD / Helm
#
#on:
# push:
# branches: [ master ]
#
#jobs:
# lint-test:
# name: Lint and test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/[email protected]
# with:
# fetch-depth: 0
# - uses: azure/[email protected]
# with:
# version: v3.12.1
# - uses: helm/[email protected]
# - id: list-changed
# run: |
# changed=$(ct list-changed --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }})
# if [[ -n "$changed" ]]; then
# echo "changed=true" >> "$GITHUB_OUTPUT"
# fi
# - if: steps.list-changed.outputs.changed == 'true'
# run: ct lint --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }}
# - if: steps.list-changed.outputs.changed == 'true'
# uses: helm/[email protected]
# with:
# node_image: kindest/node:v1.29.0
# - if: steps.list-changed.outputs.changed == 'true'
# run: ct install --target-branch ${{ github.event.repository.default_branch }}
#
# release:
# name: Helm chart release
# runs-on: ubuntu-latest
# needs: [ 'lint-test' ]
# permissions:
# contents: write
# steps:
# - name: Check out repository
# uses: actions/[email protected]
# with:
# fetch-depth: 0
#
# - name: Set up Git user
# run: |
# git config user.name "$GITHUB_ACTOR"
# git config user.email "[email protected]"
#
# - name: Set up Helm
# uses: azure/[email protected]
# with:
# version: v3.12.1
#
# - name: Run chart-releaser
# uses: helm/[email protected]
# with:
# skip_existing: true
# env:
# CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
145 changes: 73 additions & 72 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,76 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: CD
on:
push:
branches: [master]
create:
tags:
- "v*.*.*"
permissions:
contents: read
packages: write
env:
GOPATH: /home/runner/go/
GOPROXY: "https://proxy.golang.org"
NG_CLI_ANALYTICS: ci
NODE_OPTIONS: "--max-old-space-size=8192"
TERM: xterm
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: modules/api/go.mod
check-latest: true
cache-dependency-path: modules/api/go.sum

- name: Install API dependencies
working-directory: modules/api
run: go mod download

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.14.0

- name: Install web dependencies
working-directory: modules/web
run: yarn

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_RELEASE_USER }}
password: ${{ secrets.DOCKER_RELEASE_PASS }}

- name: Log in to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and deploy development release
if: github.event_name == 'push' && contains(github.ref, 'master')
run: PATH=$PATH:$GOPATH/bin make deploy-dev

- name: Build and deploy official release
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
run: PATH=$PATH:$GOPATH/bin make deploy
# TODO: Release pipeline needs to be updated to work with architecture changes
#name: CD
#on:
# push:
# branches: [master]
# create:
# tags:
# - "v*.*.*"
#permissions:
# contents: read
# packages: write
#env:
# GOPATH: /home/runner/go/
# GOPROXY: "https://proxy.golang.org"
# NG_CLI_ANALYTICS: ci
# NODE_OPTIONS: "--max-old-space-size=8192"
# TERM: xterm
#jobs:
# release:
# name: Release
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version-file: modules/api/go.mod
# check-latest: true
# cache-dependency-path: modules/api/go.sum
#
# - name: Install API dependencies
# working-directory: modules/api
# run: go mod download
#
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18.14.0
#
# - name: Install web dependencies
# working-directory: modules/web
# run: yarn
#
# - name: Set up QEMU
# uses: docker/[email protected]
#
# - name: Set up Docker Buildx
# uses: docker/[email protected]
#
# - name: Log in to Docker Hub
# uses: docker/[email protected]
# with:
# username: ${{ secrets.DOCKER_RELEASE_USER }}
# password: ${{ secrets.DOCKER_RELEASE_PASS }}
#
# - name: Log in to GitHub Container Registry
# uses: docker/[email protected]
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Build and deploy development release
# if: github.event_name == 'push' && contains(github.ref, 'master')
# run: PATH=$PATH:$GOPATH/bin make deploy-dev
#
# - name: Build and deploy official release
# if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
# run: PATH=$PATH:$GOPATH/bin make deploy
Loading

0 comments on commit d5fe8fa

Please sign in to comment.