There is an easy tutorial on how to run .NET Core apps on Google Developers Codelabs. As a supplement to that I have some bits to share that may be of use to you.
Please read Google’s tutorial on how to Deploy an ASP.NET Core app to App Engine which links to Build and launch an ASP.NET Core app from Google Cloud Shell.
The stuff that I share below is correct to my best knowledge as at time of writing.
You do not have to use Google Cloud Shell to run through their tutorial and you would very likely not use it for day-to-day development.
Their guide shows Eclipse Orion. Alternatively you can install Visual Studio Code, a free and open source text editor for assorted programming languages. It runs on Windows, Mac and Linux.
It is possible to use a newer version of the .NET Core runtime. Example:
FROM microsoft/dotnet:1.0.3-runtime
COPY . /app
WORKDIR /app
EXPOSE 8080/tcp
ENV ASPNETCORE_URLS http://*:8080
ENTRYPOINT ["dotnet", "HelloWorldAspNetCore.dll"]
The DLL filename is case sensitive on Linux.
When I attempted to run the following command:
gcloud beta app gen-config --custom
It spewed errors:
ERROR: gcloud failed to load (gcloud.beta.app.gen_config): Problem loading
gcloud.beta.app.gen_config: cannot import name DependencyWarning.
This usually indicates corruption in your gcloud installation or problems with
your Python interpreter.
Had to do the following to fix it:
gcloud components reinstall
The app.yaml
generated does not specify the underlying virtual machine specification required. The defaults are:
/_an/health
accesses in Stackdriver loggingBe sure to set the current project to the desired one or else the app will be deployed to the wrong project!
gcloud config set project <project name>
gcloud app deploy
They do tell you to enable billing for a reason. .NET Core (and Node JS) can run only on App Engine Flexible Environment which has no free tier and no SLA unlike the Standard Environment. Only Python, Java, PHP and Go are supported on Standard Environment.
Since auto scaling is enabled by default with minimum of 2 instances, the bill will be for 2 of course.
You can setup a custom domain pointing to your App Engine but their servers issue a redirect to [project].appspot-preview.com
. This has been reported in November 2016 by various people on Google Groups but still behaving the same when I tried just few days ago.
In short, App Engine Flexible Environment is good only for non-public facing services for now.
It is not possible to have multiple App Engines per Project.
Their tutorial described how to deploy a single service named default
. App Engine can have multiple services hosted within. The obvious benefit is cost saving and allows developers to build micro services that can be hosted on the same VM initially before moving out to scale in future.
Stopping the instance saves you the bulk of the cost. There is a bit of leftovers though. Cloud Storage is still keeping the deployed files. You will find 5 buckets being created under your Project. They are named:
[project].appspot.com
staging.[project].appspot.com
[region].artifacts.[project].appspot.com
vm-config.[project].appspot.com
vm-containers.[project].appspot.com
It was a good exercise to explore the offerings of App Engine. I like the auto scale functionality but really need them to stop redirecting to appspot-preview.com which is a deal breaker.