microservice_go_gcp

command
v0.0.0-...-d7ce89a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 5 Imported by: 0

README

Deploy Microservice in Golang on GCP

Instructions

  • You should to have install SDK gcloud and Packer
App Engine
  • Inside folder app-engine, to open the terminal and type the following commands below:
    gcloud init
    gcloud app deploy app.yaml
  • The service will be available in:
    {your_instance_URL}/calc/{operation}/{firstNumber}/{secondNumber}

and

    {your_instance_URL}/calc/history
  • The values of operation are: sum, sub, mult and div
Compute Engine with Load Balancer
  • To build the GCP image with Packer, you should to do the download of your GCP credential in JSON format. To go API's and Services, credentials and to create one new key Service account key.

  • Inside principal project folder, to open the terminal and type the following command:

    packer build -var 'project_id={your_id_project}' -var 'account_file={your_key_file}.json' -var 'ssh_username={your_username}' bake-microservice.json
  • The packer image will to start built.

  • To go in Network, Firewall rules and to create a rule enabling the port 8080 with TCP protocol to ensure only this port will be accessed.

  • Now, you should to go in Instance template and to create a instance model from GCP image to create with Packer.

  • To go in Instance groups and to create a instance group managed to allow to operate an application on identical Virtual Machine.

  • To create a Load Balancing TCP to do the automatic balancing to instance groups.

  • The microservice will be available in:

    {your_instance_URL_external}:8080/calc/{operation}/{firstNumber}/{secondNumber}
  • The reference values of operation are: sum, sub, mult and div

  • To check the history of microservice, access:

    {your_instance_URL_external}:8080/calc/history

Presentation

Video

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL