Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#9 from donovanjamesl/master
Browse files Browse the repository at this point in the history
Updated readme to be in line with changes after adding Jenkins support
  • Loading branch information
chrislovecnm authored Nov 6, 2018
2 parents 6100054 + dc787ec commit 875b1d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,13 @@ If you need to override any of the defaults, simply replace the desired value(s)

There are three Terraform files provided with this example. The first one, `main.tf`, is the starting point for Terraform. It describes the features that will be used, the resources that will be manipulated, and the outputs that will result. The second file is `provider.tf`, which indicates which cloud provider and version will be the target of the Terraform commands--in this case GCP. The final file is `variables.tf`, which contains a list of variables that are used as inputs into Terraform. Any variables referenced in the `main.tf` that do not have defaults configured in `variables.tf` will result in prompts to the user at runtime.

Given that authentication was [configured](#configure-authentication) above, we are now ready to run Terraform. In order to establish the beginning state of your cloud infrastructure you must first initialize Terraform:

```
$ terraform init
```

This will create a hidden directory called `.terraform` in your current working directory and populate it with files used by Terraform.

It is a good practice to do a dry run of Terraform prior to running it:
To build out the environment you can execute the following make command:

```
$ terraform plan
$ make create
```

Plan will prompt for any variables that do not have defaults and will output all the changes that Terraform will perform when applied. If everything looks good then it is time to put Terraform to work assembling your cloud infrastructure:

```
$ terraform apply
```

You will need to enter any variables again that don't have defaults provided. If no errors are displayed then after a few minutes you should see your Kubernetes Engine cluster in the [GCP Console](https://console.cloud.google.com/kubernetes) with the sample application deployed.

## Validation

If no errors are displayed during deployment, after a few minutes you should see your Kubernetes Engine cluster in the [GCP Console](https://console.cloud.google.com/kubernetes) with the sample application deployed.
Expand Down
20 changes: 15 additions & 5 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ then
fi
echo "Step 1 of the validation passed. App is deployed."


# Loop for up to 60 seconds waiting for service's IP address
EXT_IP=""
for ((i=0; i < RETRY_COUNT ; i++)); do
Expand All @@ -75,8 +74,19 @@ EXT_PORT=$(kubectl get service "$APP_NAME" -n default \

echo "App is available at: http://$EXT_IP:$EXT_PORT"

SERVICE_AVAILABLE=false
# Test service availability
[ "$(curl -s -o /dev/null -w '%{http_code}' "$EXT_IP:$EXT_PORT"/)" \
-eq 200 ] || exit 1

echo "Step 2 of the validation passed. App handles requests."
for ((i=0; i < RETRY_COUNT; i++)); do
RETURN_CODE=$(curl -s -o /dev/null -w '%{http_code}' "$EXT_IP:$EXT_PORT"/)
if [[ $RETURN_CODE = 200 ]]; then
echo "Step 2 of the validation passed. App handles requests."
SERVICE_AVAILABLE=true
break
fi
sleep 20
done
if [ "$SERVICE_AVAILABLE" = false ]
then
echo "Unable to access the app!"
exit 1
fi

0 comments on commit 875b1d8

Please sign in to comment.