how to specify github pw when using “gcloud app de

2019-08-16 04:42发布

My node app is on the big side, so it is split into a number of npm packages. These packages are hosted in private repos on github.

Locally on my pc, I clone the repo, npm init, get prompted for password, npm run and all is good.

Now I'm trying to deploy to google cloud app engine (newbie in google cloud). Tutorial says to add a file called app.yaml with content

env: flex
runtime: nodejs

Then I enter "gcloud app deploy". The first reported error is

npm ERR! /usr/bin/git ls-remote -h -t https://github.com/johngrabner/moch_time.git

How do I provide my password for gcloud so it can pull private packages?

Or, is "gcloud app deploy" just not mature enough?

Or, is using and storing private npm packages in github a strange way of structuring my project?

2条回答
做自己的国王
2楼-- · 2019-08-16 04:56

I did some research and found that Docker / Kubernetes is probably a better choice for deployment. A number of courses and online video listed "no more, it works on my machine, but not in production".

You package your app in Docker, where you specify the exact OS, middleware, etc. Test on your machine. Then deploy this image to Azure, AWS, or Google. Kubernetes manages the spaning of these images.

查看更多
唯我独甜
3楼-- · 2019-08-16 05:15

The gcloud command does not provide an option to include a password when deploying an app. If you want to specify your credentials to access your private GitHub repositories, you can follow this link.

Before starting with the steps indicated in the previous tutorial, you should generate a new SSH for GitHub authentication. The steps to do so are here.

Alternatively, you can connect your GitHub repo to a GCP repository using Source Repositories (follow this link to learn how to do it). This also allows to store your credentials for further use.

查看更多
登录 后发表回答