Giter Club home page Giter Club logo

hohomalls's Introduction

HoHoMalls: An Online Shopping Platform

This project aims to provide online shopping malls to Hong Kong merchants to sell their services and products, and to integrate the Faster Payment System (FPS) to facilitate online transactions, and offer extraordinary shopping experiences to customers.

This project will cover server, web and mobile applications. Currently, the server application have been being developed. Any interested persons are welcome, especially web and mobile developers.

1. Prerequisites

To build and run the applications, make sure you have at least JDK 11 installed.

2. How to run on local mode

There are three ways to run the applications.

Note that the account used on local mode is root(username) and P@55w0rd(password).

2.1. On local machine

2.1.1. Update hosts file

Add the following adresses to the hosts file:

127.0.0.1 hohomalls
127.0.0.1 hohomalls-mongo
127.0.0.1 hohomalls-redis

2.1.2. Configure MongoDB

2.1.3. Configure Redis

2.1.4. Start the applications

Make sure port 8080 is available and then start with:

cd hohomalls/server
./gradlew bootRun --args='--spring.profiles.active=local'

2.2. On Docker

  • Install Docker and start it

  • Build the Docker image

    cd hohomalls/server
    ./gradlew clean bootBuildImage
  • Start and stop the containers

    cd hohomalls
    
    # Create and start containers
    docker-compose -f docker/compose-local.yml up -d
    
    # Stop and remove resources
    docker-compose -f docker/compose-local.yml down

2.3. On Kubernetes

  • Install Kubernetes and start it

  • Install Docker and start it

  • Build the Docker image

    cd hohomalls/server
    ./gradlew clean bootBuildImage

3. Staging and Production environments

The following environment variables have to be set before starting the applications:

SPRING_REDIS_PASSWORD=actual_value_1;
SPRING_DATA_MONGODB_USERNAME=actual_value_2;
SPRING_DATA_MONGODB_PASSWORD=actual_value_3;
COM_HOHOMALLS_TOKEN_PUBLIC-KEY=actual_value_4;
COM_HOHOMALLS_TOKEN_PRIVATE-KEY=actual_value_5;

3.1. On Docker

  • Configure the variables in a Docker environment file

    cd hohomalls/docker
    touch .env.prod
    vi .env.prod
  • Set the correct values in the environment file

    REDIS_PASSWORD=actual_value_1
    MONGODB_USERNAME=actual_value_2
    MONGODB_PASSWORD=actual_value_3
    TOKEN_PUBLIC_KEY=actual_value_4
    TOKEN_PRIVATE_KEY=actual_value_5
  • Create required directory and files

    mkdir -p /opt/docker/mongo/data
    cp -r hohomalls/docker/mongo /opt/docker
    
    mkdir -p /opt/docker/redis/data
    cp -r hohomalls/docker/redis /opt
    
    mkdir /opt/docker/hohomalls
  • Start and stop the containers

    cd hohomalls
    
    # Create and start containers using production configurations
    docker-compose --env-file docker/.env.prod -f docker/compose-prod.yml up -d
    
    # Stop and remove resources
    docker-compose --env-file docker/.env.prod -f docker/compose-prod.yml down

Note that if you are using Docker Swarm, you may want to use Docker Secrets to manage the above sensitive data. In this case, you have to update the Docker compose files yourself.

4. Infrastructure on the Cloud

If the applications will be running on the cloud, e.g. AWS VPC, the following is the recommended infrastructure:

AWS Infrastructure

hohomalls's People

Contributors

shiyouping avatar

Stargazers

Eason Lin 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.