-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Voorbereiden voor Google Cloud Engine
- Loading branch information
1 parent
f34e838
commit dc8f80e
Showing
9 changed files
with
207 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Draai je app op Google Cloud | ||
|
||
Om deze of een andere app op Google Cloud te draaien doe je het volgende: | ||
1. Maak een account aan op https://cloud.google.com/. Je moet daarvoor wel | ||
betaalgegevens (creditcard) ingeven. Je krijgt een budget voor 300 euro gratis. | ||
|
||
2. gcloud SDK op je laptop installeren | ||
Hiermee kun je lokaal de instellingen op je cloud environment instellen. | ||
Op de https://cloud.google.com/ site vind je meer info, of zoek in Google. | ||
|
||
3. Maak een nieuw project. Als je een account hebt doe je dit online. | ||
Let op: je project moet in US-central draaien; nergens anders. Anders kun je | ||
je app later niet deployen (we maken gebruik van beta versies van GCloud; sept 2016). | ||
|
||
Op je lokale machine: | ||
4. pom.xml aanpassen zodat hij google engine herkent. Zie Spring Bieb voorbeeld. | ||
5. Juiste mappen aanmaken en app.yaml toevoegen in de juiste map. Zie Spring Bieb voor locatie en inhoud. | ||
6. Zet je Dockerfile in de map [project]/dockerfile. | ||
Hierin hoef je geen rekening te houden met compileren en downloaden van benodigde | ||
software, wat je normaal bij een dockerfile wel moet doen. Alleen de juiste | ||
OS image, een goede naam voor je app, en de startup commands. Zie voorbeeld Bieb. | ||
|
||
7. Vanuit een command line venster: | ||
mvn clean install appengine:deploy | ||
|
||
Hiermee installeer je je app.jar bestand en het Dockerfile op Google Cloud. Kijk goed naar evt. foutmeldingen. | ||
|
||
|
||
Het draaien van je app in de cloud vraagt om het instellen van verschillende profiles | ||
in Spring. Je hebt nl. settings nodig voor de cloud-omgeving die waarschijnlijk afwijken | ||
van je localhost omgeving - zoals database host en portnr. Zie daarvoor ook de Bieb app, | ||
en de verschillende resources/application-[].profile bestanden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# app.yaml - configuratiebestand voor Google Cloud App Engine | ||
# | ||
runtime: custom | ||
vm: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# This is the image for RaspberryPi on ARM architecture. | ||
# See https://hub.docker.com/r/hypriot | ||
# | ||
# FROM hypriot/rpi-java | ||
|
||
# | ||
# This is the image for plain X86 machines. | ||
# | ||
# FROM java:8 | ||
# VOLUME /tmp | ||
# | ||
# The image to run the app on Google Cloud App Engine | ||
# | ||
FROM gcr.io/google_appengine/java-compat | ||
VOLUME /tmp | ||
|
||
# Install maven | ||
# RUN apt-get update | ||
# RUN apt-get install -y maven | ||
|
||
# WORKDIR /code | ||
|
||
# Warning: JAVA_HOME environment variable is not set. | ||
# ENV JAVA_HOME /usr/java/default | ||
# ENV PATH $PATH:$JAVA_HOME/bin | ||
|
||
# Prepare by downloading dependencies | ||
# ADD pom.xml *.iml /code/pom.xml | ||
# RUN ["mvn", "dependency:resolve"] | ||
# RUN ["mvn", "verify"] | ||
|
||
# Adding source, compile and package into a fat jar | ||
# ADD src /code/src | ||
# RUN ["mvn", "clean"] | ||
# RUN ["mvn", "compile"] | ||
# RUN ["mvn", "package"] | ||
|
||
ADD spring-boot-thymeleaf-1.0.jar app.jar | ||
EXPOSE 8080 | ||
# CMD ["java", "-jar", "target/spring-boot-thymeleaf-1.0.jar"] | ||
CMD ["java", "-jar", "/app.jar"] | ||
|
||
# done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
# De port waar de app gaat draaien. | ||
server.port = 8080 | ||
|
||
# Set the error path | ||
# error.path=/error | ||
|
||
# Hiermee zet je het globale (voor alles geldende) logging level. | ||
# Logging voor onze eigen packages wordt ingesteld in resources/logback.xml | ||
logging.file=myapplication.log | ||
# logging.level.org.springframework=DEBUG | ||
# logging.level.org.springframework.web=DEBUG | ||
|
||
spring.datasource.url=jdbc:mysql://localhost:3306/library | ||
spring.datasource.username=spring | ||
spring.datasource.password=test | ||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver | ||
|
||
spring.thymeleaf.cache=false | ||
spring.thymeleaf.check-template-location=true | ||
spring.thymeleaf.summary-type=text/html | ||
spring.thymeleaf.enabled=true | ||
spring.thymeleaf.encoding=UTF-8 | ||
spring.thymeleaf.mode=HTML5 | ||
spring.thymeleaf.prefix=classpath:/templates/ | ||
spring.thymeleaf.suffix=.html | ||
|
||
# Bol.com OpenAPI version 4 ApiKey - op naam van Robin Schellius | ||
# Als je hier iets mee wilt doen, vraag dan je eigen code via | ||
# https://developers.bol.com | ||
bol.com.openapi.v4.apikey = 25C4742A92BF468EB2BD888FC8FBFF40 | ||
|
||
# de API van onze eigen server. | ||
avans.library.bookserver.url = http://localhost:8090/api/book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
# De port waar de app gaat draaien. | ||
server.port = 8080 | ||
|
||
# Set the error path | ||
# error.path=/error | ||
|
||
# Hiermee zet je het globale (voor alles geldende) logging level. | ||
# Logging voor onze eigen packages wordt ingesteld in resources/logback.xml | ||
logging.file=myapplication.log | ||
# logging.level.org.springframework=DEBUG | ||
# logging.level.org.springframework.web=DEBUG | ||
|
||
spring.datasource.url=jdbc:mysql://localhost:3306/library | ||
spring.datasource.username=spring | ||
spring.datasource.password=test | ||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver | ||
|
||
spring.thymeleaf.cache=false | ||
spring.thymeleaf.check-template-location=true | ||
spring.thymeleaf.summary-type=text/html | ||
spring.thymeleaf.enabled=true | ||
spring.thymeleaf.encoding=UTF-8 | ||
spring.thymeleaf.mode=HTML5 | ||
spring.thymeleaf.prefix=classpath:/templates/ | ||
spring.thymeleaf.suffix=.html | ||
|
||
# Bol.com OpenAPI version 4 ApiKey - op naam van Robin Schellius | ||
# Als je hier iets mee wilt doen, vraag dan je eigen code via | ||
# https://developers.bol.com | ||
bol.com.openapi.v4.apikey = 25C4742A92BF468EB2BD888FC8FBFF40 | ||
|
||
# de API van onze eigen server. | ||
avans.library.bookserver.url = http://localhost:8090/api/book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters