3. Milestones
1. Create your project
2. Install the software needed for programming
3. Write your web service
4. Deploy your web service
5. Additionally - Continued work in STS4
4. Understand the basics concepts before
you start
1. Google App Engine GAE (at https://cloud.google.com/appengine,
distinguish at the outset the Google Web Toolkit GWT)
2. JAVA (this is one of the languages supported by GAE, the others are for
example Python, Go etc. https://www.java.com/ )
3. Spring (there are many projects related to this concept, e.g. spring
framework, spring boot and others https://spring.io/projects )
4. Apache Maven and Apache Tomcat (https://www.apache.org/ )
5. REST (Representational State Transfer,
https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm )
5. Create your project (an option based on a web
browser is described, another is based on the
google CLI)
1. Log in to your google account (or create an account)
https://bit.ly/3GgoEYF
2. Create your first Google cloud project (https://bit.ly/3VqMCVg )
3. Activate your billing account (you get $300 initially,
https://bit.ly/3WJHgFY )
4. Enable the API (https://bit.ly/3ji2Dzu )
5. Create an App Engine application for your Cloud project
(https://bit.ly/3jlLzsl )
6. Install the software needed for
programming (step 1 -2)
1. Google Cloud CLI (https://cloud.google.com/sdk/docs/install )
• You must initialize it https://cloud.google.com/sdk/docs/initializing
(include command: gcloud components update)
2. Java SE 17 Development Kit
(https://www.oracle.com/java/technologies/downloads/ )
7. Install the software needed for
programming (step 3)
3. Apache Maven (https://maven.apache.org/download.cgi )
• To deploy using Maven, you will need to add the App Engine Maven Plugin
to yout pom.xml file
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.4.4</version>
</plugin>
8. Write your first web service, step 1 - 3
(locally on your computer)
1. Go to the Spring Iinitializr
page (https://start.spring.io/ )
2. Generate a Spring Boot
project (options in this case
are: maven, java 17)
3. Unpack it in a local folder
(to user's home directory
.m2repository)
9. Write your first web service, step 4
4. Modify the main class
SpringbootApplication.java (note
the filename - which is different by
default)
import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class SpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootApplication.class, args);
}
@GetMapping("/")
public String hello() {
return "Hello world!";
}
}
„The modified class is a controller
that starts Spring Boot's embedded
Tomcat server and responds
to GET requests at the root path
('/') with the text "Hello world!”
10. Write your first web service, step 4
1. Running the server locally (google CLI)
mvn spring-boot:run
2. In your web browser, enter the following address:
http://localhost:8080
! The Hello World message from the sample app displays on the page. In
your terminal window, press Ctrl+C to exit the web server.
11. Deploy your web service (to the cloud
platform) step 1-2
1. Add an app.yaml file to deploy your service to App Engine
(to user's home directory.m2repositoryspringbootsrcmainappengine)
2. Edit an app.yaml file
runtime: java17
12. Deploy your web service (to the cloud
platform) step 3
1. In your java folder, where your Maven pom.xml file is located, run the
followien command in you terminal:
gcloud app deploy
2. Viewing your service, use the following command:
gcloud app browse
13. Continue work in STS4 (step 1)
1. Download and install STS 4
https://spring.io/tools
2. Import your first project
(file>import>Maven>Existing
Projects)
14. Continue work in STS4 (step 2)
1. Make any changes, e.g. the text
„Hello world! STS4” (it was in
SpringbootApplication.java class)
2. Check on your local server to see if
it works
• Run „Spring Boot App” (from menu
STS4)
• Check website (by default it is an
adress http://localhost:8080/)
15. Continue work in STS4 (step 3)
1. In google CLI deploy your service (but if you have been logged out in
the meantime, you will have to log in and set up the project).
• gcloud auth login
• gcloud config set project …
• gcloud app deploy (make sure you are in the project directory where the
pom.xml file is located)
2. Check you project address
• gcloud app browse
16. Source
• Java 11/17 runtime environment
https://cloud.google.com/appengine/docs/standard/java-gen2/runtime
• and others mentioned in the presentation
17. Thank you for your attention! Please
submit any comments on the
software-engineers.org
PhD Artur Machura
arturmachura.info