5

Run your Application on Google Cloud Platform

 2 years ago
source link: https://blog.bitsrc.io/run-your-application-on-google-cloud-platform-ee9b319159a8
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Run your Application on Google Cloud Platform

Let’s use Cloud run to deploy your application in the cloud

Photo by eberhard grossgasteiger: https://www.pexels.com/photo/down-angle-photography-of-red-clouds-and-blue-sky-844297/

This article is part of a list of articles to deploy your application from scratch to Google Cloud Platform. Here are the links for the previous articles:

In the previous article, we could see how to build our application and store the image in our artifact registry. In this article, we’ll see how to deploy it.

For the needs of this article, you’ll need to have a docker image stored in the artifact registry in GCP. If you don’t have any and don’t know how to do it, check my previous article.

Enable Cloud Run

Cloud run is the service that allows us to deploy and run a container and expose it.

First, we’ll have to enable it. In the search bar, look for Cloud run and select the first result under Marketplace .
Click on Activate and then access the service.

Create a service

Cloud run page

When arriving on Cloud run, you’ll see this page, click on CREATE SERVICE and let’s set it up.

Under deploy one revision from an existing container image Click on select.

Under ARTIFACT REGISTRY navigate to your build and select it.

Fill in the service name and region.

Under authentication, be sure to check the first option as we haven’t set up users with IAM.

Unfolder Container, variables and secrets, connections, security at the bottom of the page and change the port to 3000 as it’s on this port that our app is listening.

Click and CREATE and let your container deploy itself.

Once deployed, you’ll find the URL at the top:

Simply access it and just add /ping at the end of the URL. You should be able to see pong

Shut down the service

A Cloud Run service is not like a dedicated machine and it cannot be stopped. Only deleted. If you’d like to delete the service (and you should if you don’t want to pay if some malicious people decide to spam it) you should simply go back to the dashboard of Cloud Run.

In there, you are able to select your running service by clicking on the tickbox on the left. Then click on DELETE at the top.

After waiting for a bit, the service will be deleted!

Build composable web applications

Don’t build web monoliths. Use Bit to create and compose decoupled software components — in your favourite frameworks like React or Node. Build scalable and modular applications with a powerful and enjoyable dev experience.

Bring your team to Bit Cloud to host and collaborate on components together, and speed up, scale, and standardize development as a team. Try composable frontends with a Design System or Micro Frontends, or explore the composable backend with serverside components.

Give it a try →

Learn more


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK