아래와 같이 workflow를 작성했는데 이전에 발생했던 문제가 또 다시 발생
name : Build and Deploy to EC2
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
AUTO_DEPLOY:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Run scripts in server
uses: appleboy/ssh-action@master
with:
host: ${{secrets.HOST }}
username: ${{secrets.USERNAME }}
password: ${{secrets.PASSWORD }}
port: ${{secrets.PORT }}
timeout: 40s
script: ${{secrets.SCRIPT }}
script 파일에는
cd workflow-service
git pull origin main
npm install
npm run build
sudo pm2 restart
이렇게 작성해두었는데 stack overflow에서 찾아보니 빌드할 때 앞에서 했었던 node.js의 사용 메모리를 늘려주는 코드를 작성해야 한다고 함
수정 script
cd workflow-service
git pull origin main
export NODE_OPTIONS=--max_old_space_size=2048
npm install
npm run build
sudo pm2 restart
해당 오류는 수정됐으나
err: From https://github.com/toy-workflow-service/workflow-service
err: * branch main -> FETCH_HEAD
out: Already up to date.
out: up to date, audited 1141 packages in 3s
out: 179 packages are looking for funding
out: run `npm fund` for details
out: 13 vulnerabilities (2 moderate, 11 critical)
out: To address all issues possible (including breaking changes), run:
out: npm audit fix --force
out: Some issues need review, and may require choosing
out: a different dependency.
out: Run `npm audit` for details.
out: > work-flow@0.0.1 build
out: > nest build
2023/09/07 16:24:06 Process exited with status 1
err: error: missing required argument `id|name|namespace|all|json|stdin'
missing required argument 오류가 발생하여 해결예정,,
ssh - i key-pair.pem ubuntu@ip_address
키페어를 사용하여 아이피를 넣고 로그인 한 뒤
sudo 원하는 비밀번호 ubuntu
원하는 비밀번호를 설정!
sudo vi /etc/ssh/sshd_config
sshd_config파일을 열어 준 뒤 a or i를 눌러 입력모드로 전환 후 아래로 좀 내려가면
PasswordAuthentication yes
no로 되어있는 값을 yes로 변경해주고
PermitRootLogin prohibit-password
->
PermitRootLogin yes
prohibit-password를 지우고 yes로 변경하여 루트로그인을 허용함
이후 exit을 한 뒤
ssh ubuntu@ip_address
를 입력하면 패스워드를 입력하고 로그인 가능!