Giter VIP home page Giter VIP logo

carsales's Introduction

CarSales Instruction

Introduction to the CarSales Service

The service is build with the following component

  • Frontend
    The simple web page for configure and report, build in Angular 9 operating in ngix-alpine container
  • Backend
    The backend to serve the actual configuring and reporting functionality, built in golang and operated in alpine container
  • Database
    The persistent layer of the sales data, it includes all the data as well as the order restrictions, using mysql
  • Database client
    Simple phpmyadmin client include to view the database schema design

How to run the service

We will first go through the process to run the application, the targeted service is Ubuntu 18.04

Since the entire service is dockerized and packed in the docker compose matter. It is quite easy to run. But before that, we need to make sure the necessary software components are properly installed. The software component include:

  • Git Client : to get source code from github
  • Docker: to build and run the service as containers
  • Docker-compose: to provide simple container management, such as virtual networking, auto-restart,etc

First step is to install git client and get source code, please run the comments as following:

#install git client
sudo apt-get install git-core -y

#get source code from github
git clone https://github.com/ricogu/CarSales.git

#navigate to root dir of source code
cd CarSales

#set the persmission of the automation script
sudo chmod 771 installTooling.sh

#run the script to install tools if missing, the tools include docker, curl and docker compose, please use sudo here
sudo ./installTooling.sh

#add current user to docker user group
sudo usermod -aG docker ${USER}

Important: Now since we added our current user to the docker user group in the tooling script, we need to log off the ubuntu machine and log in again with the same user

Now, it is now to run the service

#navigate to root dir of source code
cd CarSales

#start composing docker services
docker-compose up -d

Wait for the composing to complete (around 10 mins) and wait another 5s for database initialization

If you are using a compute instance by a cloud provider (AWS, Azure, GCP, etc), please edit the security group to allow inbound TCP traffic on port 80 and 8080

Now go to http://<server's public ip> you can see the links to configure and report.

Alternatively you can go directly to http://<server's public ip>/configure and http://<server's public ip>/report

If you are interest in how database looks like, navigate to http://<server's public ip>:8080 and login with predefined DB user and password (i.e. username: admin, password: nimda)

To turn off the service, simply

docker-compose down

Please note that the data stored in database will be persisted even if the service is off (i.e stored in docker volume)

Further statement

Instead of designing a nice UI and working on optional requirements, I have invested time to make the service near production ready, this include:

  • use light and production grade containers for operating service
  • avoid expose backend API to public, the API calls from frontend will be proxied (by ngix) to backend via docker virtual network

The following improvement to the backend should be done (not done by me due to time constraint)

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.