GithubHelp home page GithubHelp logo

igit-cn / jeeshop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from realjeeshop/jeeshop

0.0 1.0 0.0 4.29 MB

WIP

License: Apache License 2.0

Shell 0.01% Java 51.68% JavaScript 17.58% HTML 28.04% CSS 1.10% FreeMarker 1.59%

jeeshop's Introduction

Jeeshop (Work In Progress) Build Status

Description

Jeeshop is a e-commerce solution allowing you to setup quickly your online store.

It provides you with a store management GUI, Jeeshop-Admin and an complete set of REST APIs designed for your store front-end application (typically a javascript rich client application):

  • Products catalog
  • Discounts
  • Shopping cart
  • Users management
  • E-mailing

Jeeshop relies on following technologies :

Jeeshop GraphQL project defines a set of GraphQL APIs built on top of Jeeshop REST APIs

Links

Jeeshop GraphQL: https://github.com/muskacirca/jeeshop-graphql

Components

Jeeshop-Admin

Jeeshop-Admin is a responsive AngularJS client application designed to manage efficiently an e-commerce store. It consumes Jeeshop REST api backend to perform common store management operations.

REST APIs

Jeeshop REST APIs are designed to enable e-commerce and user management easily for a store front-end application. They are also used internally by Jeeshop-Admin.

Jeeshop REST APIs are organized per business domain:

GraphQL APIs

See Jeeshop GraphQL project

Jeestore

Jeestore is a front-end demonstration application application which consumes Jeeshop REST APIs You can take a look at it or start with it to build your e-commerce store

Installation

Jeeshop can be deployed to any Java EE 7 application server. (Web and full profile) As of today, it has only be tested on Wildfy

Wildfly

This section describes deployment of Jeeshop components to a Wildfly server.

Datasources

The following XA datasources are currently used by jeeshop modules and have to be created in server configuration

  • JeeshopDS, for user and order data
  • JeeshopCatalogDS for product catalog data

Below is an example of Jeeshop datasources configuration for a standalone server:

<xa-datasource jndi-name="java:/JeeshopDS" pool-name="JeeshopDS" enabled="true">
    <xa-datasource-property name="ServerName">
        localhost
    </xa-datasource-property>
    <xa-datasource-property name="DatabaseName">
        jeeshop
    </xa-datasource-property>
    <driver>mysql</driver>
    <security>
        <user-name>jeeshop</user-name>
        <password>test</password>
    </security>
    <validation>
        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
    </validation>
</xa-datasource>
<xa-datasource jndi-name="java:/JeeshopCatalogDS" pool-name="JeeshopCatalogDS" enabled="true">
<xa-datasource-property name="ServerName">
      localhost
  </xa-datasource-property>
  <xa-datasource-property name="DatabaseName">
      jeeshop
  </xa-datasource-property>
  <driver>mysql</driver>
  <security>
      <user-name>jeeshop</user-name>
      <password>test</password>
  </security>
  <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
  </validation>
</xa-datasource>
<driver name="mysql" module="com.mysql">
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>

Security domain configuration

A security domain named "jeeshop" has to be created to allow BASIC authentication and Role based access to protected REST Resources, using JaaS.

  • Sample of configuration for a standalone server:
  <security-domain name="jeeshop" cache-type="default">
      <authentication>
          <login-module code="Database" flag="required">
              <module-option name="dsJndiName" value="java:/JeeshopDS"/>
              <module-option name="principalsQuery" value="select password from User where login = ? and (disabled is null or disabled = 0) and activated = 1"/>
              <module-option name="rolesQuery" value="select name,'Roles' from Role r, User_Role ur, User u where u.login=? and u.id = ur.userId and r.id = ur.roleId"/>
              <module-option name="hashAlgorithm" value="SHA-256"/>
              <module-option name="hashEncoding" value="base64"/>
              <module-option name="unauthenticatedIdentity" value="guest"/>
          </login-module>
      </authentication>
  </security-domain>

Configure SSL to secure channels

SSL has to be configured in order to secure credentials sent in requests performed by store customers or Jeeshop-admin users (ie store administrators). This action is not required under a PaaS such as Openshift. (See Openshift deployment)

  • Create server certificate

Execute the following command in a temp directory

keytool -genkeypair -alias serverkey -keyalg RSA -keysize 2048 -validity 7360 -keystore server.keystore -keypass <PASSWORD FOR PRIVATE KEY>  -storepass <PASSWORD FOR KEYSTORE> -dname "cn=Server Administrator,o=jeeshop,c=FR"

Copy the server.keystore file in to the ${jboss.home.dir}/standalone/configuration folder

  • In standalone.xml configuration file

Add the following security realm block :

    <security-realms>
        ...
        <security-realm name="SSLRealm">
            <server-identities>
                <ssl>
                    <keystore path="server.keystore" relative-to="jboss.server.config.dir" keystore-password="THE KEYSTORE PASSWORD"/>
                </ssl>
            </server-identities>
        </security-realm>
    </security-realms>

Add the following http-listener line to the server block (in undertow subsystem)

    <server name="default-server">
        ...
       <https-listener name="default-https" socket-binding="https" security-realm="SSLRealm"/>
       ...
     </server>

Jeeshop JBOSS Module

A JBOSS Module named "jeeshop" have to be created to /modules directory. It contains multiple configuration properties such as:

  • Mailer parameters (SMTP parameters, Sender...) Sample of this module configuration is available in .openshift directory

Jeeshop media directory

To serve Jeeshop catalog media files uploaded through Jeeshop-Admin, the following configurations have to be added in standalone.xml configuration file:

Add the following in undertow subsystem

<subsystem xmlns="urn:jboss:domain:undertow:1.2">
            ...
            <server name="default-server">
               ...
                <host name="default-host" alias="localhost">
                   ...
                    <location name="/jeeshop-media" handler="jeeshop-media"/>
                   ...
                </host>
            </server>
            ...
            <handlers>
                ...
                <file name="jeeshop-media" path="/home/remi/jeeshop-media" directory-listing="true"/>
                ...
            </handlers>
            ...
        </subsystem>

Database setup

Scripts

Database setup scripts are provided in ./install/src/main/db directory for each supported databases

  • Vx.x_1__jeeshop-install.sql creates jeeshop ddl and reference data. It creates also a single user with login/password [email protected]/jeeshop (password is hashed using SHA-256 in this script, which must match security domain configuration, see Security domain configuration). This user should be deleted in production environment for security reason.
  • Vx.x__jeeshop-drop.sql empties database
  • Vx.x_2__demo-catalog-data configures jeeshop demonstration catalog data

Applying with maven

To setup or update your Jeeshop db with latest SQL scripts version, you can check a "flyway" maven profile, such as flyway-mysql, and execute "install" maven goal like this:

    mvn install

This command applies Jeeshop SQL scripts using FLYWAY database migration tool. So you always get your Jeeshop database up-to date applying SQL scripts this way.

Notes: Current database scripts are made for a single database. But you can also use one database for product catalog data and another for user and order data. (See Datasources section above)

Apache TomEE 7.x

This section describes deployment of Jeeshop components to Apache TomEE 2.x. TODO

Openshift cartridges

Wildfly cartridge

This section describes deployment of Jeeshop components to Openshift PaaS. TODO

Database configuration

Jeeshop db update / setup is performed automatically on Openshift cartridges with maven openshift profile.

jeeshop's People

Contributors

gmlewis avatar muskacirca avatar remibantos 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.