Skip to content

Commit 52d8d9d

Browse files
committed
feat: merged main with ahmd
2 parents cecbe51 + d065736 commit 52d8d9d

51 files changed

Lines changed: 3091 additions & 1269 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-cd.yml

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,24 @@ jobs:
6868
name: live-service-prod
6969
path: live-service-prod
7070

71+
- name: Build gateway
72+
run: pnpm --filter gateway build
73+
74+
- name: Prepare gateway artifact
75+
run: |
76+
rm -rf gateway-prod
77+
mkdir gateway-prod
78+
cp -r gateway/dist gateway-prod/
79+
cp gateway/package.json gateway-prod/
80+
81+
- name: Upload gateway artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: gateway-prod
85+
path: gateway-prod
86+
7187
cd:
72-
name: CD (Deploy to EC2)
88+
name: CD (Deploy to Azure VM)
7389
needs: ci
7490
if: github.ref == 'refs/heads/main'
7591
runs-on: ubuntu-latest
@@ -87,32 +103,48 @@ jobs:
87103
name: live-service-prod
88104
path: live-service-prod
89105

90-
- name: Upload services to EC2
106+
- name: Download gateway artifact
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: gateway-prod
110+
path: gateway-prod
111+
112+
- name: Clean production directory
113+
uses: appleboy/ssh-action@v1.0.3
114+
with:
115+
host: ${{ secrets.AZURE_HOST }}
116+
username: ${{ secrets.AZURE_USER }}
117+
key: ${{ secrets.AZURE_KEY }}
118+
script: |
119+
rm -rf /var/www/confero/auth-service-prod
120+
rm -rf /var/www/confero/live-service-prod
121+
rm -rf /var/www/confero/gateway-prod
122+
123+
# Upload artifacts
124+
- name: Upload services to Azure
91125
uses: appleboy/scp-action@v0.1.7
92126
with:
93-
host: ${{ secrets.EC2_HOST }}
94-
username: ubuntu
95-
key: ${{ secrets.EC2_KEY }}
96-
source: |
97-
auth-service-prod
98-
live-service-prod
127+
host: ${{ secrets.AZURE_HOST }}
128+
username: ${{ secrets.AZURE_USER }}
129+
key: ${{ secrets.AZURE_KEY }}
130+
source: 'auth-service-prod,live-service-prod,gateway-prod'
99131
target: /var/www/confero
100132

101-
- name: Restart services
133+
# Restart services properly
134+
- name: Reload backend services
102135
uses: appleboy/ssh-action@v1.0.3
103136
with:
104-
host: ${{ secrets.EC2_HOST }}
105-
username: ubuntu
106-
key: ${{ secrets.EC2_KEY }}
137+
host: ${{ secrets.AZURE_HOST }}
138+
username: ${{ secrets.AZURE_USER }}
139+
key: ${{ secrets.AZURE_KEY }}
107140
script: |
108-
echo "Restarting auth-service"
109-
cd /var/www/confero/auth-service-prod
110-
npm install --omit=dev
111-
pm2 reload confero-auth-service || pm2 start dist/index.js --name confero-auth-service
112-
113-
echo "Restarting live-service"
114-
cd /var/www/confero/live-service-prod
115-
npm install --omit=dev
116-
pm2 reload confero-live-service || pm2 start dist/server.js --name confero-live-service
141+
142+
cd /var/www/confero
143+
144+
npm install --omit=dev --prefix auth-service-prod
145+
npm install --omit=dev --prefix live-service-prod
146+
npm install --omit=dev --prefix gateway-prod
147+
148+
pm2 reload ecosystem.config.js
117149
118150
pm2 save

0 commit comments

Comments
 (0)