Deploying a Hilla Application to Google Cloud
This tutorial shows you how to deploy a Hilla application to Google Cloud 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 billing enabled.
Step 1: Install and Set Up the 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 Hilla project and unpack the downloaded zip into a folder on your computer.
npx @hilla/cli init my-app
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 will be 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 will 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 will then be asked to select a region. You may want to choose the region that’s geographically closest to your users.
Step 5: Create a Production Build
Open the project directory from a terminal window, and enter the following command to generate a
JAR file of your application:
mvn package -Pproduction
Step 6: Deploy the Application
From a terminal window, in the project root directory, enter the following command to deploy the application to Google Cloud:
gcloud app deploy target/myapp-1.0-SNAPSHOT.jar
When the deployment has finished, the application URL will be displayed in the logs.
Ensure that Google Cloud billing is enabledIf the deployment fails with an error similar to