-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-gcp.sh
executable file
·22 lines (18 loc) · 955 Bytes
/
deploy-gcp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Assumes the `gcloud` command has been installed and configured: https://cloud.google.com/sdk/gcloud/
# If not already installed
sudo gcloud components install app-engine-java
# Now create the app
gcloud app create --region us-central
# If not already installed
sudo gcloud components install beta
# Create database instance
gcloud sql instances create friedflix-media-tracker --tier=db-n1-standard-1 --region=us-central1
# Create database
gcloud beta sql databases create friedflix --instance=friedflix-media-tracker
# Get connection info
gcloud beta sql instances describe friedflix-media-tracker | grep connectionName
# Before moving on, replace SPRING_DATASOURCE_URL in src/main/appengine/app.yaml with the output of the previous command:
# SPRING_DATASOURCE_URL: 'jdbc:mysql://google/friedflix?cloudSqlInstance=[REPLACE_HERE]&socketFactory=com.google.cloud.sql.mysql.SocketFactory'
# Deploy app
./mvnw -DskipTests appengine:deploy