Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals

5,454 views
5,751 views

Published on

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: dev-subscribe@stratos.incubator.apache.org
Post (after subscription): dev@stratos.incubator.apache.org

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=5131436

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,454
On SlideShare
0
From Embeds
0
Number of Embeds
4,505
Actions
Shares
0
Downloads
30
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Apache Stratos (incubating) Hangout IV - Stratos Controller and CLI Internals

  1. 1. Apache Stratos (Incubating) Hangout IV Stratos Controller and CLI Internals 13 August 2013 M. Isuru Tharanga Chrishantha Perera. Committer & PPMC Member of Apache Stratos (Incubating), Senior Software Engineer at WSO2, Inc.
  2. 2. 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
  3. 3. High Level Architecture 3
  4. 4. Stratos Controller Workflow 4
  5. 5. So, What is Stratos Controller (SC)? ● Basically, it’s Carbon + Set of Features 5
  6. 6. 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
  7. 7. 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
  8. 8. 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
  9. 9. SC Features (Cont.) ● Add domain mapping. ● Remove domain mapping. ● Synchronize repository. ● Monitor logs of Cartridge instances. 9
  10. 10. Application Management Service methods Artifact Id: org.apache.stratos.adc.mgt Class: 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
  11. 11. 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
  12. 12. SC Cartridge Subscription 12
  13. 13. What happens when you subscribe? 13
  14. 14. Current Database Schema 14
  15. 15. 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
  16. 16. Artifact Distribution Coordinator ● Responsible for distribution of artifacts ● Uses Git as the Code Repository 16
  17. 17. How ADC works 17
  18. 18. How does Git Repo notify the ADC? ● Add a service hook to the Git Repository ● For example: GitHub 18
  19. 19. Interactive CLI Tool ● Used by tenants to manage subscriptions. ● Same functions as the UI, except: ○ Tenant registering ○ Monitoring logs of Cartridge instances. 19
  20. 20. 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
  21. 21. 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
  22. 22. CLI Design 22
  23. 23. CLI Commands 23
  24. 24. Questions? 24
  25. 25. Join us! Website: http://stratos.incubator.apache.org Mailing List: Subscribe: dev-subscribe@stratos.incubator.apache.org Post (after subscription): dev@stratos.incubator.apache.org 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=5131436 25

×