Skip to content

Commit 5fa04a1

Browse files
Merge pull request #130 from com-pas/refactor_aws_gh_actions
Refactor aws gh actions
2 parents 06f94de + 8a942d6 commit 5fa04a1

16 files changed

+227
-86
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-FileCopyrightText: 2023 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Deploy CoMPAS SCL Auto Alignment on AWS
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
deployment:
14+
runs-on: ubuntu-latest
15+
environment: aws
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v2
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: eu-west-1
26+
27+
- name: read-docker-compose
28+
id: read_docker_compose
29+
uses: jbutcher5/read-yaml@main
30+
with:
31+
file: './compas/docker-compose-postgresql.yml'
32+
key-path: '["services", "scl-auto-alignment", "image"]'
33+
- name: Render CoMPAS OpenSCD Container
34+
id: render-auto-alignment
35+
uses: aws-actions/amazon-ecs-render-task-definition@v1
36+
with:
37+
task-definition: ${{ github.workspace }}/aws/task-definitions/compas-auto-alignment.json
38+
container-name: CoMPAS-Scl-Auto-Alignment
39+
image: ${{ steps.read_docker_compose.outputs.data }}
40+
environment-variables: |
41+
JWT_VERIFY_KEY=${{ secrets.JWT_VERIFY_KEY }}
42+
JWT_VERIFY_ISSUER=${{ secrets.JWT_VERIFY_ISSUER }}
43+
44+
- name: Deploy to Amazon ECS service
45+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
46+
with:
47+
task-definition: ${{ steps.render-auto-alignment.outputs.task-definition }}
48+
service: scl-auto-alignment
49+
cluster: ${{ secrets.AWS_CLUSTER }}

.github/workflows/aws.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-FileCopyrightText: 2023 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Deploy CoMPAS Cim Mapping on AWS
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
deployment:
14+
runs-on: ubuntu-latest
15+
environment: aws
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v2
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: eu-west-1
26+
27+
- name: read-docker-compose
28+
id: read_docker_compose
29+
uses: jbutcher5/read-yaml@main
30+
with:
31+
file: './compas/docker-compose-postgresql.yml'
32+
key-path: '["services", "cim-mapping", "image"]'
33+
- name: Render CoMPAS OpenSCD Container
34+
id: render-cim-mapping
35+
uses: aws-actions/amazon-ecs-render-task-definition@v1
36+
with:
37+
task-definition: ${{ github.workspace }}/aws/task-definitions/compas-cim-mapping.json
38+
container-name: CoMPAS-Cim-Mapping
39+
image: ${{ steps.read_docker_compose.outputs.data }}
40+
environment-variables: |
41+
JWT_VERIFY_KEY=${{ secrets.JWT_VERIFY_KEY }}
42+
JWT_VERIFY_ISSUER=${{ secrets.JWT_VERIFY_ISSUER }}
43+
44+
- name: Deploy to Amazon ECS service
45+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
46+
with:
47+
task-definition: ${{ steps.render-cim-mapping.outputs.task-definition }}
48+
service: Compas-Cim-Mapping
49+
cluster: ${{ secrets.AWS_CLUSTER }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPDX-FileCopyrightText: 2023 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Deploy CoMPAS OpenSCD on AWS
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
deployment:
14+
runs-on: ubuntu-latest
15+
environment: aws
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v2
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: eu-west-1
26+
27+
- name: read-docker-compose
28+
id: read_docker_compose
29+
uses: jbutcher5/read-yaml@main
30+
with:
31+
file: './compas/docker-compose-postgresql.yml'
32+
key-path: '["services", "open-scd", "image"]'
33+
- name: Render CoMPAS OpenSCD Container
34+
id: render-compas-openscd
35+
uses: aws-actions/amazon-ecs-render-task-definition@v1
36+
with:
37+
task-definition: ${{ github.workspace }}/aws/task-definitions/compas-openscd.json
38+
container-name: CoMPAS-OpenSCD
39+
image: ${{ steps.read_docker_compose.outputs.data }}
40+
41+
- name: Deploy to Amazon ECS service
42+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
43+
with:
44+
task-definition: ${{ steps.render-compas-openscd.outputs.task-definition }}
45+
service: CoMPAS-OpenSCD
46+
cluster: ${{ secrets.AWS_CLUSTER }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# SPDX-FileCopyrightText: 2023 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Deploy SCL Data Service on AWS
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
deployment:
14+
runs-on: ubuntu-latest
15+
environment: aws
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v2
22+
with:
23+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
aws-region: eu-west-1
26+
27+
- name: read-docker-compose
28+
id: read_docker_compose
29+
uses: jbutcher5/read-yaml@main
30+
with:
31+
file: './compas/docker-compose-postgresql.yml'
32+
key-path: '["services", "scl-data-service", "image"]'
33+
- name: Render CoMPAS SCL Data Service Container
34+
id: render-scl-data-service
35+
uses: aws-actions/amazon-ecs-render-task-definition@v1
36+
with:
37+
task-definition: ${{ github.workspace }}/aws/task-definitions/compas-scl-data-service.json
38+
container-name: CoMPAS-Scl-Data-Service
39+
image: ${{ steps.read_docker_compose.outputs.data }}
40+
environment-variables: |
41+
POSTGRESQL_PASSWORD=${{ secrets.POSTGRESQL_PASSWORD }}
42+
POSTGRESQL_USERNAME=${{ secrets.POSTGRESQL_USERNAME }}
43+
POSTGRESQL_HOST=${{ secrets.POSTGRESQL_HOST }}
44+
POSTGRESQL_DB=${{ secrets.POSTGRESQL_DB }}
45+
JWT_VERIFY_KEY=${{ secrets.JWT_VERIFY_KEY }}
46+
JWT_VERIFY_ISSUER=${{ secrets.JWT_VERIFY_ISSUER }}
47+
48+
- name: Modify Amazon ECS task definition with postgres container
49+
id: render-postgres
50+
uses: aws-actions/amazon-ecs-render-task-definition@v1
51+
with:
52+
task-definition: ${{ steps.render-scl-data-service.outputs.task-definition }}
53+
container-name: Postgresql
54+
image: postgres:14.5
55+
environment-variables: |
56+
POSTGRES_USER=${{ secrets.POSTGRESQL_USERNAME }}
57+
POSTGRES_PASSWORD=${{ secrets.POSTGRESQL_PASSWORD }}
58+
POSTGRES_DB=${{ secrets.POSTGRESQL_DB }}
59+
PG_USER=${{ secrets.POSTGRESQL_USERNAME }}
60+
61+
- name: Deploy to Amazon ECS service
62+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
63+
with:
64+
task-definition: ${{ steps.render-postgres.outputs.task-definition }}
65+
service: Scl-Data-Service
66+
cluster: ${{ secrets.AWS_CLUSTER }}

aws/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ Now change the executionRoleArn to something like this:
3636

3737
Change the executionRoleArn in the following files:
3838

39-
* [task-executions/compas-auto-alignment.json](./task-executions/compas-auto-alignment.json)
40-
* [task-executions/compas-cim-mapping.json](./task-executions/compas-cim-mapping.json)
41-
* [task-executions/compas-openscd.json](./task-executions/compas-openscd.json)
42-
* [task-executions/compas-scl-data-service.json](./task-executions/compas-scl-data-service.json)
43-
* [task-executions/compas-scl-validator.json](./task-executions/compas-scl-validator.json)
39+
* [task-definitions/compas-auto-alignment.json](task-definitions/compas-auto-alignment.json)
40+
* [task-definitions/compas-cim-mapping.json](task-definitions/compas-cim-mapping.json)
41+
* [task-definitions/compas-openscd.json](task-definitions/compas-openscd.json)
42+
* [task-definitions/compas-scl-data-service.json](task-definitions/compas-scl-data-service.json)
43+
* [task-definitions/compas-scl-validator.json](task-definitions/compas-scl-validator.json)
4444

4545
Go to the `Elastic Container Service` in the AWS console.
4646
Here you can create a new cluster.
File renamed without changes.

aws/task-executions/compas-auto-alignment.json.license renamed to aws/task-definitions/compas-auto-alignment.json.license

File renamed without changes.

aws/task-executions/compas-cim-mapping.json renamed to aws/task-definitions/compas-cim-mapping.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"value": "true"
3030
},
3131
{
32-
"name": "JWT_VERIFY_KEY",
33-
"value": "https://cognito-idp.eu-west-1.amazonaws.com/eu-west-1_sAuHe0PnO/.well-known/jwks.json"
32+
"name": "JWT_VERIFY_KEY"
3433
},
3534
{
3635
"name": "QUARKUS_LOG_LEVEL",
@@ -45,8 +44,7 @@
4544
"value": "long"
4645
},
4746
{
48-
"name": "JWT_VERIFY_ISSUER",
49-
"value": "https://cognito-idp.eu-west-1.amazonaws.com/eu-west-1_sAuHe0PnO"
47+
"name": "JWT_VERIFY_ISSUER"
5048
},
5149
{
5250
"name": "USERINFO_WHO_CLAIMNAME",
File renamed without changes.

0 commit comments

Comments
 (0)