From 0b3581b8d5484bfbc4e7ee34b4795cd12f34bc55 Mon Sep 17 00:00:00 2001 From: sharkinsspatial Date: Fri, 7 Jun 2024 13:46:20 -0600 Subject: [PATCH] Clean up environments following VIIRS migration in MCP production. --- .github/workflows/dev_deployment.yml | 4 +- .github/workflows/dev_viirs_deployment.yml | 2 +- .github/workflows/mcp_dev_deployment.yml | 82 ------------------- .../workflows/mcp_dev_viirs_deployment.yml | 2 +- .../workflows/mcp_production_deployment.yml | 81 ------------------ .../mcp_production_viirs_deployment.yml | 2 + .github/workflows/production_deployment.yml | 69 ---------------- .github/workflows/tox_tests.yml | 2 +- README.md | 28 ++----- 9 files changed, 11 insertions(+), 261 deletions(-) delete mode 100644 .github/workflows/mcp_dev_deployment.yml delete mode 100644 .github/workflows/mcp_production_deployment.yml delete mode 100644 .github/workflows/production_deployment.yml diff --git a/.github/workflows/dev_deployment.yml b/.github/workflows/dev_deployment.yml index 089e980..b761ea8 100644 --- a/.github/workflows/dev_deployment.yml +++ b/.github/workflows/dev_deployment.yml @@ -1,8 +1,6 @@ -name: dev deployment +name: uah dev deployment on: - push: - branches: [dev] workflow_dispatch: jobs: diff --git a/.github/workflows/dev_viirs_deployment.yml b/.github/workflows/dev_viirs_deployment.yml index b5f9727..77c5d10 100644 --- a/.github/workflows/dev_viirs_deployment.yml +++ b/.github/workflows/dev_viirs_deployment.yml @@ -2,7 +2,7 @@ name: uah dev viirs deployment on: push: - branches: [viirs_orchestration] + branches: [dev] workflow_dispatch: env: diff --git a/.github/workflows/mcp_dev_deployment.yml b/.github/workflows/mcp_dev_deployment.yml deleted file mode 100644 index b75efe0..0000000 --- a/.github/workflows/mcp_dev_deployment.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: mcp development deployment - -on: - push: - branches: [dev] - workflow_dispatch: - -env: - AWS_DEFAULT_REGION: us-west-2 - -# See https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#updating-your-github-actions-workflow -permissions: - id-token: write # required for requesting the JWT - contents: read # required for actions/checkout - -jobs: - unit-tests: - runs-on: ubuntu-20.04 - strategy: - matrix: - python: [3.8] - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install Tox - run: pip install tox - - name: Run Tox test environment - # Run tox using the version of Python in `PATH` - run: tox -e py - mcp-development-deployment: - strategy: - matrix: - python: [3.8] - runs-on: ubuntu-20.04 - needs: [unit-tests] - environment: - name: mcp-dev - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install tox - run: pip install tox - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME_ARN }} - role-session-name: ${{ github.actor }} - aws-region: us-west-2 - - name: Convert secrets to environment variables - env: - SECRETS_JSON: ${{ toJson(secrets) }} - run: | - while read -rd $'' line; do - echo "$line" >> $GITHUB_ENV - done < <( - jq -r <<<"$SECRETS_JSON" 'to_entries|map("\(.key)=\(.value)\u0000")[]' - ) - - name: Convert vars to environment variables - env: - VARS_JSON: ${{ toJson(vars) }} - run: | - while read -rd $'' line; do - echo "$line" >> $GITHUB_ENV - done < <( - jq -r <<<"$VARS_JSON" 'to_entries|map("\(.key)=\(.value)\u0000")[]' - ) - - name: Deploy with tox - run: tox -v -e dev -r -- deploy --require-approval never - - name: Run DB setup - run: | - setupdb=$(aws cloudformation describe-stacks \ - --stack-name $HLS_STACKNAME \ - --query "Stacks[0].Outputs[?OutputKey=='setupdbexport'].OutputValue" \ - --output=text - ) - aws lambda invoke --function-name=$setupdb response.json diff --git a/.github/workflows/mcp_dev_viirs_deployment.yml b/.github/workflows/mcp_dev_viirs_deployment.yml index 1191cb2..e72ffe6 100644 --- a/.github/workflows/mcp_dev_viirs_deployment.yml +++ b/.github/workflows/mcp_dev_viirs_deployment.yml @@ -2,7 +2,7 @@ name: mcp dev viirs deployment on: push: - branches: [viirs_orchestration] + branches: [dev] workflow_dispatch: env: diff --git a/.github/workflows/mcp_production_deployment.yml b/.github/workflows/mcp_production_deployment.yml deleted file mode 100644 index 56b4516..0000000 --- a/.github/workflows/mcp_production_deployment.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: MCP production deployment - -on: - release: - types: [ published ] - -env: - AWS_DEFAULT_REGION: us-west-2 - -# See https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#updating-your-github-actions-workflow -permissions: - id-token: write # required for requesting the JWT - contents: read # required for actions/checkout - -jobs: - unit-tests: - runs-on: ubuntu-20.04 - strategy: - matrix: - python: [3.8] - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install Tox - run: pip install tox - - name: Run Tox test environment - # Run tox using the version of Python in `PATH` - run: tox -e py - mcp-production-deployment: - strategy: - matrix: - python: [3.8] - runs-on: ubuntu-20.04 - needs: [unit-tests] - environment: - name: mcp-production - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install tox - run: pip install tox - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME_ARN }} - role-session-name: ${{ github.actor }} - aws-region: us-west-2 - - name: Convert secrets to environment variables - env: - SECRETS_JSON: ${{ toJson(secrets) }} - run: | - while read -rd $'' line; do - echo "$line" >> $GITHUB_ENV - done < <( - jq -r <<<"$SECRETS_JSON" 'to_entries|map("\(.key)=\(.value)\u0000")[]' - ) - - name: Convert vars to environment variables - env: - VARS_JSON: ${{ toJson(vars) }} - run: | - while read -rd $'' line; do - echo "$line" >> $GITHUB_ENV - done < <( - jq -r <<<"$VARS_JSON" 'to_entries|map("\(.key)=\(.value)\u0000")[]' - ) - - name: Deploy with tox - run: tox -v -e dev -r -- deploy --require-approval never - - name: Run DB setup - run: | - setupdb=$(aws cloudformation describe-stacks \ - --stack-name $HLS_STACKNAME \ - --query "Stacks[0].Outputs[?OutputKey=='setupdbexport'].OutputValue" \ - --output=text - ) - aws lambda invoke --function-name=$setupdb response.json diff --git a/.github/workflows/mcp_production_viirs_deployment.yml b/.github/workflows/mcp_production_viirs_deployment.yml index 62ca418..5a7a9c8 100644 --- a/.github/workflows/mcp_production_viirs_deployment.yml +++ b/.github/workflows/mcp_production_viirs_deployment.yml @@ -1,6 +1,8 @@ name: mcp production viirs deployment on: + release: + types: [ published ] workflow_dispatch: env: diff --git a/.github/workflows/production_deployment.yml b/.github/workflows/production_deployment.yml deleted file mode 100644 index 9063c37..0000000 --- a/.github/workflows/production_deployment.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: production deployment - -on: - release: - types: [ published ] - -jobs: - unit-tests: - runs-on: ubuntu-20.04 - env: - AWS_DEFAULT_REGION: us-west-2 - strategy: - matrix: - python: [3.8] - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Install Tox - run: pip install tox - - name: Run Tox test environment - # Run tox using the version of Python in `PATH` - run: tox -e py - production-deployment: - strategy: - matrix: - python: [3.8] - runs-on: ubuntu-20.04 - needs: [unit-tests] - environment: - name: production - env: - AWS_DEFAULT_REGION: us-west-2 - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Install tox - run: pip install tox - - name: Configure awscli - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-2 - - name: Convert to environment variables - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} - run: | - while read -rd $'' line - do - echo "$line" >> $GITHUB_ENV - done < <(jq -r <<<"$SECRETS_CONTEXT" \ - 'to_entries|map("\(.key)=\(.value)\u0000")[]') - - name: Deploy with tox - run: tox -e dev -r -- deploy --require-approval never - - name: Run DB setup - env: - HLS_STACKNAME: ${{ secrets.HLS_STACKNAME }} - run: | - setupdb=$(aws cloudformation describe-stacks --stack-name \ - $HLS_STACKNAME --query \ - "Stacks[0].Outputs[?OutputKey=='setupdbexport'].OutputValue" \ - --output=text) - aws lambda invoke --function-name=$setupdb response.json diff --git a/.github/workflows/tox_tests.yml b/.github/workflows/tox_tests.yml index 3268843..59ed7db 100644 --- a/.github/workflows/tox_tests.yml +++ b/.github/workflows/tox_tests.yml @@ -1,4 +1,4 @@ -name: Tox tests +name: tox tests on: [push] diff --git a/README.md b/README.md index 212b17d..a16639c 100644 --- a/README.md +++ b/README.md @@ -47,42 +47,24 @@ Display a diff of the current deployment and any changes created. source environment.sh && tox -e dev -r -- diff ``` -## Deploy - -Deploy current version of stack: - -```plain -source environment.sh && tox -e dev -r -- deploy -``` - The repository is configured to create automatic deployments to the -`hls-development` stack when PRs are merged into the `dev` branch. This +`hls-mcp-development-viirs` stack when PRs are merged into the `dev` branch. This deployment uses [Github Actions Environments](https://docs.github.com/en/actions/reference/environments) to manage the environment configuration rather than the `environment.sh`. -Deployments to GCC have restrictions over creating VPCs and the types of AMIs -which can be utilized. To deploy to GCC your shell will require the following +Deployments to MCP have restrictions over creating VPCs and the types of AMIs +which can be utilized. To deploy to MCP you will require the following environment settings: ```plain export GCC=true export AWS_DEFAULT_REGION=us-west-2 -export HLS_GCC_ACCOUNT= -export HLS_GCC_VPCID= +export HLS_GCC_ACCOUNT= +export HLS_GCC_VPCID= export HLS_GCC_BOUNDARY_ARN= ``` -## Setup Logging Database - -After `deploy` is run and the stack is created run: - -```plain -source environment.sh && scripts/setupdb.sh -``` - -To bootstrap the logging database. - ## Development For active stack development run: