Skip to content

razamiDev/atlas-contacts-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atlas-contacts-app

This generated README.md file loosely follows a popular template.

One paragraph of project description goes here.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Install go dep

go get -u github.com/golang/dep/cmd/dep

Need postgresql installed locally or running inside docker container within contacts database created. You can change the name of database in dsn parameter in server app. Table creation in this example is omitted as it will be done autmotically by gorm.

Installing

Build the project

make vendor
make

If this process finished with errors it's likely that docker doesn't allow to mount host directory in its container. Therefore you are proposed to run su -c "setenforce 0" command to fix this issue.

Local setup

Please note that you should have the following ports opened on you local workstation: :8080 :9090 :8088 :8089. If they are busy - please change them via corresponding parameters of gateway and server binaries.

Run GRPC server:

./bin/server -dsn "host=localhost port=5432 user=postgres password=postgres sslmode=disable dbname=contacts"

Run GRPC gateway:

./bin/gateway

Try atlas-contacts-app

curl http://localhost:8080/atlas-contacts-app/v1/contacts -d '{"first_name": "Mike", "email_address": "mike@gmail.com"}'
curl http://localhost:8080/atlas-contacts-app/v1/contacts -d '{"first_name": "Bob", "email_address": "john@gmail.com"}'
curl http://localhost:8080/atlas-contacts-app/v1/contacts?_filter='first_name=="Mike"'

Local Kubernetes setup

Prerequisites

Make sure nginx is deployed in you K8s. Otherwise you can deploy it using

make nginx-up

or by running

kubectl apply -f kube/nginx.yaml

If you launching atlas-contacts-app for the first time you need to create contacts namespace for it in Kubernetes. This can be done by running

kubectl apply -f kube/ns.yaml

or

kubectl create ns contacts
Deployment

To deploy atlas-contacts-app use

make up

or as alternative you can run

kubectl apply -f kube/kube.yaml
Usage

Try it out by executing following curl commangs:

curl https://minikube/atlas-contacts-app/v1/contacts -d '{"first_name": "Mike", "email_address": "mike@gmail.com"}'
curl https://minikube/atlas-contacts-app/v1/contacts -d '{"first_name": "Bob", "email_address": "john@gmail.com"}'
curl https://minikube/atlas-contacts-app/v1/contacts?_filter='first_name=="Mike"'

Deployment

Add additional notes about how to deploy this application. Maybe list some common pitfalls or debugging strategies.

Running the tests

Explain how to run the automated tests for this system.

Give an example

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

About

Example application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 69.9%
  • Makefile 25.3%
  • PLpgSQL 4.8%