vote

package module
v0.0.0-...-fe1fd9d Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

vote microservice

Frontend service that renders an HTML page to vote on cats vs. dogs. cat-v-dog

The "vote" service forwards requests to the "api" microservice to store and retrieve results on whether a voter prefers cats or dogs.

The two services communicate through Service Discovery which AWS Copilot sets up by default by querying the api.voting-app.local:8080 endpoint.
Alternatively, you can use the COPILOT_SERVICE_DISCOVERY_ENDPOINT environment variable that Copilot injects by default to your service.

How to create this service?

  1. Install the AWS Copilot CLI https://aws.github.io/copilot-cli/
  2. Run
    $ copilot init
    
  3. Enter "voting-app" for the name of your application.
  4. Select "Load Balanced Web Service" for the service type.
  5. Enter "vote" for the name of the service.
  6. Say "Y" to deploying to a "test" environment 🚀

Once deployed, your service will be accessible at an HTTP endpoint provided by the CLI like: http://votin-publi-anelun2kxbrl-XXXXXXX.YYYYY.elb.amazonaws.com/

What does it do?

AWS Copilot uses AWS CloudFormation under the hood to provision your infrastructure resources. You should be able to see a voting-app-test-vote stack that yours ECS service along with all the peripheral resources needed for logging, service discovery, and more...

How does it work?

Copilot stores the infrastructure-as-code for your service under the copilot/ directory.

copilot
└── vote
    └── manifest.yml

The manifest.yml file under vote/ holds the common configuration for a "load balanced web service" pattern. For example, you can setup configuration for your ECS task size, exposed port, environment variables, secrets from AWS Secrets Manager or AWS Systems Manager Parameter Store.

Deleting the service

If you'd like to delete only the service from the "voting-app" application.

$ copilot svc delete

If you'd like to delete the entire application including other services and deployment environments:

$ copilot app delete

Documentation

Overview

Package vote starts the vote server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() error

Run starts the server.

Types

This section is empty.

Directories

Path Synopsis
cmd
Package server provides the HTTP server to render the "vote" web page.
Package server provides the HTTP server to render the "vote" web page.
Package sessions provides functions that return AWS sessions to use in the AWS SDK.
Package sessions provides functions that return AWS sessions to use in the AWS SDK.

Jump to

Keyboard shortcuts

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