Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/deploy-to-radix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ on:
default: "test"
required: true
type: string
image-tag:
description: "Which image tag to deploy."
required: true
type: string
workflow_call: # Workflow is meant to be called from another workflow
inputs:
radix-environment:
description: "Which radix environment to deploy into"
default: "test"
required: true
type: string
image-tag:
description: "Which image tag to deploy."
required: true
type: string

permissions:
id-token: write
Expand Down Expand Up @@ -62,3 +70,5 @@ jobs:
--from-config
--token-environment
--follow
--image-tag-name api=${{ inputs.image-tag }}
--image-tag-name proxy=${{ inputs.image-tag }}
18 changes: 9 additions & 9 deletions .github/workflows/on-push-main-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ jobs:
uses: ./.github/workflows/publish-image.yaml
with:
image-tags: latest
oauth-redirect-url: "https://proxy-template-fastapi-react-test.playground.radix.equinor.com/"
# FIXME: DEMO CURRENTLY NOT DEPLOYED TO RADIX, comment back in to enable deployment to test environment
# deploy-test:
# deploy-dev:
# needs: publish-latest
# uses: ./.github/workflows/deploy-to-radix.yaml
# with:
# radix-environment: "test"
# image-tag: "latest"
# radix-environment: "dev"

release-please:
needs: tests
uses: ./.github/workflows/create-release-pr.yaml

publish-production:
publish-staging:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/publish-image.yaml
with:
image-tags: production,${{ needs.release-please.outputs.tag_name }}
oauth-redirect-url: "https://template-fastapi-react.app.playground.radix.equinor.com"
image-tags: ${{ needs.release-please.outputs.tag_name }}
# FIXME: DEMO CURRENTLY NOT DEPLOYED TO RADIX, comment back in to enable deployment to production environment
# deploy-prod:
# needs: publish-production
# deploy-staging:
# needs: [release-please, publish-staging]
# uses: ./.github/workflows/deploy-to-radix.yaml
# with:
# radix-environment: "prod"
# image-tag: ${{ needs.release-please.outputs.tag_name }}
# radix-environment: "staging"
6 changes: 0 additions & 6 deletions .github/workflows/publish-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:
description: "Which tag to give the images. Supports multiple tags if comma separated, ie 'tag1,tag2'"
required: true
type: string
oauth-redirect-url:
description: "Redirect url for oauth. Should be the public url to access the web app"
default: "https://template-fastapi-react.app.playground.radix.equinor.com"
required: true
type: string
secrets:
CR_SECRET:
description: "Secret to authenticate if using an other container registry than Github"
Expand Down Expand Up @@ -39,7 +34,6 @@ jobs:
docker pull $NGINX_IMAGE
printf "$(git log -n 1 --format=format:'hash: %h%ndate: %cs%nrefs: %d' --decorate=short --decorate-refs=refs/tags | sed 's/ (tag: \([^\s]*\))/\1/')" > ./web/public/version.txt
docker build \
--build-arg REDIRECT_URI=${{inputs.oauth-redirect-url}} \
--build-arg AUTH_ENABLED=1 \
--build-arg AUTH_SCOPE=api://4a761bec-628d-4c4b-860a-4903cbecc963/api \
--build-arg CLIENT_ID=4a761bec-628d-4c4b-860a-4903cbecc963 \
Expand Down
20 changes: 13 additions & 7 deletions radixconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ metadata:
spec:
environments:
- name: prod
- name: staging
build:
from: main
- name: test
- name: dev
build:
from: main
components:
Expand All @@ -23,15 +24,20 @@ spec:
cpu: "4000m"
environmentConfig:
- environment: prod
imageTagName: production
imageTagName: latest
horizontalScaling:
minReplicas: 1
maxReplicas: 4
- environment: test
- environment: staging
imageTagName: latest
horizontalScaling:
minReplicas: 1
maxReplicas: 2
- environment: dev
imageTagName: latest
horizontalScaling:
minReplicas: 1
maxReplicas: 1
secrets:
- SECRET_KEY
- MONGODB_PASSWORD
Expand All @@ -58,11 +64,11 @@ spec:
alwaysPullImageOnDeploy: true
environmentConfig:
- environment: prod
imageTagName: production
- environment: test
imageTagName: latest
variables:
AUTH_ENABLED: "True"
- environment: staging
imageTagName: latest
- environment: dev
imageTagName: latest
ports:
- name: nginx
port: 8080
Expand Down
2 changes: 0 additions & 2 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ USER 1000

FROM node:22 AS base
ARG AUTH_ENABLED=0
ARG REDIRECT_URI=http://localhost/
# Azure AD requires a scope.
ARG AUTH_SCOPE=""
ARG CLIENT_ID=""
Expand All @@ -45,7 +44,6 @@ ENV VITE_AUTH_TENANT=$TENANT_ID
ENV VITE_TOKEN_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/v2.0/token
ENV VITE_AUTH_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/v2.0/authorize
ENV VITE_LOGOUT_ENDPOINT=https://login.microsoftonline.com/${VITE_AUTH_TENANT}/oauth2/logout
ENV VITE_AUTH_REDIRECT_URI=$REDIRECT_URI

WORKDIR /code
COPY ./ ./
Expand Down
2 changes: 1 addition & 1 deletion web/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const authConfig: TAuthConfig = {
authorizationEndpoint: import.meta.env.VITE_AUTH_ENDPOINT || '',
tokenEndpoint: import.meta.env.VITE_TOKEN_ENDPOINT || '',
scope: import.meta.env.VITE_AUTH_SCOPE || '',
redirectUri: import.meta.env.VITE_AUTH_REDIRECT_URI || '',
redirectUri: window.origin,
logoutEndpoint: import.meta.env.VITE_LOGOUT_ENDPOINT || '',
autoLogin: false,
preLogin: () =>
Expand Down
Loading