Coder Social home page Coder Social logo

jose4125 / front-end Goto Github PK

View Code? Open in Web Editor NEW

This project forked from udbc/front-end

0.0 1.0 0.0 48.38 MB

Front-end application for ALL the microservices

License: Apache License 2.0

Dockerfile 0.11% Makefile 0.31% JavaScript 32.35% HTML 58.92% CSS 7.74% Shell 0.57%

front-end's Introduction

Build Status

Front-end app

Front-end application written in Node.js that puts together all of the microservices under microservices-demo.

Setting up Dev Env

Platform : Ubuntu 16.04

Common Setup


# Install Pre reqs
sudo apt-get update  
sudo apt-get install git wget curl build-essential -yq

# Install Nodejs with NPM
cd /tmp
wget -c https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-x64.tar.xz
sudo tar -xzf node-v4.8.6-linux-x64.tar.xz -C /usr/local --strip-components=1

ln -s /usr/local/bin/node /usr/local/bin/nodejs


# validation  
node --version  
nodejs --version  
npm --version  

Clone the source and install dependencies

cd /opt
git clone https://github.com/microservices-demo/front-end.git
cd front-end/
yarn install
Launching the App

The front-end service can be launched with npm using the following command.

export NODE_ENV=production
npm start

Service will launch on port 8079

Production Deployment

Follow common steps from above section.

  • Create release directories
mkdir -p /opt/apps/frontend/releases

cd /opt/apps/frontend/releases
wget -c https://github.com/udbc/front-end/archive/1.0.1.tar.gz
  • Extract the artifact
cd /opt/apps/frontend/releases
tar -xzf 1.0.1.tar.gz

ls

front-end-1.0.1

  • Create a symlink /opt/frontend pointing to the latest release

e.g.

ln -s /opt/apps/frontend/releases/front-end-1.0.1 /opt/frontend
  • Install Dependencies and start the app
cd /opt/frontend
npm install
npm start

Init Script

You could also use the init script available at path scripts/frontend . You could copy this script to /etc/init.d so that you could start and stop service as,

service frontend start
service frontend stop

App Configurations

Frontend connects with all the backend services using endpoint configurations. These configs are in a file api/endpoints.js

Sample of which is given below.

module.exports = {
  catalogueUrl:  util.format("http://catalogue%s", domain),
  tagsUrl:       util.format("http://catalogue%s/tags", domain),
  cartsUrl:      util.format("http://carts%s/carts", domain),
  ordersUrl:     util.format("http://orders%s", domain),
  customersUrl:  util.format("http://user%s/customers", domain),
  addressUrl:    util.format("http://user%s/addresses", domain),
  cardsUrl:      util.format("http://user%s/cards", domain),
  loginUrl:      util.format("http://user%s/login", domain),
  registerUrl:   util.format("http://user%s/register", domain),
};

===========================

Build

Dependencies

Name Version
Docker >= 1.12
Docker Compose >= 1.8.0
Makeย (optional) >= 4.1

Node

npm install

Docker

make test-image

Docker Compose

make up

Test

Make sure that the microservices are up & running

Unit & Functional tests:

make test

End-to-End tests:

To make sure that the test suite is running against the latest (local) version with your changes, you need to manually build the image, run the container and attach it to the proper Docker networks. There is a make task that will do all this for you:

make dev

That will also tail the logs of the container to make debugging easy. Then you can run the tests with:

make e2e

Run

Node

npm start

Docker

make server

Use

Node

curl http://localhost:8081

Docker Compose

curl http://localhost:8080

Push

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

front-end's People

Contributors

benhall avatar errordeveloper avatar frankscholten avatar idcrosby avatar initcron avatar jasonrichardsmith avatar jose4125 avatar moretea avatar nustiueudinastea avatar philwinder avatar pidster avatar richardnwinder avatar sagar-babar avatar squaremo avatar vijayboopathy avatar vlal avatar

Watchers

 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.