Deploying a Vaadin Application to Google Cloud
- Step 1: Install and Set Up Google Cloud SDK
- Step 2: Download a Starter App
- Step 3: Initialize a Google Cloud Project
- Step 4: Create an App Engine Instance
- Step 5: Set Up the App Engine Plugin for Maven
- Step 6: Create the app.yaml File
- Step 7: Enable Cloud Build
- Step 8: Deploy to Google App Engine
- Common Problems
This tutorial shows you how to deploy a Vaadin application to Google App Engine. Google Cloud has free-trial and free-tier offerings that you can read more about on the Google Cloud website.
Google Cloud account requiredTo complete this tutorial, you need to sign up for a Google Cloud account at https://cloud.google.com/. Your Google Cloud account should also have the billing enabled.
Step 1: Install and Set Up Google Cloud SDK
To begin, download and install the Google Cloud SDK.
After it’s installed, run the following command from a terminal window to add App Engine support for Java to the SDK.
gcloud components install app-engine-java
Step 2: Download a Starter App
Download a minimal Vaadin project and unpack the downloaded zip into a folder on your computer.
Due to issue 14164, you need to disable the |
Step 3: Initialize a Google Cloud Project
Open the project directory from a terminal window, and enter the following command to initialize a Google Cloud project:
If this is your first time running Google SDK, you’re asked to authenticate your account. When prompted to log in, enter 'Y' and allow the SDK to control your account in the opened browser window.
After authentication, you’re prompted to select a configuration. Enter '1' to select the default configuration, as in the following snippet:
Settings from your current configuration [default] are: accessibility: screen_reader: 'False' core: account: firstname.lastname@example.org disable_usage_reporting: 'True' Pick configuration to use:  Re-initialize this configuration [default] with new settings  Create a new configuration Please enter your numeric choice: 1
Step 4: Create an App Engine Instance
From a terminal window, in the project root directory, create a Google App Engine instance using the following command:
gcloud app create
You’re then be asked to select a region. You may want to choose the region that’s geographically closest to your users.
Step 5: Set Up the App Engine Plugin for Maven
Add the App Engine Maven plugin to your project’s
<plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>appengine-maven-plugin</artifactId> <version>2.4.3</version> <configuration> <projectId>GCLOUD_CONFIG</projectId> <version>GCLOUD_CONFIG</version> </configuration> </plugin>
Step 6: Create the app.yaml File
Next, you need to create an
Create a directory called
Create a file called
src/main/appengine. This file should have the following content.
You should change the java runtime version number (
java11) in the
yamlfile to match the value of the
<java.version>property in your
Step 7: Enable Cloud Build
You also need to enable Cloud Build.
https://console.cloud.google.com/cloud-build/builds?project=PROJECT_NAME, replacing PROJECT_NAME with your project name found at Google Cloud Resource Manager.
Step 8: Deploy to Google App Engine
Finally, you can build and deploy using a single command as follows:
mvn package appengine:deploy -Pproduction
When the deployment has finished, the application URL is displayed in the logs.
Ensure Google Cloud Billing is Enabled
If the deployment fails with an error similar to
ERROR: (gcloud.app.deploy) Error Response:  Access Not Configured., then ensure that your Google Cloud account has billing enabled.
After it’s enabled, try to deploy again.
If you notice log messages similar to
Exceeded soft memory limit of 256 MB with X MB, this means your instance has ran out of RAM. You should consider upgrading to a larger App Engine instance that fits your needs.
|Be mindful of costs when upgrading. Larger instances most likely incur more fees.|