From 138bb595aa7d434a63eb9c1f0a92e60858cb541b Mon Sep 17 00:00:00 2001 From: Jianpeng Chao Date: Wed, 3 Mar 2021 13:51:12 -0800 Subject: [PATCH] Fix GAE deployment PiperOrigin-RevId: 360749150 Change-Id: I4e2e3e39f786be22a3f6016560be8160e33fb719 --- deploy.bash | 8 ++++++++ deploy/build-templates/damdemo/damdemo.yaml | 15 +++++++++++++++ deploy/build-templates/hydra/Dockerfile | 2 +- deploy/build-templates/icdemo/icdemo.yaml | 15 +++++++++++++++ deploy/build-templates/personas/personas.yaml | 15 +++++++++++++++ prepare_project.bash | 4 ++-- 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/deploy.bash b/deploy.bash index 5e0b86b6..9f44429f 100755 --- a/deploy.bash +++ b/deploy.bash @@ -235,6 +235,10 @@ if deploy_service "personas"; then fi if deploy_service "ic"; then + DB_EXISTS=`gcloud sql databases list --project=${PROJECT?} --instance=hydra | grep ic${ENV?}` + if [[ "${DB_EXISTS}" == "" ]]; then + gcloud sql databases create ic${ENV?} --project=${PROJECT?} --instance=hydra + fi echo -e ${GREEN?}'Deploy IC.'${RESET?} gcloud beta -q --project=${PROJECT?} app deploy deploy/build/ic/ic.yaml --image-url=gcr.io/${PROJECT?}/hcls-fa-ic:latest --version=master fi @@ -245,6 +249,10 @@ if deploy_service "icdemo"; then fi if deploy_service "dam"; then + DB_EXISTS=`gcloud sql databases list --project=${PROJECT?} --instance=hydra | grep dam${ENV?}` + if [[ "${DB_EXISTS}" == "" ]]; then + gcloud sql databases create dam${ENV?} --project=${PROJECT?} --instance=hydra + fi echo -e ${GREEN?}'Deploy DAM.'${RESET?} gcloud beta -q --project=${PROJECT?} app deploy deploy/build/dam/dam.yaml --image-url=gcr.io/${PROJECT?}/hcls-fa-dam:latest --version=master fi diff --git a/deploy/build-templates/damdemo/damdemo.yaml b/deploy/build-templates/damdemo/damdemo.yaml index bd3deb0d..d9170c33 100644 --- a/deploy/build-templates/damdemo/damdemo.yaml +++ b/deploy/build-templates/damdemo/damdemo.yaml @@ -21,3 +21,18 @@ env_variables: DAM_TYPE: "dam${YOUR_ENVIRONMENT}" PROJECT: "${YOUR_PROJECT_ID}" CSP: "connect-src https://*.appspot.com" + +liveness_check: + path: "/liveness_check" + check_interval_sec: 30 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + +readiness_check: + path: "/liveness_check" + check_interval_sec: 5 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + app_start_timeout_sec: 300 diff --git a/deploy/build-templates/hydra/Dockerfile b/deploy/build-templates/hydra/Dockerfile index dc9237a8..0a635ad9 100644 --- a/deploy/build-templates/hydra/Dockerfile +++ b/deploy/build-templates/hydra/Dockerfile @@ -20,7 +20,7 @@ ARG HYDRA_VERSION=v1.4.2 # Install depends and nginx RUN export JQ_VERSION=1.5+dfsg-2+b1 && \ - export NGINX_VERSION=1.14.2-2+deb10u1 && \ + export NGINX_VERSION=1.14.2-2+deb10u3 && \ apt update && \ apt install -y jq=${JQ_VERSION} nginx=${NGINX_VERSION} diff --git a/deploy/build-templates/icdemo/icdemo.yaml b/deploy/build-templates/icdemo/icdemo.yaml index 29301754..cfad41e6 100644 --- a/deploy/build-templates/icdemo/icdemo.yaml +++ b/deploy/build-templates/icdemo/icdemo.yaml @@ -21,3 +21,18 @@ env_variables: IC_TYPE: "ic${YOUR_ENVIRONMENT}" PROJECT: "${YOUR_PROJECT_ID}" CSP: "connect-src https://*.appspot.com" + +liveness_check: + path: "/liveness_check" + check_interval_sec: 30 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + +readiness_check: + path: "/liveness_check" + check_interval_sec: 5 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + app_start_timeout_sec: 300 diff --git a/deploy/build-templates/personas/personas.yaml b/deploy/build-templates/personas/personas.yaml index 3afdaf59..f63600f8 100644 --- a/deploy/build-templates/personas/personas.yaml +++ b/deploy/build-templates/personas/personas.yaml @@ -19,3 +19,18 @@ service: "personas${YOUR_ENVIRONMENT}" env_variables: TYPE: "personas${YOUR_ENVIRONMENT}" PROJECT: "${YOUR_PROJECT_ID}" + +liveness_check: + path: "/liveness_check" + check_interval_sec: 30 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + +readiness_check: + path: "/liveness_check" + check_interval_sec: 5 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + app_start_timeout_sec: 300 diff --git a/prepare_project.bash b/prepare_project.bash index 48110071..956e3fc2 100755 --- a/prepare_project.bash +++ b/prepare_project.bash @@ -99,9 +99,9 @@ gcloud datastore indexes create deploy/index.yaml --project=${PROJECT?} --quiet echo -e ${GREEN?}'Creating Cloud SQL database for Hydra.'${RESET?} gcloud sql instances create hydra --project=${PROJECT?} --database-version=POSTGRES_11 \ - --tier=db-f1-micro --region=us-central1 + --tier=db-f1-micro --region=us-central1 --require-ssl # Create user: name="${NAME}", password="${PASSWORD}" -gcloud sql users create hydra --project=${PROJECT?} --instance=hydra --password=hydra --require-ssl +gcloud sql users create hydra --project=${PROJECT?} --instance=hydra --password=hydra # Create database ic gcloud sql databases create ic --project=${PROJECT?} --instance=hydra # Create database dam