apache stratos (incubating) hangout iv - stratos controller and cli internals
DESCRIPTION
Slides used for Apache Stratos (incubating) Fourth Hangout. Hangout video can be found at http://youtu.be/VtF9DVGKbTQ Website: http://stratos.incubator.apache.org Mailing List: Subscribe: [email protected] Post (after subscription): [email protected] Social Media: Google+: https://plus.google.com/103515557134069849802 Twitter: https://twitter.com/ApacheStratos Facebook: https://www.facebook.com/apache.stratos LinkedIn: http://www.linkedin.com/groups?home=&gid=5131436TRANSCRIPT
![Page 1: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/1.jpg)
Apache Stratos(Incubating)Hangout IVStratos Controller and CLI Internals13 August 2013
M. Isuru Tharanga Chrishantha Perera.Committer & PPMC Member of Apache Stratos (Incubating),
Senior Software Engineer at WSO2, Inc.
![Page 2: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/2.jpg)
Agenda● What is Stratos Controller?● How does Stratos Controller communicate
with Cloud Controller?● Auto-scaling policies configuration● How does the Artifact Distribution
Coordinator work?● How CLI works?
2
![Page 3: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/3.jpg)
High Level Architecture
3
![Page 4: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/4.jpg)
Stratos Controller Workflow
4
![Page 5: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/5.jpg)
So, What is Stratos Controller (SC)?● Basically, it’s Carbon + Set of Features
5
![Page 6: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/6.jpg)
What is SC? (Cont.)● Mainly consists of User Interface
○ Tenant Management○ Cartridge Subscription
● Artifact Distribution Coordinator○ Responsible for distribution of artifacts
● Configuring Auto-Scaling Policies○ Configuring policies.xml in
<SC_HOME>/repository/conf
6
![Page 7: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/7.jpg)
SC Components├── components
│ ├── org.apache.stratos.adc.mgt│ ├── org.apache.stratos.cartridge.mgt.ui│ ├── ...│ └── org.apache.stratos.tenant.mgt.ui
├── features
│ ├── adc
│ ├── ...│ └── manager
├── products
│ └── stratos-controller
└── service-stubs
├── org.apache.stratos.adc.mgt.stub └── org.apache.stratos.lb.cartridge.autoscaler.service.stub
7
![Page 8: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/8.jpg)
SC Features● Register a Tenant.● View list of available Cartridges.● View list of subscribed Cartridges.● Subscribe to a Cartridge.● Unsubscribe from a Cartridge.● Connect to a data Cartridge while
subscribing to a Cartridge.● View subscribed Cartridge detailed
information.8
![Page 9: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/9.jpg)
SC Features (Cont.)● Add domain mapping.● Remove domain mapping.● Synchronize repository.● Monitor logs of Cartridge instances.
9
![Page 10: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/10.jpg)
Application Management Service methodsArtifact Id: org.apache.stratos.adc.mgtClass: org.apache.stratos.adc.mgt.service.ApplicationManagementService
/** * Get Available Cartridges * * @return Available Cartridges */public Cartridge[] getAvailableCartridges(boolean multiTenant)
throws ADCException;
/** * Get Subscribed Cartridges * * @return Subscribed Cartridges */public Cartridge[] getSubscribedCartridges() throws ADCException;
public Cartridge getCartridgeInfo(String alias)throws ADCException, NotSubscribedException;
public PolicyDefinition[] getPolicyDefinitions();
public void synchronizeRepository(String cartridgeAlias)throws ADCException, NotSubscribedException;
10
![Page 11: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/11.jpg)
Application Management Service methods (Cont.)
/** * Subscribe to a cartridge */public SubscriptionInfo subscribe(String cartridgeType,
String alias, String policy, String repoURL, boolean privateRepo,String repoUsername, String repoPassword, String dataCartridgeType,String dataCartridgeAlias) throws ADCException, PolicyException,UnregisteredCartridgeException, InvalidCartridgeAliasException,DuplicateCartridgeAliasException, RepositoryRequiredException,AlreadySubscribedException, RepositoryCredentialsRequiredException,InvalidRepositoryException, RepositoryTransportException;
/** * Unsubscribing the cartridge * * @param alias name of the cartridge to be unsubscribed */public void unsubscribe(String alias) throws ADCException,
NotSubscribedException;
public String addDomainMapping(String mappedDomain,String cartridgeAlias) throws ADCException,DomainMappingExistsException, NotSubscribedException;
public void removeDomainMapping(String cartridgeAlias)throws ADCException, NotSubscribedException;
11
![Page 12: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/12.jpg)
SC Cartridge Subscription
12
![Page 13: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/13.jpg)
What happens when you subscribe?
13
![Page 14: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/14.jpg)
Current Database Schema
14
![Page 15: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/15.jpg)
Auto-scaling policies● Defined in <SC_HOME>/repository/conf/policies.xml<policies>
<policy name="single" isDefault="true"><description>Single - Instances: Min 1, Max 1</description><min_app_instances>1</min_app_instances><max_app_instances>1</max_app_instances><max_requests_per_second>5</max_requests_per_second><alarming_upper_rate>0.7</alarming_upper_rate><alarming_lower_rate>0.2</alarming_lower_rate><scale_down_factor>0.25</scale_down_factor><rounds_to_average>2</rounds_to_average>
</policy><policy name="elastic" isDefault="false">
<description>Elastic - Instances: Min 1, Max 4</description><min_app_instances>1</min_app_instances><max_app_instances>4</max_app_instances><max_requests_per_second>5</max_requests_per_second><alarming_upper_rate>0.7</alarming_upper_rate><alarming_lower_rate>0.2</alarming_lower_rate><scale_down_factor>0.25</scale_down_factor><rounds_to_average>2</rounds_to_average>
</policy></policies>
15
![Page 16: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/16.jpg)
Artifact Distribution Coordinator● Responsible for distribution of artifacts● Uses Git as the Code Repository
16
![Page 17: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/17.jpg)
How ADC works
17
![Page 18: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/18.jpg)
How does Git Repo notify the ADC?● Add a service hook to the Git Repository● For example: GitHub
18
![Page 19: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/19.jpg)
Interactive CLI Tool● Used by tenants to manage subscriptions.● Same functions as the UI, except:
○ Tenant registering○ Monitoring logs of Cartridge instances.
19
![Page 20: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/20.jpg)
CLI Modes● Interactive mode$export STRATOS_URL= https://demo.stratos.incubator.apache.org:9445
$./stratos.sh -u <username> -p <password>
stratos>
● Single command line mode○ User can execute commands in one line.○ It will not show the stratos> prompt○ The user can export the username and password to
the environment and execute commands.$export STRATOS_USERNAME=<username>
$export STRATOS_PASSWORD=<password>
$ stratos.sh -u [username] -p [password] [action commands]
20
![Page 21: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/21.jpg)
CLI Tool Technology● Supports following features via jline 2
○ Command history○ Auto-completion of commands○ Character masking (for passwords)
● Apache Commons CLI● Connects to SC● Artifact Id: org.apache.stratos.cli
21
![Page 22: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/22.jpg)
CLI Design
22
![Page 23: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/23.jpg)
CLI Commands
23
![Page 24: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/24.jpg)
Questions?
24
![Page 25: Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals](https://reader034.vdocuments.site/reader034/viewer/2022051323/54b723da4a795903798b4831/html5/thumbnails/25.jpg)
Join us!Website: http://stratos.incubator.apache.org
Mailing List:Subscribe: [email protected] (after subscription): [email protected]
Social Media:Google+: https://plus.google.com/103515557134069849802Twitter: https://twitter.com/ApacheStratosFacebook: https://www.facebook.com/apache.stratosLinkedIn: http://www.linkedin.com/groups?home=&gid=5131436
25