[go: up one dir, main page]

Skip to content

A distributed online marketplace system where sellers and customers can sell and buy their desired products online and facilitates the shopping from many different sources.

Notifications You must be signed in to change notification settings

MariamFahmy98/Distributed-Marketplace-System

Repository files navigation

Table of contents

Distributed Marketplace System

It is online marketplace where it allows the sellers and customers to sell and buy their desired products online and facilitates the shopping from many different sources. Each user can create his own store where he can add his products so that other customers can buy their desired products. The store owner can buy products from the other users’ store and add the purchased products to his own store.

Features

  • User can create his own store.
  • User can add new products to his store specifying the needed price.
  • User can modify the current products in his store.
  • User can delete a specific product in his store.
  • User can search for products in other stores.
  • User can purchase products from another user’s store, the money required is transfered from the buyer’s account to the seller’s account, and the purchased product is added to the buyer’s store.
  • User can view his account info such as current cash balance, a list of purchased products, a list of sold products, and the products that haven’t been sold yet.
  • User can sell the products of other stores.
  • Other stores can sell user’s products.

Built With

  • Gin - HTTP web framework written in Go (Golang).
  • GORM - Golang ORM for mapping data directly to PostgreSQL.
  • PostgreSQL - Open source object-relational database system.
  • JSON Web Token - A standard to securely authenticate HTTP requests.
  • React - JavaScript library for building user interfaces.
  • Redux - JavaScript library to help better manage application state.
  • Docker - A set of platform as a service (PaaS) products that use OS-level virtualization.
  • Kubernetes - An open-source system for automating deployment, scaling, and management of containerized applications.

Getting Started

Dependencies

1- Installing Go (Ubuntu 20.04):

  • Downloading and Extracting the Go binary archive in the /usr/local directory:
    wget -c https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
    
  • Adding the location of the Go directory to the $PATH environment variable:
    sudo nano ~/.profile
    
    • Appending the following line in ~/.profile :
      export PATH=$PATH:/usr/local/go/bin
      
    • Save the file, and load the new PATH environment variable into the current shell session:
      source ~/.profile
      
  • Verifying Go Installation by
    go version
    
    The output should be something like this:

    go version go1.17.3 linux/amd64


2- Installing PostgreSQL
  • Using apt to install it:
    sudo apt update
    sudo apt install postgresql postgresql-contrib
    

3- Creating Database in PostgreSQL

To create a new database in PostgreSQL, you need to access the PostgreSQL database shell psql

  • The installation procedure created a user account called postgres, we need to to switch over to the postgres account on your server by running:

    sudo -i -u postgres
    
  • You can access the Postgres prompt by running:

    psql
    
  • Creating a password for the created user account by running:

    \password postgres
    
  • Then create a database by running:

    CREATE DATABASE ds_db;
    

Running the code

  • Start local minikube cluster by running:
    minikube start
    
  • Navigate into the k8s directory and create kubernetes resources in the cluster:
    cd k8s
    kubectl apply -f .
    
  • List all pods in the namespace to make sure that all pods are running:
    kubectl get pods
    
  • Dump the marketplace server pod logs by running:
    kubectl logs -f [marketplace-pod-name]
    
  • List all services in the namespace to get marketplace service:
    kubectl get services
    
  • Get the kubernetes URL for a marketplace service in your local minikube cluster:
    minikube service [marketplace-service-name]
    
  • To have a look on the database stored in postgresql-db-0:
    kubectl exec -ti postgresql-db-0 -- psql -U postgres -p 5432 postgres
    
    Same in case of postgreql-db-1

About

A distributed online marketplace system where sellers and customers can sell and buy their desired products online and facilitates the shopping from many different sources.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published