Load balancer and serverless NEG isn't working - google-app-engine

I configured Google Cloud load balancer and serverless NEG to make my app engine work in static IP, but it's not working anyway. Here are the commands I used for configuration.
gcloud beta compute network-endpoint-groups create get-payqin-serverless-neg \
--region=europe-west1 \
--network-endpoint-type=SERVERLESS \
--app-engine-app
gcloud compute backend-services create get-payqin-backend-service \
--global
gcloud beta compute backend-services add-backend get-payqin-backend-service \
--global \
--network-endpoint-group=get-payqin-serverless-neg \
--network-endpoint-group-region=europe-west1
gcloud compute url-maps create get-payqin-url-map \
--default-service get-payqin-backend-service
All those commands were just copied from google cloud documentation, only minor changes with parameters, so I think nothing is wrong with these commands.
The project has only one default service in Google App Engine, and it was deployed in europe-west region. I found that europe-west region is same as europe-west1 region in GAE.
I checked the app deployed in GAE was surely working from browser. The load balancer surely has its static IP assigned in frontend, but "http://{ip}" on browser shows 404 error page!
I can't figure out what's wrong with my configuration.
Please help me with this one.
Thank you in advance!

Sorry for the late answer. I finished the configuration. The purpose is to make load balancing IP accessible from the internet, and the IP is routed to GAE.
I had to change static IP from the global type to regional. And the region should be in the same region as GAE instance.

Related

How do you serve a website from GCP app engine?

I have set up a Node.js server in Google Cloud Platform App Engine, and have also configured a custom domain, which is correctly configured and has a SSL cert.
However, I can't figure out how to actually serve through the domain.
In the GCP terminal, run this command:
gcloud app deploy
Since the server is already set up and working and the domain is already configured, that command is all that's needed to deploy.

Is it possible with Google App Engine to pull from a private docker registry?

Deploying an application to Google App Engine using the 'Custom Runtimes Flexible Environment' option requires a Dockerfile to build the docker image Google-side. I want to specify an image from my private Docker registry in the Dockerfile FROM clause. However, I cannot find any documentation or see any obvious options explaining where I would specify credentials for a private registry, or invoke a docker login. Without this, gcloud app deploy fails, of course, attempting to pull the image Google-side.
For example:
$ gcloud app deploy
...
Beginning deployment of service
...
Sending build context to Docker daemon 3.072kB
Step 1/1 : FROM registry.gitlab.com/my/private/registry/image:latest
Get https://registry.gitlab.com/v2/my/private/registry/image/manifests/latest: denied: access forbidden
The Dockerfile in this case would simply be:
FROM registry.gitlab.com/my/private/registry/image:latest
Does anyone out there know if this is possible with Google App Engine, and if so, how to configure it?
There is this Stackoverflow post that already covers the topic and provides an answer.
In fact, if you upload your image to Google Container Registry, it will be private and you will be able to control who has access to GCR by using IAM permissions. After that you can use it in your App Engine deployments:
gcloud app deploy --image-url $GCR_IMAGE_PATH

Deploy gcloud app to diff environments

I have an app that uses the following command to deploy a static app generated by create-react-app:
gcloud app deploy --project MY_PROJECT -v dev
After that, my app is available on myproject.appstop.com.
But I don't figure out how to deploy this app using a diff URL for each environment. Like.: dev.myproject.appspot.com, stg.myproject.com and so on.
If you know or have other ideas about how to solve this please share your thoughts.
It depends on what you understand by environment. I would definitely recommend you to create different projects for the different environments (my-project-dev, my-project-staging, my-project-test, my-project-prod...)
If you just want to have a different url for your deployment, you are doing ok by using the -v (version parameter).
Once you've deployed again:
gcloud app deploy --project MY_PROJECT -v test
you'll have both versions accessible at:
dev.myproject.appspot.com
test.myproject.appspot.com
Also, check Dan's answer below as it contains very relevant info.
To complement #MarCialR's answer, you can use SSL as well, but with *-dot-* URLs like https://test-dot-myproject.appspot.com, see Targeted routing.
But personally I'm not a big fan of a version-based environment, it brings trouble, see Continuous integration/deployment/delivery on Google App Engine, too risky?
I chose to implement environments at app level - each environment as a different app, each with its own URL. See Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?
Since I'm using a wildcard custom-domain SSL certificate I'm simply mapping the different apps (environments) to different hosts/subdomains in my custom domain - thus ensuring everything works as expected with a custom domain at every point in the CI/CD pipeline, no surprises in production.

Can i deploy local angularjs project to google application engine using ng deploy?

I created a project local to my Mac using "ng cli"; specifically, "ng new." The project runs locally, but I do not have a way to deploy it to my account in Google Cloud - Application Engine.
I followed Google's tutorial using gcloud commands in the cloud, but I prefer to use my local repository, etc. as I am running on "free" until I can afford to be commercially viable.
NOTE: You require a billing account to create a REPO in GCP.
I finally found this in Google Cloud Platform documents. So, basically, follow the instructions on Google's site (url below) to create a remote and local project. Write your code in the local repo, then push to the remote repo and deploy with gcloud commands (in a cloud shell in https://console.cloud.google.com) from the remote repository.
https://cloud.google.com/source-repositories/docs/quickstart
(Synopsis of the page intro ...)
Quickstart
This page shows you how to set up a GCP repository and use it as a remote for a local Git repository.
The sections below walk you through the steps of creating a local Git repository that contains files for a sample App Engine application, adding a GCP repository as a remote, and pushing the contents of the local repository.

deploy web application to google app engine on travis-ci - travis is asking for a password

I´m trying to deploy a web application to google app engine after successful build(I´m using maven on my project) and travis-ci is asking for my password. How can I input my password or specify somewhere else?
Based on the limited information you are giving us, I am guessing this is happening during the gcloud preview app deploy call.
Typically the docker TLS Verification will need a local public key for a Cert and this requires a passcode response. This situation can be avoided by providing the cert using the travis encrypt-file api and calling gcloud auth activate-service-account during the build. see gloud cli here
Please see the travis yml here for a full example
As always, post questions either here or github for additional walk-through questions.

Resources