<<

Deploying your flask application on Platform (GCP).

General information:

Platform is a suite of public services offered by Google. The platform includes a range of hosted services for compute, storage and application development that run on Google hardware.

• App Engine is a compute service lets customers focus on their applications, leaving most infrastructure and provisioning to Google, while still offering various choices of runtime.

Step to deploying your flask application on App Engine of (GCP).

0. You need to redeem your coupon. This can be done by following the steps in the Piazza post about GCP coupons.

1. The following link leads you to a page within GCP that allows you to add in coupons to get more balance within your GCP account as the longer you host your site; the more money it will require.

Critical note: When you access the following link, you need to use a account to sign up. Make sure you logout all of other accounts and login to your gmail account before clicking “ACCEPT AND CONTINUE”.

https://console.cloud.google.com/education

2. The following link has a quick tutorial on how to start up a sample project to understand the basics of hosting applications on GCP using programs in Python.

https://developers.google.com/codelabs/cloud-vision-app-engine#0

3. Before you start, you need to create a project on GCP.

i. Go to the top left of the GCP console, select “Navigation Menu” > select “App Engine”.

ii. Next, you need to create a new project. But, since you are a new user, you may receive the following message “My first project”. You just need to give it a name, in my case I used “cs331e-idb”.

Note: In my case, I have already created the project. So, on my screen, next to the “Navigation Menu”, I see a drop-down menu that has my project.

iii. If you want to create another project, you need to click on the drop-down menu. Then, you may see a screen as follows. Select “NEW PROJECT”

iv. Type in the project name and hit create.

v. To check that you project was successfully created, hit the drop-down menu (next to Navigate Menu at the top left of the console) and you’ll see your project.

Note: GCP credits is rapidly consumed. To avoid running out of credit, make sure to “disable” your application after you finish experiments and after the TAs informs you that the grading is over. Here is how to disable your application:

App Engine -> Settings -> Application Settings -> Disable Application

4. In order to successfully deploy your website, the folder where your are located should also have a app.yaml (It is similar to the .-ci.yml that you need to do continuous integration on GitLab). Clone my example application from GitLab • Click on , ->, on the top-right corner of the GCP console. • While inside the shell, clone your repo that has the application files.

$ git clone https://gitlab.com/fareszf/cs331e-idb-gcp.git $ cd cs331e-idb-gcp.git

5. To test your application, type in the following command. $ gcloud app deploy

You might be asked to enter a choice number that represents your time zone. It might be “14” for US central. Then you might be also asked whether you want to continue. Type in “Y” to continue.

6. If the application is successfully deployed, you will see by the end of the output a link where you can navigate to your application. e.g., Deployed service [default] to [https://cs329e-idb-212120.appspot.com]