node.js 프로잭트 gcloud app engine 업로드

최원상·2022년 12월 29일
0

1. gcloud cli 설치

https://cloud.google.com/sdk/docs/install?hl=ko

위 링크의 4단계 ./google-cloud-sdk/install.sh 명령어를 치면

Enter a path to an rc file to update, or leave blank to use [/[PATH]/.bashrc]:

라는 고 나오는데 사용하는 쉘의 rc파일 경로를 입력하면된다. ex) /etc/bash.bashrc

 73 # The next line updates PATH for the Google Cloud SDK.
 74 if [ -f '/home/server/wonsang/google-cloud-sdk/path.bash.inc' ]; then . '/home/server/wonsang/google-cloud-sdk/path.bash.inc'; fi
 75
 76 # The next line enables shell command completion for gcloud.
 77 if [ -f '/home/server/wonsang/google-cloud-sdk/completion.bash.inc' ]; then . '/home/server/wonsang/google-cloud-sdk/completion.bash.inc'; fi

그럼 해당 파일에 위와 같은 문구 추가되고 쉘을 다시 열면 gcloud 명령어 사용가능

쉘을 껏다 킬수 없는 상황이면 /[PATH]/google-cloud-sdk/bin/gcloud 를 알리아스로 등록하여 사용 가능

https://cloud.google.com/appengine/docs/legacy/standard/python/config/appref

2.app engine 등록

node 프로잭트 내 package.json 안애 아래와 같이 스크립트를 등록

"scripts": {
    "start": "node app.js",
    "[스크립트명]": "gcloud app deploy app_dev.yaml  --project='[프로잭트명]' "
    }

yaml 파일은 아래 링크를 참조하여 작성
https://cloud.google.com/appengine/docs/legacy/standard/python/config/appref

아래와 같이 실행 시키면 앱엔진에 프로잭트 업로드가 됩니다.

npm run [스크립트명 ]
profile
한 줄로는 안되지

0개의 댓글