F
Forumar12mo ago
luffy

Github action EC2 deployment

ကျနော်က nodejs service တစ်ခုကို ec2 instance ပေါ်ကို github action နဲ့သုံးဖို့လုပ်တာပါ။ အောက်ကတော workflow file ပါ။
name: Node App Deployment
on:
push:
branches:
- main
jobs:
build:
runs-on: self-hosted
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
steps:
- run: npm ci
- run: npm run build
- name: Write to .env file
run: echo "${ENV_FILE}" > .env
- name: Restart PM2 Process
run: |
source ~/env.sh
pm2 restart my-app
name: Node App Deployment
on:
push:
branches:
- main
jobs:
build:
runs-on: self-hosted
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
steps:
- run: npm ci
- run: npm run build
- name: Write to .env file
run: echo "${ENV_FILE}" > .env
- name: Restart PM2 Process
run: |
source ~/env.sh
pm2 restart my-app
ဖြစ်နေတာကဒီဟာက run တာက error တက်တာရှိဘူး။ဒါပေမဲ့ pm2 restart က server ပေါ်ကဟာကို restart လုပ်မသွားတာပဲ။ပြောင်းချင်ရင် server ပေါ်ကို ssh ဝင်ပြီ pm2 restart လုပ်မှပဲရတော့တယ်။ဘယ်နေရာမှာမှားနေလဲသိရင်ပြောပြပါဦးဗျ။
Solution:
try adding a working directory or enable watch in pm2
Jump to solution
4 Replies
Shaung Bhone
Shaung Bhone12mo ago
သိတဲ့လူများဖြေပေးကြပါဦးဗျ
Solution
Zaw Min Thein
Zaw Min Thein12mo ago
try adding a working directory or enable watch in pm2
luffy
luffy12mo ago
ဟုတ်အကို try ကြည့်လိုက်ပါမယ်
luffy
luffy12mo ago
@Zaw Min Thein ရသွားပြီဗျအကို watch flag ကို true ပေးထားလိုက်တာ ecosystem config ထဲမှာ
- name: Restart PM2 Process
run: |
source ~/env.sh
pm2 update
pm2 restart my-app
pm2 save
- name: Restart PM2 Process
run: |
source ~/env.sh
pm2 update
pm2 restart my-app
pm2 save
worlfow file ကိုတော့အောက်ကအတိုင်း update လုပ်လိုက်တာ pipeline က ok သွားပြီအကို
Want results from more Discord servers?
Add your server