<commit_before>= Lab 02 (Technical) IT Infrastructure

== The Google Cloud Shell
The Google Cloud Shell is a specialized VM, as discussed in class. 

Review 

* https://cloud.google.com/shell/docs/features. 
* https://www.hashicorp.com/blog/kickstart-terraform-on-gcp-with-google-cloud-shell 

IMPORTANT: Going forward, you should ONLY provision and deprovision GCP resources with Terraform. 

== Terraform

* Before starting, review [this article on environment variables. https://phoenixts.com/blog/environment-variables-in-linux. If you do not understand, ask. 
* Create a new Github repo on your account titled Lab02-<your St. Thomas ID>. That is, if your St. Thomas email is <EMAIL>, name it Lab02-sala0001. Include a .gitignore file configured for Terraform. 
* Clone it down to the Google Cloud Shell (Request assistance if you need it with Github). 
* Using the Google Cloud Shell text editor or Nano to edit your files, run the Terraform GCP tutorial https://www.terraform.io/docs/providers/google/getting_started.html 
* You should not need to configure credentials. (Need to confirm.)

* NOTE: "YOUR GCP PROJECT" is your Google Cloud main project ID, with a name like "proven-sum-252123." You can find it at the top left of your browser. Click on the "friendly" project name to see the project ID. 

IMPORTANT: It is ESSENTIAL to create a .gitignore file properly configured for Terraform. For further information on .gitignore see https://git-scm.com/docs/gitignore. The required contents follow. 

.gitignore contents:
....
#  Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
.tfstate.

# .tfvars files
*.tfvars

....

== Tonight's major assignment
Using Terraform and its documentation, figure out how to provision a VM and install your small web server on it. 

At the end, you should have ONE Github repo with all the resources you need. You should be able to open up a clean Google Cloud Shell, clone it down, run it, and get a VM with your website running, every time. 

== Looking forward to next week
The next goals for the class - feel free to get started, here they are high level: 

* Replatform from webfsd to Node.js, rewriting your Terraformed repo appropriately. 

* Run a Docker tutorial (this would be good to do before class)

* Wrap your replatformed app in a Docker container

== Beyond next week

* Implement some trivial logic in your app, exposed as an API (add 2 numbers, concatenate 2 strings, etc.)

* Implement a CD pipeline that builds and tests your application on a "dev" VM and deploys to a "prod" VM.  

* Deploy the class microservices to a Kubernetes cluster

* Proxies, service mesh, monitoring, Open  Telemetry. 

* Incident management 

* Portfolio management

* Organization<commit_msg>fixes<commit_after>= Lab 02 (Technical) IT Infrastructure

== The Google Cloud Shell
The Google Cloud Shell is a specialized VM, as discussed in class. 

Review 

* https://cloud.google.com/shell/docs/features. 
* https://www.hashicorp.com/blog/kickstart-terraform-on-gcp-with-google-cloud-shell 

IMPORTANT: Going forward, you should ONLY provision and deprovision GCP resources with Terraform. 

== Terraform

* Before starting, review [this article on environment variables. https://phoenixts.com/blog/environment-variables-in-linux. If you do not understand, ask. 
* Create a new Github repo on your account titled Lab02-<your St. Thomas ID>. That is, if your St. Thomas email is <EMAIL>, name it Lab02-sala0001. Include a .gitignore file configured for Terraform. 
* Clone it down to the Google Cloud Shell (Request assistance if you need it with Github). 
* Using the Google Cloud Shell text editor or Nano to edit your files, run the Terraform GCP tutorial https://www.terraform.io/docs/providers/google/getting_started.html 
* You should not need to configure credentials. (Need to confirm.)

* NOTE: "YOUR GCP PROJECT" is your Google Cloud main project ID, with a name like "proven-sum-252123." You can find it at the top left of your browser. Click on the "friendly" project name to see the project ID. 

IMPORTANT: It is ESSENTIAL to create a .gitignore file properly configured for Terraform. For further information on .gitignore see https://git-scm.com/docs/gitignore. The required contents follow. 

.gitignore contents:
....
#  Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
.tfstate.

# .tfvars files
*.tfvars

....

=== Troubleshooting 

If you get 

....
Error refreshing state: state snapshot was created by Terraform v0.12.8, which is newer than current v0.12.2; upgrade to Terraform v0.12.8 or greater to work with this state
....

execute 
`rm -rf terraform.tfstate`
`terraform init`

== Tonight's major assignment
Using Terraform and its documentation, figure out how to provision a VM and install your small web server on it. 

At the end, you should have ONE Github repo with all the resources you need. You should be able to open up a clean Google Cloud Shell, clone it down, run it, and get a VM with your website running, every time. 

== Looking forward to next week
The next goals for the class - feel free to get started, here they are high level: 

* Replatform from webfsd to Node.js, rewriting your Terraformed repo appropriately. 

* Run a Docker tutorial (this would be good to do before class)

* Wrap your replatformed app in a Docker container

== Beyond next week

* Implement some trivial logic in your app, exposed as an API (add 2 numbers, concatenate 2 strings, etc.)

* Implement a CD pipeline that builds and tests your application on a "dev" VM and deploys to a "prod" VM.  

* Deploy the class microservices to a Kubernetes cluster

* Proxies, service mesh, monitoring, Open  Telemetry. 

* Incident management 

* Portfolio management

* Organization
{'fraction_non_alphanumeric': 0.07224334600760456, 'fraction_numerical': 0.00829588662288282, 'mean_word_length': 3.9293015332197614, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2456523', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1598, 'n_words': 800}