Selaa lähdekoodia

Remove pioneer, change job name, check if CF stack exists

Anuj Bansal 3 vuotta sitten
vanhempi
commit
65396ad8b6

+ 26 - 1
.github/workflows/deploy-playground.yml

@@ -34,7 +34,7 @@ defaults:
 
 jobs:
   deploy-playground:
-    name: Create an EC2 instance and configure docker-compose stack
+    name: Deploy Playground Job
     runs-on: ubuntu-latest
     env:
       STACK_NAME: ${{ github.event.inputs.stackNamePrefix }}-${{ github.event.inputs.branchName }}-${{ github.run_number }}
@@ -52,6 +52,16 @@ jobs:
           aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
           aws-region: us-east-1
 
+      - name: Check if CloudFormation stack exists
+        id: stack_exists
+        run: |
+          if aws cloudformation describe-stacks --stack-name ${{ env.STACK_NAME }} >/dev/null 2>/dev/null; then
+            echo "Stack already exists"
+            exit 1
+          else
+            echo "Stack does not exist"
+          fi
+
       - name: Deploy to AWS CloudFormation
         uses: aws-actions/aws-cloudformation-github-deploy@v1
         id: deploy_stack
@@ -74,3 +84,18 @@ jobs:
           options: |
             --extra-vars "git_repo=${{ github.event.inputs.gitRepo }} \
                           branch_name=${{ github.event.inputs.branchName }}"
+
+      - name: Save the endpoints file as an artifact
+        uses: actions/upload-artifact@v2
+        with:
+          name: endpoints
+          path: devops/aws/endpoints.txt
+
+      - name: Delete CloudFormation Stack if any step failed
+        # Skip if stack already existed
+        if: failure() && steps.stack_exists.outcome != 'failed'
+        run: |
+          echo "Deleting ${{ env.STACK_NAME }} stack"
+          aws cloudformation delete-stack --stack-name ${{ env.STACK_NAME }}
+          echo "Waiting for ${{ env.STACK_NAME }} to be deleted..."
+          aws cloudformation wait stack-delete-complete --stack-name ${{ env.STACK_NAME }}

+ 23 - 11
devops/aws/deploy-playground-playbook.yml

@@ -106,16 +106,28 @@
         caddy_systemd_capabilities_enabled: true
         caddy_update: false
 
+    - name: Set endpoints
+      set_fact:
+        all_services: |
+          The services should now be accesible at:
+
+          WebSocket RPC: wss://{{ nip_domain }}/ws-rpc
+          HTTP RPC: https://{{ nip_domain }}/http-rpc
+          Colossus: https://{{ nip_domain }}/colossus-1
+          Distributor: https://{{ nip_domain }}/distributor-1
+          GraphQL server: https://{{ nip_domain }}/query-node/server/graphql
+          Indexer: https://{{ nip_domain }}/query-node/indexer/graphql
+          Member Faucet: https://{{ nip_domain }}/member-faucet/register
+          Orion: https://{{ nip_domain }}/orion/graphql
+      run_once: yes
+
     - name: Print endpoints
       debug:
-        msg:
-          - 'The services should now be accesible at:'
-          - 'Pioneer: https://{{ nip_domain }}/'
-          - 'WebSocket RPC: wss://{{ nip_domain }}/ws-rpc'
-          - 'HTTP RPC: https://{{ nip_domain }}/http-rpc'
-          - 'Colossus: https://{{ nip_domain }}/colossus-1'
-          - 'Distributor: https://{{ nip_domain }}/distributor-1'
-          - 'GraphQL server: https://{{ nip_domain }}/query-node/server/graphql'
-          - 'Indexer: https://{{ nip_domain }}/query-node/indexer/graphql'
-          - 'Member Faucet: https://{{ nip_domain }}/member-faucet/register'
-          - 'Orion: https://{{ nip_domain }}/orion/graphql'
+        msg: '{{ all_services }}'
+      run_once: yes
+
+    - name: Save output as file
+      copy:
+        content: '{{ all_services }}'
+        dest: 'endpoints.txt'
+      delegate_to: localhost

+ 0 - 5
devops/aws/templates/Playground-Caddyfile.j2

@@ -42,8 +42,3 @@
     uri strip_prefix /member-faucet
     reverse_proxy localhost:3002
 }
-
-# Pioneer
-{{ nip_domain }}/* {
-    reverse_proxy localhost:3000
-}