Skip to content

Commit

Permalink
Tilrettelegg for deploy til prod
Browse files Browse the repository at this point in the history
  • Loading branch information
almyy committed Dec 11, 2024
1 parent 47bb0e9 commit 221d7d4
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 109 deletions.
47 changes: 12 additions & 35 deletions .github/workflows/build_deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,23 @@ on:
default: 'mock'
type: choice
options:
- 'dev'
- 'mock'
- 'q0'
- 'preprod'
workflow_call:
inputs:
config-file-name:
required: true
type: string

env:
DOCKER_IMAGE_POSTFIX: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-${{ inputs.config-file-name }}
jobs:
build-image:
name: 'Build Image for Deploy'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
contents: read
id-token: write
outputs:
image-tag: ${{ steps.artifact-version.outputs.version }}
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -59,47 +54,29 @@ jobs:
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}

- name: 'Create artifact version'
id: artifact-version
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@v2

- name: 'Release Tag'
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
with:
tag: ${{ steps.artifact-version.outputs.version }}
commit: ${{ github.sha }}
allowUpdates: true

- name: 'Login to GitHub Docker Registry if GitHub Token Provided'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: 'Build and Push Docker Image'
uses: navikt/sosialhjelp-ci/actions/build-and-push-docker-image@v2
- name: Build and push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
artifact-version: ${{ steps.artifact-version.outputs.version }}
image-name: ${{ env.DOCKER_IMAGE_POSTFIX }}
team: teamdigisos
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: ${{ inputs.config-file-name }}

deploy-gcp:
name: 'Deploy to development'
permissions:
id-token: write
if: ${{ inputs.config-file-name != 'q0' }}
contents: read
needs: build-image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Deploy til dev'
uses: nais/deploy/actions/deploy@v2
uses: nais/deploy/actions/deploy@v3
env:
RESOURCE: nais/dev/${{ inputs.config-file-name }}.yaml
CLUSTER: dev-gcp
REF: ${{ github.sha }}
PRINT_PAYLOAD: true
IMAGE: ${{ env.DOCKER_IMAGE_POSTFIX }}:${{ needs.build-image.outputs.image-tag }}
VAR: image=${{ needs.build-image.outputs.image }}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: 'Build Production Image - HUSK MANUELL DEPLOY TIL PROD!'
on:
workflow_call:
workflow_run:
workflows: ['Build code and run tests']
branches: [master]
types:
- completed
env:
DOCKER_IMAGE_POSTFIX: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-production
jobs:
build-image:
name: 'Build and Push image'
name: 'Build Image for Deploy'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
contents: read
id-token: write
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- uses: actions/checkout@v4

Expand All @@ -39,31 +39,32 @@ jobs:
team: teamdigisos
source: ./.next/static
destination: "/sosialhjelp-innsyn/_next"
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}

- name: 'Create artifact version'
id: artifact-version
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@v2

- name: 'Release Tag'
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
with:
tag: ${{ steps.artifact-version.outputs.version }}
commit: ${{ github.sha }}
allowUpdates: true

- name: 'Login to GitHub Docker Registry if GitHub Token Provided'
uses: docker/login-action@v3
- name: Build and push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
team: teamdigisos
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: production

- name: 'Build and Push Docker Image'
uses: navikt/sosialhjelp-ci/actions/build-and-push-docker-image@v2
with:
artifact-version: ${{ steps.artifact-version.outputs.version }}
image-name: ${{ env.DOCKER_IMAGE_POSTFIX }}
deploy-gcp:
name: 'Deploy to production'
permissions:
id-token: write
contents: read
needs: build-image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Deploy til prod'
uses: nais/deploy/actions/deploy@v3
env:
RESOURCE: nais/prod/prod.yaml
CLUSTER: prod-gcp
REF: ${{ github.sha }}
PRINT_PAYLOAD: true
VAR: image=${{ needs.build-image.outputs.image }}
19 changes: 0 additions & 19 deletions .github/workflows/delete_images.yml

This file was deleted.

3 changes: 2 additions & 1 deletion nais/dev/preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
namespace: teamdigisos
labels:
team: teamdigisos
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "150M"
spec:
image: {{image}}
port: 8080
Expand Down Expand Up @@ -33,7 +35,6 @@ spec:
external:
- host: dekoratoren.ekstern.dev.nav.no
- host: teamdigisos-unleash-api.nav.cloud.nais.io
- host: login.ekstern.dev.nav.no
inbound:
rules:
- application: wonderwall-innsyn
Expand Down
7 changes: 0 additions & 7 deletions nais/envs/.env.dev

This file was deleted.

4 changes: 1 addition & 3 deletions nais/envs/.env.preprod
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
NEXT_PUBLIC_INNSYN_API_SINGLE_LOGOUT_URL=https://loginservice.nav.no/slo
NEXT_INNSYN_API_BASE_URL=https://www.ekstern.dev.nav.no/sosialhjelp/wonderwall-innsyn
NEXT_PUBLIC_INNSYN_API_BASE_URL=https://www.ekstern.dev.nav.no/sosialhjelp/wonderwall-innsyn
NEXT_PUBLIC_DEKORATOREN_LOGOUT_URL=/sosialhjelp/innsyn/oauth2/logout
NEXT_PUBLIC_LOGIN_BASE_URL=https://login.ekstern.dev.nav.no
NEXT_INNSYN_API_HOSTNAME=sosialhjelp-innsyn-api
NEXT_PUBLIC_INNSYN_ORIGIN=https://www.ekstern.dev.nav.no
Expand Down
6 changes: 3 additions & 3 deletions nais/envs/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NEXT_PUBLIC_INNSYN_API_SINGLE_LOGOUT_URL=https://loginservice.nav.no/slo
NEXT_PUBLIC_INNSYN_API_BASE_URL=https://www.nav.no/sosialhjelp/login-api/innsyn-api
NEXT_INNSYN_API_BASE_URL=https://www.nav.no/sosialhjelp/login-api/innsyn-api
NEXT_PUBLIC_DEKORATOREN_LOGOUT_URL=/sosialhjelp/innsyn/oauth2/logout
NEXT_PUBLIC_LOGIN_BASE_URL=https://login.nav.no
NEXT_INNSYN_API_HOSTNAME=sosialhjelp-innsyn-api
NEXT_PUBLIC_INNSYN_ORIGIN=https://www.nav.no
NEXT_PUBLIC_DEKORATOR_MILJO=prod
NEXT_PUBLIC_RUNTIME_ENVIRONMENT=prod
Expand Down
7 changes: 0 additions & 7 deletions nais/envs/.env.q0

This file was deleted.

8 changes: 5 additions & 3 deletions nais/prod/prod-gcp.yaml → nais/prod/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ spec:
replicas:
min: 2
max: 4
ingresses:
- "https://sosialhjelp-innsyn.prod-gcp.nais.io/sosialhjelp/innsyn"
accessPolicy:
outbound:
rules:
- application: sosialhjelp-innsyn-api
- application: nav-dekoratoren
namespace: personbruker
external:
- host: "https://www.nav.no"
- host: dekoratoren.nav.no
- host: teamdigisos-unleash-api.nav.cloud.nais.io
inbound:
rules:
- application: wonderwall-innsyn
resources:
limits:
cpu: 200m
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const decoratorParams = (ctx: DocumentContext): DecoratorFetchProps => ({
chatbot: false,
shareScreen: false,
utilsBackground: "white",
logoutUrl: process.env.NEXT_PUBLIC_INNSYN_API_SINGLE_LOGOUT_URL || undefined,
logoutUrl: process.env.NEXT_PUBLIC_DEKORATOREN_LOGOUT_URL || undefined,
availableLanguages: [
{
locale: "nb",
Expand Down
4 changes: 3 additions & 1 deletion wonderwall/prod/wonderwall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
namespace: teamdigisos
labels:
team: teamdigisos
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "150M"
spec:
image: europe-north1-docker.pkg.dev/nais-io/nais/images/wonderwall:latest
port: 8080
Expand Down Expand Up @@ -45,7 +47,7 @@ spec:
- name: WONDERWALL_AUTO_LOGIN
value: "true"
- name: WONDERWALL_INGRESS
value: https://www.ansatt.nav.no/sosialhjelp/innsyn
value: https://www.nav.no/sosialhjelp/innsyn
- name: WONDERWALL_UPSTREAM_HOST
value: sosialhjelp-innsyn:80
- name: WONDERWALL_BIND_ADDRESS
Expand Down

0 comments on commit 221d7d4

Please sign in to comment.