$ gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [default] are:
core:
account: 내이메일주소@gmail.com
disable_usage_reporting: 'True'
project: my-project
Pick configuration to use:
[1] Re-initialize this configuration [default] with new settings
[2] Create a new configuration
Please enter your numeric choice: 1
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
나같은 경우는 이전에 했던게 있어서, 1번선택, 새로하는사람은 2번선택한다.
그 다음에, 계정선택
Choose the account you would like to use to perform operations for
this configuration:
[1] 내이메일@gmail.com
[2] Log in with a new account
Please enter your numeric choice: 1
You are logged in as: [내이메일@gmail.com].
위처럼 로그인된 계정을 쓸지, 새로운 계정으로 할지 물어본다.
당연히 1번
그다음에, 프로젝트 선택
Pick cloud project to use:
[1] my-project1
[2] my-project2
[3] my-project3
[4] my-project4
[5] Create a new project
Please enter numeric choice or text value (must exactly match list
item): 1
Your current project has been set to: [my-project1].
GCP에 생성된 프로젝트 목록이 뜨고, 어떤 프로젝트를 선택할지 고르라고 한다.
여기서 아까 만들어 놓은 프로젝트 번호를 선택하면, 아래같은 설명이 나오고 끝난다.
Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use m20korea@gmail.com by default
* Commands will reference project `m20-center` by default
Run `gcloud help config` to learn how to change individual settings
This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.
Some things to try next:
* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
Updates are available for some Cloud SDK components. To install them,
please run:
$ gcloud components update
7. 배포하기
이제 마지막이다. 배포하기다.
> gcloud app deploy
만 치면, 바로 배포하지만, 나같은 경우는 yaml파일도 프로젝트별로 있어서, 명령어에 직접 다 써준다.
> gcloud app deploy app.yaml --project=project1
yaml파일명 프로젝트명
이렇게 하면 굳이 app.yaml파일로 안하고, 내가 원하는 파일명으로 만들어 놓아도 되고, 프로젝트도 선택해서 배포하게 된다.
$ gcloud app deploy
Services to deploy:
descriptor: [/Users/Documents/GitHub/workspace/project1/dist/apps/project1/app.yaml]
source: [/Users/Documents/GitHub/workspace/project1/dist/apps/project1]
target project: [project1]
target service: [default]
target version: [20210125t152323]
target url: [http://project1.du.r.appspot.com]
Do you want to continue (Y/n)? Y
Beginning deployment of service [default]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 166 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...done.
Setting traffic split for service [default]...done.
Deployed service [default] to [http://project1.du.r.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse
머...대충 경로들 나오고, 배포시 url 정보 나오고, 배포가 끝나면, 아래 설명 나오고 끝난다.
대부분, 프로젝트명.알파벳.알파벳.appspot.com 이렇게 만들어진다.
근데, 만약 프로젝트명이 중복이 없으면, 프로젝트명.appspot.com 으로 도 만들어진다.
으아...진짜 이거 쓰다가..... app.yaml 설정때문에 몇일만에 다쓴다...
api빌드해서 배포할때랑, web 배포하는게 좀 틀려서...좀 해맸다.
Api같은 경우는 package.json에 node main.js 써주고, main.js로 실행하니까, yaml에 따로 세팅할게 없었는데...
Web배포같은 경우는 빌드한거를 올리니....Yaml에 index.html 위치를 써줘야한다.