How to Setup a Stratos System on Your Personal Machine

  • By wso2 wso2
  • |
  • 14 Nov, 2010

Prerequisites

  1. MySQL RDBMS should be installed
  2. Create stratos_db, billing databases, and create the users. Run the following SQLs.
create database stratos_db;
CREATE USER 'wso2stratos'@'localhost' IDENTIFIED BY 'wso2stratos';
GRANT ALL PRIVILEGES ON *.* TO 'wso2stratos'@'localhost' WITH GRANT OPTION;
CREATE USER 'billing'@'localhost' IDENTIFIED BY 'billing';
GRANT ALL PRIVILEGES ON *.* TO 'billing'@'localhost' WITH GRANT OPTION;
create database billing;
use billing;
CREATE TABLE IF NOT EXISTS BC_CUSTOMER (
             BC_ID INTEGER AUTO_INCREMENT,
             BC_NAME VARCHAR (64),
             BC_STARTED_DATE TIMESTAMP,
             BC_EMAIL VARCHAR (64),
             BC_ADDRESS VARCHAR (256),
             CONSTRAINT PK_BC_CUSTOMER PRIMARY KEY (BC_ID)
)ENGINE INNODB;

CREATE INDEX BC_CUSTOMER_IND_BY_BC_NAME USING HASH ON BC_CUSTOMER(BC_NAME);
CREATE INDEX BC_CUSTOMER_IND_BY_BC_EMAIL USING HASH ON BC_CUSTOMER(BC_EMAIL);

CREATE TABLE IF NOT EXISTS BC_ITEM (
             BC_ID INTEGER AUTO_INCREMENT,
             BC_NAME VARCHAR (64),
             BC_COST VARCHAR (64),
             BC_DESCRIPTION VARCHAR(128),
             BC_PARENT_ITEM_ID INTEGER,
             CONSTRAINT PK_BC_ITEM PRIMARY KEY (BC_ID)
)ENGINE INNODB;

ALTER TABLE BC_ITEM ADD CONSTRAINT BC_ITEM_FK_BY_PARENT_ITEM_ID FOREIGN KEY (BC_PARENT_ITEM_ID) REFERENCES BC_ITEM (BC_ID);


CREATE TABLE IF NOT EXISTS BC_SUBSCRIPTION (
             BC_ID INTEGER AUTO_INCREMENT,
             BC_FILTER VARCHAR (32),
             BC_IS_ACTIVE INTEGER,
             BC_ACTIVE_SINCE TIMESTAMP,
             BC_ACTIVE_UNTIL TIMESTAMP,
             BC_ITEM_ID INTEGER,
             BC_CUSTOMER_ID INTEGER,
             CONSTRAINT PK_BC_SUBSCRIPTION PRIMARY KEY (BC_ID)
)ENGINE INNODB;

ALTER TABLE BC_SUBSCRIPTION ADD CONSTRAINT BC_SUBSCRIPTION_FK_BY_ITEM_ID FOREIGN KEY (BC_ITEM_ID) REFERENCES BC_ITEM (BC_ID);
ALTER TABLE BC_SUBSCRIPTION ADD CONSTRAINT BC_SUBSCRIPTION_FK_BY_CUSTOMER_ID FOREIGN KEY (BC_CUSTOMER_ID) REFERENCES BC_CUSTOMER (BC_ID);

CREATE TABLE IF NOT EXISTS BC_INVOICE (
             BC_ID INTEGER AUTO_INCREMENT,
             BC_CUSTOMER_ID INTEGER,
             BC_DATE TIMESTAMP,
             BC_START_DATE TIMESTAMP,
             BC_END_DATE TIMESTAMP,
             BC_BOUGHT_FORWARD VARCHAR (64),
             BC_CARRIED_FORWARD VARCHAR (64),
             BC_TOTAL_PAYMENTS VARCHAR (64),
             BC_TOTAL_COST VARCHAR (64),
             CONSTRAINT PK_BC_INVOICE PRIMARY KEY (BC_ID)
)ENGINE INNODB;

ALTER TABLE BC_INVOICE ADD CONSTRAINT BC_INVOICE_FK_BY_CUSTOMER_ID FOREIGN KEY (BC_CUSTOMER_ID) REFERENCES BC_CUSTOMER (BC_ID);

CREATE TABLE IF NOT EXISTS BC_PAYMENT (
             BC_ID INTEGER AUTO_INCREMENT,
             BC_DATE TIMESTAMP,
             BC_AMOUNT VARCHAR (64),
             BC_DESCRIPTION VARCHAR (128),
             BC_INVOICE_ID INTEGER,
             CONSTRAINT PK_BC_SUBSCRIPTION_ORDER PRIMARY KEY (BC_ID)
)ENGINE INNODB;

ALTER TABLE BC_PAYMENT ADD CONSTRAINT BC_PAYMENT_FK_BY_INVOICE_ID FOREIGN KEY (BC_INVOICE_ID) REFERENCES BC_INVOICE (BC_ID);

-- this is n-n relationship
CREATE TABLE IF NOT EXISTS BC_PAYMENT_SUBSCRIPTION (
             BC_PAYMENT_ID INTEGER,
             BC_SUBSCRIPTION_ID INTEGER,
             CONSTRAINT PK_BC_SUBSCRIPTION_ORDER PRIMARY KEY (BC_PAYMENT_ID, BC_SUBSCRIPTION_ID)
)ENGINE INNODB;

ALTER TABLE BC_PAYMENT_SUBSCRIPTION ADD CONSTRAINT BC_PAYMENT_SUBSCRIPTION_FK_BY_PAYMENT_ID FOREIGN KEY (BC_PAYMENT_ID) REFERENCES BC_PAYMENT (BC_ID);
ALTER TABLE BC_PAYMENT_SUBSCRIPTION ADD CONSTRAINT BC_PAYMENT_SUBSCRIPTION_FK_BY_SUBSCRIPTION_ID FOREIGN KEY (BC_SUBSCRIPTION_ID) REFERENCES BC_SUBSCRIPTION (BC_ID);

CREATE TABLE IF NOT EXISTS BC_INVOICE_SUBSCRIPTION (
             BC_ID INTEGER  AUTO_INCREMENT,
             BC_INVOICE_ID INTEGER,
             BC_SUBSCRIPTION_ID INTEGER,
             CONSTRAINT PK_BC_INVOICE_ITEM PRIMARY KEY (BC_ID)
)ENGINE INNODB;

ALTER TABLE BC_INVOICE_SUBSCRIPTION ADD CONSTRAINT BC_INVOICE_SUBSCRIPTION_FK_BY_INVOICE_ID FOREIGN KEY (BC_INVOICE_ID) REFERENCES BC_INVOICE (BC_ID);
ALTER TABLE BC_INVOICE_SUBSCRIPTION ADD CONSTRAINT BC_INVOICE_SUBSCRIPTION_FK_BY_SUBSCRIPTION_ID FOREIGN KEY (BC_SUBSCRIPTION_ID) REFERENCES BC_SUBSCRIPTION (BC_ID);

CREATE TABLE IF NOT EXISTS BC_INVOICE_SUBSCRIPTION_ITEM (
             BC_INVOICE_SUBSCRIPTION_ID INTEGER,
             BC_ITEM_ID INTEGER,
             BC_COST VARCHAR (64),
             CONSTRAINT PK_BC_INVOICE_SUBSCRIPTION_ITEM PRIMARY KEY (BC_INVOICE_SUBSCRIPTION_ID, BC_ITEM_ID)
)ENGINE INNODB;

ALTER TABLE BC_INVOICE_SUBSCRIPTION_ITEM ADD CONSTRAINT BC_INVOICE_SUBSCRIPTION_ITEM_FK_BY_INVOICE_SUBSCRIPTION_ID FOREIGN KEY (BC_INVOICE_SUBSCRIPTION_ID)
REFERENCES BC_INVOICE_SUBSCRIPTION (BC_ID); ALTER TABLE BC_INVOICE_SUBSCRIPTION_ITEM ADD CONSTRAINT BC_INVOICE_SUBSCRIPTION_ITEM_FK_BY_ITEM_ID FOREIGN KEY (BC_ITEM_ID) REFERENCES BC_ITEM(BC_ID);

2. Run cloud manager for the first time with ./wso2server.sh -Dsetup

3. Configuring Single Sign-On

  • All the Stratos Services contain the sso authenticator bundles by default. If you want to disable this feature, remove the following jars from {$CARBON_HOME}/repository/plugins directory.
    • org.wso2.carbon.identity.authenticator.saml2.sso-3.0.0.SNAPSHOT.jar
    • org.wso2.carbon.identity.authenticator.saml2.sso.ui-3.0.0.SNAPSHOT.jar
  • If you run setup script with '-sso' argument, then SSO will be set up automatically. In order to run this, it is required to build Stratos Identity Service before hand. For example, sh setup.sh -cs appserver -sso will setup Manager, App Server and configure SSO.
  • If you are manually configuring it, then follow the following steps.
  • Uncomment the 'SAML2SSOConfiguration' in the user-mgt.xml. Modify its default values as follows.
    • LoginPage - /carbon/tenant-login/login_ajaxprocessor.jsp
    • ServiceProviderID - A unique identifier for the server.
    • IdentityProviderSSOServiceURL - the SSO-IDP service URL. It is sufficient to change the IP and the port of the default value.
  • Modify the sso-idp-config.xml of the Stratos Identity Service to include this server as a relying party service. This file is available in ${STRATOS_IS_HOME}/repository/conf.
    • Add a new 'ServiceProvider' element to the 'ServiceProviders' list.
    • Issuer - This should be equal to the unique identifier which is set in the user-mgt.xml of your Stratos service in the previous step.
    • AssertionConsumerService - This is the assertion consumer URL of the corresponding Stratos Service. This has the pattern : https://{ip-address}{port}/acs
 

About Author

  • wso2 wso2
  • wso2