Git Product home page Git Product logo

shopping-catalogue's Introduction

Build Status Coverage Status Go Report Card Microbadger

Catalogue

A microservices-demo service that provides catalogue/product information. This service is built, tested and released by travis.

Bugs, Feature Requests and Contributing

We'd love to see community contributions. We like to keep it simple and use Github issues to track bugs and feature requests and pull requests to manage contributions.

Dev

Platform supported : Ubuntu 16.04

Following are the instructions to setup a dev environment for catalogue.

sudo su
apt-get update && apt-get install -yq curl git wget
cd /tmp

echo "I: Setting up path for go and gvt"
export GOPATH=/opt/go
export GOROOT=/usr/local/go
export PATH="/opt/go/bin:$PATH"

mkdir /opt/go

echo "I: Install go from source..."

wget -c https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
tar -xzf go1.8.1.linux-amd64.tar.gz -C /usr/local


echo "Validating..."
which go
go version

echo "Install gvt..."
go get -u github.com/FiloSottile/gvt
which gvt

echo "I: Setup the repo..."
mkdir -p /opt/go/src/github.com/microservices-demo
cd /go/src/github.com/microservices-demo
git clone https://github.com/udbc/catalogue.git


echo "I: Compile the code ..."
cd catalogue/
cp -r images /images
gvt restore
cd cmd/cataloguesvc/
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app/main github.com/microservices-demo/catalogue/cmd/cataloguesvc

echo "I: Launch the app...."
# Make sure you have mysql connection configurations done before launching the app
#echo "172.20.0.2 catalogue-db" >> /etc/hosts

/app/main -port 7081

Production Deployment

Create DB and load the schema

Install mysql and codereate a database

e.g.

dbname: catalogue
user: devops
password: GKkdw72Jil0ld

Upload the schema to database created above.

path to schema : data/dump.sql

Deploy static assets

wget -c https://github.com/udbc/catalogue/archive/1.0.1.tar.gz

  • Extract the artifact, and copy images directory

e.g.

tar -xzf 1.0.1.tar.gz
cd catalogue-1.0.1
cp -r  images  /images

Deploy the Catalogue App

Create releases directory

mkdir /opt/apps/catalogue/releases

Download the release artifact from this page

e.g.

cd  /opt/apps/catalogue/releases

wget -c https://s3.amazonaws.com/sod-openedx/catalogue/catalogue

where catalogue is a binary

create a symlink

ln -s /opt/apps/catalogue/releases/catalogue /opt/

Launch the app

/opt/catalogue -port 7081 -images=/images/ -DSN 'dbuser:password@tcp(localhost:3306)/databasename'

e.g.

/opt/catalogue -port 7081 -images=/images/ -DSN 'devops:GKkdw72Jil0ld@tcp(localhost:3306)/catalogue'

API Spec

Checkout the API Spec here

To build this service

Dependencies

go get -u github.com/FiloSottile/gvt
gvt restore

Go tools

In order to build the project locally you need to make sure that the repository directory is located in the correct $GOPATH directory: $GOPATH/src/github.com/microservices-demo/catalogue/. Once that is in place you can build by running:

cd $GOPATH/src/github.com/microservices-demo/catalogue/cmd/cataloguesvc/
go build -o catalogue

The result is a binary named catalogue, in the current directory.

Docker

docker-compose build

To run the service on port 8080

Go native

If you followed to Go build instructions, you should have a "catalogue" binary in $GOPATH/src/github.com/microservices-demo/catalogue/cmd/cataloguesvc/. To run it use:

./catalogue

Docker

docker-compose up

Run tests before submitting PRs

make test

Check whether the service is alive

curl http://localhost:8080/health

Use the service endpoints

curl http://localhost:8080/catalogue

Push the service to Docker Container Registry

GROUP=weaveworksdemos COMMIT=test ./scripts/push.sh

Test Zipkin

To test with Zipkin

docker-compose -f docker-compose-zipkin.yml build
docker-compose -f docker-compose-zipkin.yml up

It takes about 10 seconds to seed data

you should see it at: http://localhost:9411/

be sure to hit the "Find Traces" button. You may need to reload the page.

when done you can run:

docker-compose -f docker-compose-zipkin.yml down

shopping-catalogue's People

Contributors

idcrosby avatar initcron avatar pidster avatar philwinder avatar errordeveloper avatar vijayboopathy avatar vlal avatar jasonrichardsmith avatar frankscholten avatar deraviyam avatar nustiueudinastea avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.