Skip to content

Commit 2a829e6

Browse files
author
Andreas Skomedal
committed
init
0 parents  commit 2a829e6

File tree

172 files changed

+8426
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+8426
-0
lines changed
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Backend
2+
3+
on:
4+
push:
5+
paths:
6+
- '.github/workflows/etterlevelse-backend.yml'
7+
- 'apps/backend/**'
8+
9+
env:
10+
IMAGE: docker.pkg.github.com/${{ github.repository }}/etterlevelsebackend:${{ github.sha }}
11+
12+
defaults:
13+
run:
14+
working-directory: apps/backend
15+
16+
jobs:
17+
build:
18+
name: Backend - build and push docker
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v1
23+
- uses: actions/[email protected]
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
28+
- name: Set up JDK 15
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: '15.x'
32+
- name: Build
33+
run: mvn compile
34+
- name: Test and Package
35+
run: mvn package
36+
37+
- name: docker
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
docker build --tag ${IMAGE} .
42+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
43+
docker push ${IMAGE}
44+
45+
deploy-preprod:
46+
name: Backend - deploy Dev GCP
47+
needs: build
48+
if: github.ref == 'refs/heads/master'
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v1
52+
- uses: nais/deploy/actions/deploy@v1
53+
env:
54+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
55+
CLUSTER: dev-gcp
56+
RESOURCE: apps/backend/nais/backend-gcp.yaml
57+
VARS: apps/backend/nais/backend-dev-gcp-vars.yaml
58+
ENVIRONMENT: dev-gcp:teamdatajegerne:etterlevelse-backend
59+
60+
deploy-prod:
61+
name: Backend - deploy Prod GCP
62+
needs: build
63+
if: github.ref == 'refs/heads/prod'
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v1
67+
- uses: nais/deploy/actions/deploy@v1
68+
env:
69+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
70+
CLUSTER: prod-gcp
71+
RESOURCE: apps/backend/nais/backend-gcp.yaml
72+
VARS: apps/backend/nais/backend-prod-gcp-vars.yaml
73+
ENVIRONMENT: prod-gcp:teamdatajegerne:etterlevelse-backend
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Frontend
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/etterlevelse-frontend.yml"
7+
- "apps/frontend/**"
8+
9+
env:
10+
IMAGE: docker.pkg.github.com/${{ github.repository }}/etterlevelsefront${{ github.ref == 'refs/heads/prod' }}:${{ github.sha }}
11+
12+
defaults:
13+
run:
14+
working-directory: apps/frontend
15+
16+
jobs:
17+
build:
18+
name: Frontend - build and push docker
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v1
23+
- name: Set up node
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: "13.x"
27+
28+
- name: npm install
29+
run: npm i
30+
- name: use prod config
31+
if: github.ref == 'refs/heads/prod'
32+
run: cp .env.prod .env
33+
- name: add version
34+
env:
35+
GITHUB_SHA: ${{ github.sha }}
36+
run: echo "REACT_APP_GIT_VERSION=${GITHUB_SHA}" >> .env
37+
38+
- name: Build
39+
run: CI=false npm run build
40+
- name: Docker
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
docker build --tag ${IMAGE} .
45+
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
46+
docker push ${IMAGE}
47+
48+
deploy-preprod:
49+
name: Frontend - deploy Dev GCP
50+
needs: build
51+
if: github.ref == 'refs/heads/master'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v1
55+
- uses: nais/deploy/actions/deploy@v1
56+
env:
57+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
58+
CLUSTER: dev-gcp
59+
RESOURCE: apps/frontend/nais/frontend-gcp.yaml
60+
VARS: apps/frontend/nais/frontend-dev-gcp-vars.yaml
61+
ENVIRONMENT: dev-gcp:teamdatajegerne:etterlevelse-frontend
62+
63+
deploy-prod:
64+
name: Frontend - deploy Prod GCP
65+
needs: build
66+
if: github.ref == 'refs/heads/prod'
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v1
70+
- uses: nais/deploy/actions/deploy@v1
71+
env:
72+
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
73+
CLUSTER: prod-gcp
74+
RESOURCE: apps/frontend/nais/frontend-gcp.yaml
75+
VARS: apps/frontend/nais/frontend-prod-gcp-vars.yaml
76+
ENVIRONMENT: prod-gcp:teamdatajegerne:etterlevelse-frontend

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
# IDE
3+
.idea
4+
*.iml
5+
6+
# dependencies
7+
node_modules
8+
.pnp
9+
.pnp.js
10+
11+
# testing
12+
/coverage
13+
14+
target
15+
build
16+
17+
# misc
18+
.DS_Store
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
package-lock.json

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#MIT License
2+
3+
Copyright 2019 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

apps/backend/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM openjdk:15-slim as builder
2+
WORKDIR application
3+
COPY target/app-exec.jar application.jar
4+
RUN java -Djarmode=layertools -jar application.jar extract
5+
6+
FROM navikt/java:15
7+
8+
ENV MAIN_CLASS=org.springframework.boot.loader.JarLauncher
9+
ENV JAVA_OPTS="-Xmx850m \
10+
--enable-preview \
11+
-Djava.security.egd=file:/dev/./urandom"
12+
COPY run-java.sh /
13+
14+
COPY --from=builder application/dependencies/ ./
15+
RUN true
16+
COPY --from=builder application/snapshot-dependencies/ ./
17+
RUN true
18+
COPY --from=builder application/spring-boot-loader/ ./
19+
RUN true
20+
COPY --from=builder application/application/ ./

apps/backend/docker-compose.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '3.7'
2+
services:
3+
postgres:
4+
image: postgres:12
5+
restart: always
6+
environment:
7+
- POSTGRES_USER=etterlev
8+
- POSTGRES_PASSWORD=password
9+
volumes:
10+
- postgres:/var/lib/postgresql/data
11+
ports:
12+
- 5433:5432
13+
14+
volumes:
15+
postgres:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ingresses:
2+
- https://etterlevelse-api.dev.intern.nav.no
3+
replies:
4+
- https://etterlevelse-api.dev.intern.nav.no/oauth2/callback
5+
- https://etterlevelse.dev.intern.nav.no/oauth2/callback
6+
- http://localhost:8080/oauth2/callback
7+
- http://localhost:3000/oauth2/callback
8+
env:
9+
- name: ETTERLEV_SECURITY_REDIRECT_URIS
10+
value: https://etterlevelse.dev.intern.nav.no,https://etterlevelse-api.dev.intern.nav.no,http://localhost:3000
11+
- name: AZURE_CLIENT_GROUPS
12+
value: 2ee0ef50-718c-43d3-8c05-c839f2dc2490
13+
- name: AZURE_CLIENT_GROUPS_ADMIN
14+
value: bf05a29f-6f80-4da1-b419-22c802fd41e7

apps/backend/nais/backend-gcp.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: "nais.io/v1alpha1"
2+
kind: "Application"
3+
metadata:
4+
name: etterlevelse-backend
5+
namespace: teamdatajegerne
6+
labels:
7+
team: teamdatajegerne
8+
spec:
9+
image: {{image}}
10+
port: 8080
11+
azure:
12+
application:
13+
enabled: true
14+
replyURLs:
15+
{{#each replies as |url|}}
16+
- {{url}}
17+
{{/each}}
18+
tokenx:
19+
enabled: true
20+
ingresses:
21+
{{#each ingresses as |url|}}
22+
- {{url}}
23+
{{/each}}
24+
replicas:
25+
min: 2
26+
max: 2
27+
cpuThresholdPercentage: 50
28+
resources:
29+
limits:
30+
cpu: 1000m
31+
memory: 1024Mi
32+
requests:
33+
memory: 512Mi
34+
liveness:
35+
path: internal/isAlive
36+
initialDelay: 10
37+
periodSeconds: 5
38+
failureThreshold: 30
39+
readiness:
40+
path: internal/isReady
41+
initialDelay: 10
42+
periodSeconds: 5
43+
failureThreshold: 30
44+
prometheus:
45+
enabled: true
46+
path: internal/metrics
47+
envFrom:
48+
- secret: etterlevelse-enckey
49+
env:
50+
{{#each env}}
51+
- name: {{this.name}}
52+
value: {{this.value}}
53+
{{/each}}
54+
55+
gcp:
56+
sqlInstances:
57+
- name: etterlevelse
58+
type: POSTGRES_12
59+
databases:
60+
- name: etterlevelsedb
61+
envVarPrefix: DB
62+
accessPolicy:
63+
inbound:
64+
rules:
65+
- application: etterlevelse-frontend
66+
outbound:
67+
external:
68+
- host: teamkatalog-api.dev-fss-pub.nais.io
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ingresses:
2+
- https://etterlevelse-api.intern.nav.no
3+
replies:
4+
- https://etterlevelse.intern.nav.no/oauth2/callback
5+
env:
6+
- name: ETTERLEV_SECURITY_REDIRECT_URIS
7+
value: https://etterlevelse.intern.nav.no
8+
- name: AZURE_CLIENT_GROUPS
9+
value: 2ee0ef50-718c-43d3-8c05-c839f2dc2490
10+
- name: AZURE_CLIENT_GROUPS_ADMIN
11+
value: bf05a29f-6f80-4da1-b419-22c802fd41e7

0 commit comments

Comments
 (0)