Skip to content

Commit 94e00e8

Browse files
authored
Merge pull request #77 from infinum/feature/ecs
Rework deploy staging ecs and remove build and deploy
2 parents 2cbcc79 + 35951f4 commit 94e00e8

File tree

2 files changed

+6
-120
lines changed

2 files changed

+6
-120
lines changed

Diff for: .github/workflows/build-and-push.yml

-35
This file was deleted.

Diff for: .github/workflows/deploy-staging-ecs.yml

+6-85
Original file line numberDiff line numberDiff line change
@@ -69,111 +69,32 @@ jobs:
6969
aws_ecr_account_id: ${{ needs.context.outputs.aws_ecr_account_id }}
7070
secrets: inherit
7171

72-
run-migrations:
73-
name: Run Prisma db migrations
74-
runs-on: ubuntu-latest
75-
needs: [context, build-push-image]
76-
environment: ${{ inputs.environment }}
77-
steps:
78-
- name: Checkout code
79-
uses: actions/checkout@v2
80-
- name: Set up Node
81-
uses: actions/setup-node@v2
82-
with:
83-
node-version: '20'
84-
- name: Install dependencies
85-
run: npm ci
86-
- name: Open SSH tunnel
87-
env:
88-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
89-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
90-
AWS_REGION: ${{ needs.context.outputs.aws_region }}
91-
run: |
92-
aws ssm start-session \
93-
--target i-0cb09814d228ec31d \
94-
--document-name AWS-StartPortForwardingSessionToRemoteHost \
95-
--parameters host="${{ secrets.JUMPHOST_HOST }}",portNumber="5432",localPortNumber="5432" &
96-
sleep 10
97-
- name: Run migrations
98-
env:
99-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
100-
run: npx prisma migrate deploy
101-
102-
run-migrations-manual:
103-
name: Run Prisma db migrations
104-
runs-on: ubuntu-latest
105-
needs: [context, build-push-image-manual]
106-
environment: ${{ inputs.environment }}
107-
steps:
108-
- name: Checkout code
109-
uses: actions/checkout@v2
110-
- name: Set up Node
111-
uses: actions/setup-node@v2
112-
with:
113-
node-version: '20'
114-
- name: Install dependencies
115-
run: npm ci
116-
- name: Open SSH tunnel
117-
env:
118-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
119-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
120-
AWS_REGION: ${{ needs.context.outputs.aws_region }}
121-
run: |
122-
aws ssm start-session \
123-
--target ${{ vars.JUMPHOST_ID }} \
124-
--document-name AWS-StartPortForwardingSessionToRemoteHost \
125-
--parameters host="${{ secrets.JUMPHOST_HOST }}",portNumber="${{ vars.JUMPHOST_PORT }}",localPortNumber="${{ vars.SERVER_PORT }}" &
126-
- name: Run migrations
127-
env:
128-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
129-
run: npx prisma migrate deploy
130-
13172
deploy-image:
13273
if: ${{ github.event_name == 'push' }}
13374
name: Deploy backend
13475
uses: infinum/devops-pipelines/.github/workflows/[email protected]
135-
needs: [context, build-push-image, run-migrations]
76+
needs: [context, build-push-image]
13677
with:
13778
image_uri: ${{ needs.context.outputs.aws_ecr_uri }}:${{ github.sha }}
13879
environment: ${{ inputs.environment }}
13980
aws_region: ${{ needs.context.outputs.aws_region }}
14081
ecs_cluster: ${{ needs.context.outputs.aws_ecs_cluster }}
141-
ecs_service: js-revisor
82+
ecs_service: js-react-example
14283
task_def_path: .aws/ecs/task-definition-app-staging.json
143-
container_name: js-revisor
84+
container_name: js-react-example
14485
secrets: inherit
14586

14687
deploy-image-manual:
14788
if: ${{ github.event_name == 'workflow_dispatch' }}
14889
name: Deploy backend
14990
uses: infinum/devops-pipelines/.github/workflows/[email protected]
150-
needs: [context, build-push-image-manual, run-migrations-manual]
91+
needs: [context, build-push-image-manual]
15192
with:
15293
image_uri: ${{ needs.context.outputs.aws_ecr_uri }}:${{ inputs.custom_tag }}
15394
environment: ${{ inputs.environment }}
15495
aws_region: ${{ needs.context.outputs.aws_region }}
15596
ecs_cluster: ${{ needs.context.outputs.aws_ecs_cluster }}
156-
ecs_service: js-revisor
97+
ecs_service: js-react-example
15798
task_def_path: .aws/ecs/task-definition-app-staging.json
158-
container_name: js-revisor
159-
secrets: inherit
160-
161-
notify-deployment-automatic:
162-
name: Send Slack notification
163-
uses: infinum/devops-pipelines/.github/workflows/[email protected]
164-
needs:
165-
[
166-
context,
167-
build-push-image,
168-
build-push-image-manual,
169-
run-migrations,
170-
run-migrations-manual,
171-
deploy-image,
172-
deploy-image-manual,
173-
]
174-
with:
175-
channel: project-js-revisor-notifications
176-
outcome: ${{ needs.build-push-image.result == 'success' || needs.build-push-image-manual.result == 'success'}}
177-
color: ${{ needs.build-push-image.result == 'success' || needs.build-push-image-manual.result == 'success' }}
178-
title: "[Staging] deploy js-revisor: ${{ needs.build-push-image.result == 'success' || needs.build-push-image-manual.result == 'success'}}"
99+
container_name: js-react-example
179100
secrets: inherit

0 commit comments

Comments
 (0)