Up, Up and Away … GCP style

man holding ice cream cone under cloud
Photo by Rakicevic Nenad on Pexels.com

Today I wanted to use the Google Cloud Platform (GCP), since I have been spending so much time on AWS recently. I decided to build a very small web app with my go to stack: Python, Flask, Jinja, HTML, CSS and nothing else. I realized that I have not used Flask or Jinja in a while, and so this seemed like a good opportunity to both learn how to use GCP while also refreshing my skills.

A Simple App…

So that I could focus on learning, my app is nothing special and is quite simple: a starter app that asks the user to enter data into a form and then returns a message with the entered text. The CSS basically consists of a color change to a heading box, and the HTML was a very simple form, but getting to refresh myself on the jinja templating engine was helpful (and fun – I like Jinja!)

New Development Environment

More learning came in the form of working with my newly created development environment. First, I checked my backup, and then I wiped my hard drive. I finally installed High Sierra and Visual Studio Code (VSC). I decided to use VSC, since it is an IDE instead of using Sublime and the command line.

To the Cloud

The developer docs were remarkably easy to use for this project. I used the App Engine Standard Environment. I already had a starter project in the GCP Console, but I didn’t yet have the Google Cloud SDK. It was relatively easy to install, and the CLI can be customized, although I decided it was best to leave it “as is” until I know more about how it works. GCP requires a yaml file to configure settings. It seems like the GCP equivalent of Heroku’s Procfile, which I have used before.

I was able to deploy the app locally using the GCP tool, dev_appserver, and it’s a good thing I did…. The first error message asked me to install the app-engine-python component, which was easy enough. The second error message told me that the server was too busy (impossible) or that there was an error in my app – entirely possible! I forgot to render the template that has the data from the submitted form and got an error. So, checkmark on updating the debugging skills too! I fixed it, and then it worked perfectly.

The last step was actually deploying the app to the GCP. I always get nervous when I deploy something – it’s like I think the computer is going to catch on fire just because I typed “gcloud app deploy”. No fire – just mental fireworks because I was able to deploy the app! Yay – my first GCP app deployed. I have to say that deploying with GCP was easier than I anticipated, even using their CLI.

Now that I have deployed on GCP, Firebase, AWS and Heroku, I feel more accomplished. I have to admit that in terns of ease of use, the GCP deploy was the smoothest, #2 was Heroku, #3 was Firebase and #4 was AWS, which seems to be the most complex.

Comments are closed.

Blog at WordPress.com.

Up ↑