This documentation is for WSO2 App Factory 2.0.0. View documentation for the latest release.

Versions Compared

Key

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

...

Set up App Factory using the instructions given in section Getting Started.

Executing the Sample

...

After the application is created, it has the following readily available in the App Factory portal.

  • Source control
  • Build system
  • Deployment environment

...

git clone https://git.appfactorypreview.wso2.com/git/custportalapp1.git
You can find the repository URL from the Repos and Builds tab on the left panel of the App Factory portal.

...

Next step is for the developer to code the Web application. In this sample we use a pre-built code. You can find it  in <AF_HOME>/samples directory and commit it to the Cust_PortalApp1 application created above using the following Git commands:

Code Block
//To add all the changes in a directory
git add * 
 
//To commit the changes
git commit -am "Committing changes"
 
//To push the commits
git push 

 

...

Click the Resource tab from the left panel and then click the Create Database button to create two new databases as Portal and TestPortal. Be sure to select the Advanced Options and create custom database user (user1 in this sample) and a permission template (template1 in this sample) as follows:
Image Removed

...

Code Block
USE TestPortal;
CREATE TABLE IF NOT EXISTS Customer (Name VARCHAR (20), Category VARCHAR (20), Region VARCHAR (20));
INSERT INTO Customer(Name, Category, Region) VALUES ('Bar Bank','Banking', 'Asia');
INSERT INTO Customer(Name, Category, Region) VALUES ('Doo International','Travel', 'Europe');
INSERT INTO Customer(Name, Category, Region) VALUES ('Foo','Retail', 'USA');

Development/Test/Staging database script:

Code Block
USE Portal;
CREATE TABLE IF NOT EXISTS Customer (Name VARCHAR (20), Category VARCHAR (20), Region VARCHAR (20));
INSERT INTO Customer(Name, Category, Region) VALUES ('Bank of Ceylon','Banking', 'Asia');
INSERT INTO Customer(Name, Category, Region) VALUES ('Sun Travels','Travel', 'Europe');
INSERT INTO Customer(Name, Category, Region) VALUES ('My Home','Retail', 'USA');
INSERT INTO Customer(Name, Category, Region) VALUES ('Herbal Spa','Health', 'USA');
INSERT INTO Customer(Name, Category, Region) VALUES ('Kids Unlimited','Retail', 'USA');
INSERT INTO Customer(Name, Category, Region) VALUES ('Cologne Mart','Retail', 'Midle East');

 

...

 Create a branch of the application Cust_PortalApp1 added in step 1 and deploy it to App Server in Development environment. You can do this using Repos and Builds tab in App Factory portal. 

...

You have created an application and taken it through its lifecycle stages by reusing the same datasource to point to different databases at different levels.

Also see Reusing an Endpoint in all Lifecycle Stages on how to create and reuse an endpoint resource though the application's lifecycle stagesThis usecase is already described in Consume a Datasource in all Lifecycle Stages of my Application.