Skip to content

Commit

Permalink
Mahdollisuus asentaa tietty commit, lisätty tuotanto asennus mahdolli…
Browse files Browse the repository at this point in the history
…suus
  • Loading branch information
hajoa committed Dec 10, 2024
1 parent 53c2861 commit b9abc09
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ permissions:
on:
workflow_dispatch:
inputs:
build-number:
type: number
description: Github Actions build number
commit:
type: string
description: Commit hash if you want to deploy a specific version
environment:
type: choice
description: Environment where to deploy
options:
- untuva
- hahtuva
- pallero
- sade
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
Expand All @@ -30,13 +33,20 @@ jobs:
cd ../../cdk
npm ci
npm install -g aws-cdk
- name: Configure AWS credentials
- name: Configure AWS credentials for DEV
if: ${{ inputs.environment == 'hahtuva' || inputs.environment == 'untuva' || inputs.environment == 'pallero' }}
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
role-to-assume: ${{ secrets.AWS_OPINTOPOLKU_DEV_ROLE_ARN }}
role-session-name: maksut-ui-deploy
aws-region: eu-west-1
- name: Configure AWS credentials for PROD
if: ${{ inputs.environment == 'sade' }}
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
role-to-assume: ${{ secrets.AWS_OPINTOPOLKU_PROD_ROLE_ARN }}
role-session-name: maksut-ui-deploy
aws-region: eu-west-1
- name: Deploy Next.js app
run: |
cd cdk
Expand Down
7 changes: 7 additions & 0 deletions cdk/lib/sovellus-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Nextjs } from 'cdk-nextjs-standalone';
import * as route53 from 'aws-cdk-lib/aws-route53';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import { PriceClass } from 'aws-cdk-lib/aws-cloudfront';
import * as shield from 'aws-cdk-lib/aws-shield';

interface MaksutUiStackProps extends cdk.StackProps {
environmentName: string;
Expand Down Expand Up @@ -63,6 +64,12 @@ export class SovellusStack extends cdk.Stack {
}
}
});

const protection = new shield.CfnProtection(this, 'DistributionShieldProtection', {
name: `maksut-ui-${props.environmentName} cloudfront distribution`,
resourceArn: `arn:aws:cloudfront::${this.account}:distribution/${nextjs.distribution.distributionId}`,
});

new cdk.CfnOutput(this, "CloudFrontDistributionDomain", {
value: nextjs.distribution.distributionDomain,
});
Expand Down
9 changes: 5 additions & 4 deletions cdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"devDependencies": {
"@types/node": "^20.12.7",
"aws-cdk": "^2.114.1",
"aws-cdk": "^2.148.1",
"esbuild": "^0.19.12",
"tsx": "^4.7.2",
"typescript": "~5.3.3"
Expand Down
3 changes: 2 additions & 1 deletion src/clj/maksut/routes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@
(response/found (:href paytrail-response)))
(catch Exception e
(let [data (ex-data e)]
(log/error "Maksun" order-id "maksaminen epäonnistui:" e)
(response/found
(str (get-in config [:urls :oppija-baseurl])
"/"
locale
(or locale "fi")
"/error?code="
(name (:code data))))))))}}]]

Expand Down

0 comments on commit b9abc09

Please sign in to comment.