Deploy a spring boot rest application with google cloud - google-app-engine

I trying so much to deploy a spring boot application on google cloud app engine, after so many documents here im.
when i try to deploy a simple spring boot application like the exemples its works but with my app the deploy process take a long time and i got 502 error. looking at app engine logs my application keep on infinit reboot loop.
my app.yaml :
runtime: custom
env: flex
My docker file:
FROM gcr.io/google_appengine/openjdk
VOLUME /tmp
ADD vaptuber-jjaerp-0.0.1-SNAPSHOT.jar app.jar
CMD [ "java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
and here is the app log:
https://drive.google.com/file/d/0B1gG3dVgi0WoTzM2RXlaQjJka0E/view?usp=sharing
I has deployed a fat jar to test, in local machine works fine.

Spring Cloud GCP was just recently announced. It should help to better integrate your Spring application with GCP. Take a look at the following resources.
Announcing Spring Cloud GCP
Spring Cloud GCP

It sounds like your application is running out of memory and being killed and restarted by the OOM Killer. The solution is as simple as increasing the memory on the App Engine VM. See my answer here:
Deploy a SpringBoot / Angular 4 on Google App Engine with maven

Related

Steps to setup angular app in Google Cloud App Engine and Go Daddy

I want to deploy an angular app is n Google Cloud Platform App Engine, and link to my domain in Go Daddy.
I have done the domain verification in Google, and able to do npm start in cloud shell and web preview it, however need help with below:
1. How to persist the deployment even if I close the shell? Adding & to make it a background process enough?
2. What should be the values in Go Daddy DNS configurations
3. If I deploy on another port, such as 4200, how to forward http, https, and www to that port?
Any help us much appreciated, thanks in advance.
When you do npm start in the Cloud Shell to web preview it you’re only running the app “locally” in Cloud Shell, you’re not actually deploying it to App Engine. To deploy your app you should use the gcloud app deploy command.
The general steps on how to deploy the app in App Engine are documented here
Regarding the DNS values to map your custom domain please follow the steps 4, 5 and 6 in this documentation
In order to understand how Port forwarding works in App Engine I recommend checking this document.
If you are interested there's also a codelab where you can go through all the steps on deploying an Angular app to App Engine.

Deploy multiple applications from same project

How can I deploy multiple applications from same or different language/runtime originating from a single project in google cloud app engine?
Deploying Multiple Services to Google Cloud App engine.
Create the following files in the app root directory
Create app.yaml file with content:
runtime: nodejs14
service: default
Create myserviceone.yaml file with content:
runtime: nodejs14
service: myserviceone
Create myservicetwo.yaml file with content:
runtime: nodejs14
service: myservicetwo
Deploy using command
gcloud app deploy --project your_project_id app.yaml myserviceone.yaml myservicetwo.yaml
This will deploy the default service as well as my service one and my service two. Check out your cloud console.
You can access them using:
https://myserviceone-dot-yourProjectID.appspot.com/ or
http://myserviceone.yourProjectID.appspot.com/
https://myservicetwo-dot-yourProjectID.appspot.com/ or
http://myservicetwo.yourProjectID.appspot.com/
Today, App Engine has a one-to-one correspondence with a Google Cloud Console project. You cannot deploy multiple "apps" in the same project. However, you might still be able to do what you want depending on your application(s).
App Engine has the concept of "services," which are independent aspects of your application. Your App Engine app can have many services and each service can have its own language/runtime and even be on different App Engine environments.
You could have say a Python service on App Engine standard environment that is used to serve your simple Flask site, could have service that serves an API written in Java 8 on the Standard Environment, and could have yet another service in say Node.js running in the App Engine flexible environment.
Your "default" service is defined in your app.yaml file. Your other services can be defined in different folders and can have either an app.yaml with their service definitions or you could name them something else like backend.yaml. See this simple Python project for the layout of the configuration files.
For more conceptual information about services on App Engine, see Microservices Architecture on Google App Engine.

Deploy existing Java web application on Google App engine or Amazon AWS

We have a Java web application developed locally without using any GAE components / AWS components (GAE/AWS SDK etc.,).
We used the following technologies: Java, Spring framework, MySQL Database, Hibernate ORM, Jersy REST library, Tomcat web server.
Our application is up & running fine on our local server.
Now my question is
If I deploy the existing WAR to Google App Engine/ Amazon AWS will it start working right away OR Do I have to make extra changes to my code and deploy new WAR file in order to make it working on Google App Engine / Amazon AWS?
If I want to start a new java web project(using same configuration I mentioned above) that will eventually run on Google App Engine / Amazon AWS, What is the best strategy:
Should I start my development using Google App Engine / Amazon AWS from the beginning ? or just deploy when everything is done?
EDIT : I just wanted to know about GAE and/or AWS in general.
It looks like Google Computer Engine is more suited if you rely on a relational database. Google app engine uses a NoSQL datastore that is not compatible with your relational scheme.

How to deploy a SpringBoot REST Application to Google App Engine?

Tried
Subscribed trial for GoogleAppEngine.
1. INSTALLED GOOGLE APP ENGINE SDK
2. Downloaded the sample Java started code and deployed it. Working fine.
3. Used $appcfg.sh -A <appname> update target/appengine-try-java-1.0 to deploy
4. In this case, its a folder with all the webapp related stuffs
Question
In my case, I have a spring boot application which generates a jar file. It runs with a embedded container and I believe Google may have an alternate to deploy using Docker or some other way. But how?
There is no pointer or any details on how to run this in Google managed platform as far as I searched.
Any help or reference to documentation!! Alternates??
You can now use Google App Engine Java Flexible Environment - Java 8 Runtime:
https://cloud.google.com/appengine/docs/flexible/java/dev-java-only
It is Docker based
UPDATE:
You can now use Java 8 in App Engine Standard Environment:
Tutorial:
https://codelabs.developers.google.com/codelabs/cloud-app-engine-springboot/index.html
Example:
https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard
Blog post:
https://cloudplatform.googleblog.com/2017/09/Java-8-on-App-Engine-Standard-environment-is-now-generally-available.html
Google App Engine still uses Servlet 2.5 that is below the requirements of Spring Boot (i.e. Servlet 3.0).
There is a way to workaround that, check the documentation for more details
Spring Boot requires Servlet 3.0 which GAE does not have. WorkAround is to have a "spring-boot-legacy" dependency. You can check further how to implement: https://github.com/scratches/spring-boot-sample-gae

Google App Engine's Web Application server and Apache Tomcat

I read this sentence in google resources for GAE : "Google App Engine has it's own Web Application Server for simulating in desktop environment", so, my question is: Can I deploy Google App Engine apps (in .war format) on TomCat?
Thanks for any help!
the short answer is: it depends
according to the app engine doc:
App Engine Java applications use the Java Servlet standard for
interacting with the web server environment.
so for a simple servlet app, it can be run on tomcat
but
The App Engine runtime environment imposes some constraints to ensure
that your app can be scaled to multiple instances on App Engine's
distributed infrastructure
if you have used apis from app engine such as UserService, or Datastore then you are not able to run it on tomcat. in this case, you can use the development web server from app engine sdk for dev and test purpose.

Resources