Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Objectives: 


  1. Learn how to deploy a full working APP on top of SOAJS (Pet Store)

  2. Learn how to build UI Modules and deploy them in the Operate /wiki/spaces/BL/pages/61906563 pillar of SOAJS DSBRD

  3. Learn how to deploy a custom UI Frontend Interface for your APP with SOAJS
    - Deploy and use oAuth to login
    - Deploy and use URAC for member management and 3rd party integration (Facebook, Google+, Twitter)





1- Install SOAJS
Anchor
Install
Install


Start by installing and deploying SOAJS as a local Cloudcloud deploymentClick Here and you will be redirected to the SOAJS Installer Space where you can find the installation instructions.

For this demo, we will be using Local Cloud Deployment on top of Docker

Note
titleDeployment Information

In the installer and in the final step titled "Deployment Information", you need to set the following information in Git Account to add the UI Modules successfully :

  • Provide : Github
  • Git Domain : github.com
  • Git Owner : SOAJS-Demos
  • Git Repository : soajs.petstore.ui
  • Git Branch : master
  • Git Path : /uiModules
2

 and we will provide our custom UI modules for the pet store when deploying the portal.



2- Install the Portal 
Anchor
installPortal
installPortal


Login to the Dashboard using the credentials.

Press on Deploy Portal marked in blue on the top right dashboard and fill the wizard steps as following:

Image Added

Image Added

Image Added

Image Added

Image Added

Image Added

Image Added

Image Added



3- Install Demo
Anchor
InstallDemo
InstallDemo


Clone Once you finished the installation of the Portal, clone the full demo repositories from Github. You have 3 repositories to clone, one that contains the services code, one that contains the UI Modules and Widget code and one that contains a script that will bootstrap some database configuration for this demo ( explained here).configuration repository to import some sample data before you proceed. 

Note
titleOSX Users

Make sure you have Xcode (or at least Xcode cli) installed to be able to use the "git" command from the terminal!


Code Block
languagebash
titleFetch SOAJS demo reposInstall and Import Pet Store sample data
linenumberstrue
# Create a directory to clone the repo
> mkdir -p /opt/soajs/node_modules


# Go to directory
> cd /opt/soajs/node_modules


# Clone services repo from Github
> git clone git@github.com:SOAJS-Demos/soajs.petstore.services


# Clone UI Modules & Widget repo from Github
> git clone git@github.com:SOAJS-Demos/soajs.petstore.ui


# Clone configuration repo from Github
> git clone git@github.com:SOAJS-Demos/soajs.petstore.config


# install dependencies for each repository
> cd soajs.petstore.servicesconfig
> npm install
>
cd ../soajs.petstore.ui
> npm install
# Import the configuration
> cd ../soajs.petstore.config
> npm install


# Import the configuration
> cd soajs.petstore.config/import/
> node ./import/

# node . -h <mongo service host> -p <mongo port>
> node . -h dashboard-soajsdata -p 32017


Note
titleImport script help


Code Block
languagebash
# Open the import script help manual
> cd soajs.petstore.config/import/
> node . --help
From here on, we will use the SOAJS Dashboard UI to resume all the work. Log in to the SOAJS Dashboard to proceed



Note

Go to the Deploy pillar → Clouds & Deployments then Reload registry of the dashboard container.

Then Logout and Log back in, now the dashboard will load your new ACL permissions that includes the imported configuration for the pet store demo.




3 - Deploy Demo
Anchor
Deploy
Deploy


3.1 Activate Demo Repo

Head over to the Develop pillar → Git Accounts Repositories to active the demo microservice.

In the Git Accounts Repositories, we find the default SOAJS account activated and it contains a list of repositories we can turn on and off.

Since the The Pet Store demo is in a new organization, click on add account button and create a new organization with the following inputs :

  • Account Provider : Github
  • Account Domain : github.com
  • Account Type : Organization - Public
  • Account Label : SOAJS Demos
  • Username :  SOAJS-Demos

Activate the soajs.pestore.ui repository, you will be asked to select a branch; pick master.

Image Removed

Image Removed

another organization (SOAJS Demos); this means we need to create an account for it and activate it.

Field NameField ValueDescription
Account ProviderGithubWhich Git Provider to integrate with
Account Domaingithub.comThe domain of the Git Provider
Account TypeOrganization - PublicThe type of Account
Account LabelSOAJS DemosEnter a name for this account (anything you want)
UsernameSOAJS-DemosThe username of the Account to use; in this case SOAJS-Demos is the username for the SOAJS Demos Organization that contains the demo repositories and code


The list contains multiple repositories but for the Pet Store Demo we need to activate only 2:

Repository NameBranchDescription
soajs.pestore.petstoremasterContains petstore microservice ( inventory ).
soajs.petstore.ordermasterContains orders microservice (Shopping Cart systems).


Image Added

Image Added

3.2 Deploy Environment and Microservice

Our import script already imported the configuration we need to get things going.

Let's deploy the DEV environment , nginx using dev nginx recipe, petstore service, orders service, urac and oauth which will contain:

SystemsDescription
Nginx

Web Server that listens on port 81.

  • It loads the custom UI Frontend files based on the arriving request
  • It redirects and upstreams all API calls to the SOAJS Controller in this environment
ControllerSOAJS microservice that listens on port 4000 and analysis arriving requests to check the security and determine which microservice should handle these requests. Read More
oAuthSOAJS microservice that provides an out of the box implementation of oAuth 2.0, used to allow members to login and create access tokens for them. Read More
URACSOAJS microservice that offers user registration and access control to all members along with the ability to login via 3rd parties ( facebook - twiiter - google). Read More
Pet StoreCustom microservice built using the SOAJS Swagger Editor and contains all the APIs to manage a pet store inventory.
OrdersCustom microservice built using the SOAJS Swagger Editor and contains all the APIs that enable members to fill, checkout shopping carts & create orders while at the same time offers admin the ability to process these orders.


Step 1: Deploy Environment

Go to Deploy 

pillar → Registries → Add New Environment

Image Removed

Image Removed

pillar → Clouds & Deployments

Select DEV from the drop down menu in the top left corner.

Click on High Availability → Cloud in the left-hand side menu and press 

Press Deploy Environment.

Fill in the deploy environment form like the following pictures

.

Image Removed

Image Removed

for both Nginx and Controller sections.

Once deployed, changed the environment to Dashboard in the top left sidebar, locate the controller and from it's Service Operation Menu, select Reload Registry.

This will instruct the dashboard controller that a new controller in a new environment is now present.

Image Added

Image Added

Step 2: Deploy Service

Click on Deploy New Service and fill the form:

Image Removed

Image Removed

You should deploy the following services on the latest version in case of many : urac, oauth, petstore and orders

Change the environment back to Dev in the top left sidebar.

Navigate to Repositories under Deploy pillar, click on the service to deploy and press Configure Deployment, fill the form like the following picture and press First Time Deploy:

Deploy the following services using their latest versions: urac - oauth - petstore & orders.

Image Added
Image Added

Once the environment is deployed, update your hosts file and add the below entry:

Code Block
titlePoint the Dev API & widget Domain IP IPs in your local hosts file as well as the widget Domain IP for later use
127.0.0.1    dev-api.mydomain.com
127.0.0.1    petstore.soajs.org
127.0.0.1    petstore-api.soajs.org


Note

Go to the Deploy pillar → Clouds & Deployments then Reload registry of the controller container in Portal environment.




4- Use the Demo
Anchor
Explore
Explore


4.1 Test the services

Swagger Simulator : rich UI simulator that provides REST API documentation and the ability to interact with them.
SOAJS Dashboard UI is equipped with Swagger Engine and Simulator by default.

  1. Go to the dashboard →
Develop → Services
  1. Develop → API Catalog
  2. Click on Swagger logo that appears if the microservice is created using Swagger Editor and a new tab will open
  3. Choose your environment where you deployed your microservice
  4. Use the simulator to make API calls to your microservice
Image Added

4.2 Explore the widget

Go to In your browser , write open http://petstore.soajs.org:81 and you will access the widget to start finding your best pet to buy!!

You should access the homepage to see the available pets, create an account, login and start shopping.

Image Removed

Image Removed

 and the pet store frontend UI interface will open; Enjoy the Shopping (smile)

Image Added

Image Added

4.3 Manage the pet store

Go to the dashboard Portal, Operate pillar pillar, where you will find two extra UI Modules : Pet Store and  and Order Management.

4.3.1 Pet Store

In the Pet Store module, you will be able to list, add, edit and delete pets in manage your pets inventory for the store.

4.3.2 Order Management

In the Order Management module, you will be able to list all checked out orders and confirm fulfill or reject an orderthem.

Image Removed

Image Added

Image Removed

Image Added




5 - Conclusion


To sum things up, this demo is an excellent example on how to deploy a full project APP on top of SOAJS. We will go threw creating services, UI modules and a widget. 

In addition, you will get more familiar in deploying services in DEV environment.

Finally, you will get to know more about SOAJS power when it comes of using ready made services, new services, security, permissions and much more!!

We showed you how to create environments and deploy microservices in them using catalog recipes and while doing that, we introduced couple of ready made services by SOAJS: Controller - oAuth - URAC.

Ready made services do not require any development effort, simply deploy and use them.

In addition to microservices, we showed you how to deploy and operate on two types of UI components: UI Modules & Frontend UI Interfaces.

Dive in deeper and learn more about how the full demo is constructed in the sub pages where we tackle every section by itself and explain it in depth.