-
Notifications
You must be signed in to change notification settings - Fork 4
195 lines (164 loc) · 6.94 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Continuous Deployment of Production Build
on:
push:
branches:
- deployment
jobs:
deploy-question-service:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'backend/question-service'
steps:
- name: Checkout Question Service directory
uses: actions/checkout@v4
- name: create .env file for Question Service
run: |
touch .env
echo PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} >> .env
- name: Generate Question Service deployment package
run: zip -r question-service.zip .env controller db routes index.js package.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: g46-question-service
environment_name: g46-question-service-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: backend/question-service/question-service.zip
deploy-user-service:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'backend/user-service'
steps:
- name: Checkout User Service directory
uses: actions/checkout@v4
- name: create .env file for User Service
run: |
touch .env
echo PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} >> .env
echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env
- name: Generate User Service deployment package
run: zip -r user-service.zip .env config controller db routes index.js package.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: g46-user-service
environment_name: g46-user-service-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: backend/user-service/user-service.zip
deploy-matching-service:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'backend/matching-service'
steps:
- name: Checkout Matching Service directory
uses: actions/checkout@v4
- name: create .env file for Matching Service
run: |
touch .env
echo API_GATEWAY_URL=${{ secrets.REACT_APP_API_GATEWAY_URL }} >> .env
echo PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} >> .env
echo RABBIT_PROTOCOL=${{ secrets.RABBIT_PROTOCOL }} >> .env
echo RABBIT_HOSTNAME=${{ secrets.RABBIT_HOSTNAME }} >> .env
echo RABBIT_PORT=${{ secrets.RABBIT_PORT }} >> .env
echo RABBIT_USERNAME=${{ secrets.RABBIT_USERNAME }} >> .env
echo RABBIT_PASSWORD=${{ secrets.RABBIT_PASSWORD }} >> .env
- name: Generate Matching Service deployment package
run: zip -r matching-service.zip .env config controller handler index.js package.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: g46-matching-service
environment_name: g46-matching-service-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: backend/matching-service/matching-service.zip
deploy-collaboration-service:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'backend/collaboration-service'
steps:
- name: Checkout Collaboration Service directory
uses: actions/checkout@v4
- name: create .env file for Collaboration Service
run: |
touch .env
echo API_GATEWAY_URL=${{ secrets.REACT_APP_API_GATEWAY_URL }} >> .env
echo PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} >> .env
echo URL_QUESTION_SERVICE=${{ secrets.QUESTION_SERVICE_URL }} >> .env
echo RAPID_API_HOST=${{ secrets.RAPID_API_HOST }} >> .env
echo RAPID_API_KEY=${{ secrets.RAPID_API_KEY }} >> .env
echo RAPID_API_URL=${{ secrets.RAPID_API_URL }} >> .env
- name: Generate Collaboration Service deployment package
run: zip -r collaboration-service.zip .env config controller handler routes service index.js package.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: g46-collaboration-service
environment_name: g46-collaboration-service-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: backend/collaboration-service/collaboration-service.zip
deploy-api-gateway:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'backend/api-gateway'
steps:
- name: Checkout API Gateway directory
uses: actions/checkout@v4
- name: create .env file for API Gateway
run: |
touch .env
echo QUESTION_SERVICE_URL=${{ secrets.QUESTION_SERVICE_URL }} >> .env
echo USER_SERVICE_URL=${{ secrets.USER_SERVICE_URL }} >> .env
echo COLLABORATION_SERVICE_URL=${{ secrets.COLLABORATION_SERVICE_URL }} >> .env
- name: Generate API Gateway deployment package
run: zip -r api-gateway.zip .env handler routes services index.js package.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: g46-api-gateway
environment_name: g46-api-gateway-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: backend/api-gateway/api-gateway.zip
deploy-peerprep:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'frontend'
steps:
- name: Checkout Frontend directory
uses: actions/checkout@v4
- name: create .env file for Frontend
run: |
touch .env
echo REACT_APP_API_GATEWAY_URL=${{ secrets.REACT_APP_API_GATEWAY_URL }} >> .env
- name: Generate Frontend deployment package
run: zip -r frontend.zip .env public src Dockerfile package.json package-lock.json
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID_2 }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_2 }}
application_name: g46-peerprep
environment_name: g46-peerprep-env
version_label: G46-${{ github.run_number }}
region: ap-southeast-1
deployment_package: frontend/frontend.zip