Merge pull request #146 from com-pas/renovate/configure #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2023 Alliander N.V. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Deploy SCL Data Service on AWS | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
environment: aws | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: read-docker-compose | |
id: read_docker_compose | |
uses: jbutcher5/read-yaml@main | |
with: | |
file: './compas/docker-compose-postgresql.yml' | |
key-path: '["services", "scl-data-service", "image"]' | |
- name: Render CoMPAS SCL Data Service Container | |
id: render-scl-data-service | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: ${{ github.workspace }}/aws/task-definitions/compas-scl-data-service.json | |
container-name: CoMPAS-Scl-Data-Service | |
image: ${{ steps.read_docker_compose.outputs.data }} | |
environment-variables: | | |
POSTGRESQL_PASSWORD=${{ secrets.POSTGRESQL_PASSWORD }} | |
POSTGRESQL_USERNAME=${{ secrets.POSTGRESQL_USERNAME }} | |
POSTGRESQL_HOST=${{ secrets.POSTGRESQL_HOST }} | |
POSTGRESQL_DB=${{ secrets.POSTGRESQL_DB }} | |
JWT_VERIFY_KEY=${{ secrets.JWT_VERIFY_KEY }} | |
JWT_VERIFY_ISSUER=${{ secrets.JWT_VERIFY_ISSUER }} | |
- name: Modify Amazon ECS task definition with postgres container | |
id: render-postgres | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: ${{ steps.render-scl-data-service.outputs.task-definition }} | |
container-name: Postgresql | |
image: postgres:14.5 | |
environment-variables: | | |
POSTGRES_USER=${{ secrets.POSTGRESQL_USERNAME }} | |
POSTGRES_PASSWORD=${{ secrets.POSTGRESQL_PASSWORD }} | |
POSTGRES_DB=${{ secrets.POSTGRESQL_DB }} | |
PG_USER=${{ secrets.POSTGRESQL_USERNAME }} | |
- name: Deploy to Amazon ECS service | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.render-postgres.outputs.task-definition }} | |
service: Scl-Data-Service | |
cluster: ${{ secrets.AWS_CLUSTER }} |