Skip to content

Commit

Permalink
Fix GAE deployment
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 360749150
Change-Id: I4e2e3e39f786be22a3f6016560be8160e33fb719
  • Loading branch information
chaopeng authored and copybara-github committed Mar 3, 2021
1 parent d3cd22b commit 138bb59
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 3 deletions.
8 changes: 8 additions & 0 deletions deploy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions deploy/build-templates/damdemo/damdemo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion deploy/build-templates/hydra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
15 changes: 15 additions & 0 deletions deploy/build-templates/icdemo/icdemo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions deploy/build-templates/personas/personas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions prepare_project.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 138bb59

Please sign in to comment.