/simpleservice

A Repo to practice 2 tier Go Application on EKS with Fargate.

Primary LanguageGoGNU General Public License v3.0GPL-3.0

Check this Blog

This repo is created for this blog: https://medium.com/@shrut_terminator/how-to-deploy-a-multi-container-two-tier-go-application-in-eks-fargate-6266494f5bcf

Repo contains the Docker file for Simple Service app, and the Kubernetes resources used for deploying it in EKS Fargate. Kubernetes resources are in "Kubernetes" folder.

simple-service

simple-service is an 'as easy as possible' golang HTTP api for examples and tests.

It has only a /live endpoint answering text/plain; charset=utf-8. The following responses are possibly:

  • Well done :): if the application was able to connect with a Postgres database
  • Running: if some error occurred during the connection with the database

Check the config package for more details on how to configure the database connection.

Building

simple-service uses go modules. To build the application you can use the following command:

GO111MODULE=on go build

The command above will generate a binary simple-service that starts the application.

How to Run App locally with Docker Compose

Simply run:

	docker-compose up -d 

This will create the app. Access it by using CURL:

	curl http://localhost:8080/live	

If you need to edit the Dockerfile and rework, run following first to tear down:

	docker-compose down --remove-orphans --volumes 

Then run following to build again:

	docker-compose up --build

NOTE: All environment values are picked from .env file. Modify accordingly.

DockerHub Image: gravito/simple-service:v1