How to build a custom stack with WSO2 carbon

2,467 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
2,467
On SlideShare
0
From Embeds
0
Number of Embeds
936
Actions
Shares
0
Downloads
86
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How to build a custom stack with WSO2 carbon

  1. 1. How to build a custom stack with WSO2 Carbon Shameera Ratnayaka Software Engineer Manoj Kumara Software Engineer
  2. 2. 150+ globally positioned support customers
  3. 3. Topics ● The feature/component concept in the WSO2 Carbon platform. ● Installing features using the Feature Manager. ● How to create your custom products for cluster wide deployment. ● Scripting feature installations for automation. ● Configuring logs/adding configs/etc.
  4. 4. What is Carbon Carbon is a modular server runtime based on OSGi Built on top of Carbon are a set of middleware servers (App Server, ESB, Identity, API Manager, etc) Re-configurable » Install new features, uninstall, revert Carbon includes a set of re-usable core components ● Clustering, User Management, Logging, JMX, ...
  5. 5. WSO2 Carbon based Products Features • Service Management Feature • Proxy Services Features • Transport Management Feature, etc..
  6. 6. Features in Carbon
  7. 7. What is a Feature In Eclipse world – Feature is a grouping of set of logically related plug-ins/ OSGi bundles – Feature can be installed into Eclipse platform using its Update Manager In Carbon world – Feature can be thought of as an installable form of one or more logically related Carbon component • Service Management Component – What you develop • Service Management Feature – What you install – Feature is a grouping of one or more logically related Carbon components – Features can be installed into Carbon based product using Feature Manager
  8. 8. Features Allows you to specify pre-requisites of your Carbon component. – Other dependent features, bundles. – Dependency Management. • Are installable Units which can be installed into any Carbon based product. • Can be installed using the WSO2 Carbon Feature Manager or by using a script • Can be shared with others by packaging features as a Repository (Update Site in eclipse terms).
  9. 9. What is a Carbon Component ● A set of OSGi Bundles. ● Lives in the Carbon Framework. Hence should conform to rules define in the Carbon Framework. ● Uses Core Carbon Services ○ Via OSGI service registry e.g. Registry Service, UserManager Service, etc ● Two aspects/ BE-FE Separation ○ Every component has a core runtime, a clean SOA management interface, a well-defined front-end console component ○ Back-end Runtime ○ Front-end Console
  10. 10. The big picture
  11. 11. Equinox P2 ● A provision platform for OSGi based systems. ● p2 stands for “Provisioning Platform” ● Provides a well defined model for provisioning OSGi bundles ● p2 allows us to manage components in a controlled manner ● Install, Uninstall, Revert ● Based on a web or file based repository ○ Can be hosted internally for an organization ● Three approaches: ○ Command line ○ Web console ○ Secure remote API
  12. 12. Carbon Component: Development Process 1. Develop the Carbon component ○ Back-end component (BE OSGi bundles) ○ Front-end component (FE OSGi bundles) ○ Common bundles, if any 2. Develop the corresponding feature ○ BE/Server Feature ○ FE/UI Feature ○ Composite Feature 3. Install into a Carbon based product ○ By integrating with the product build system ○ By developing a feature repository and installing using Feature Manage
  13. 13. Eclipse p2 ● Manages the packaging of OSGi bundles into features ● Supports deploying, undeploying, checkpoints ● Advanced features include shared repositories
  14. 14. p2 in Eclipse
  15. 15. p2 in Carbon
  16. 16. Feature Provisioning
  17. 17. Student Manager Component Lets develop a sample Carbon component to understand the development process as well as the build process. • Student Manager component ○ Consists of a BE runtime which exposes a Web services to • Add new students • Get the list of students ○ Consist of a FE console which displays the available student information on the Carbon management console. • Student Manager Feature ○ org.wso2.carbon.student.mgt.server.feature ○ org.wso2.carbon.student.mgt.ui.feature ○ org.wso2.carbon.student.mgt.feature
  18. 18. Developing the BE Component ● Some actual server logic plus an admin service to manage it ● Add some special sauce into the services. xml to let us know it’s an admin service ● component.xml configures permissions
  19. 19. We use Maven as our build tool. • Building Carbon components/OSGi bundles – Use Maven Bundle plugin to build OSGi bundles https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/core/org. wso2.carbon.core/4.1.0/pom.xml • Building Features – Use Maven P2 Feature plugin (Developed at WSO2) – Use p2-feature-gen goal https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0 /features/org.wso2.carbon.core.feature/4.1.0/pom.xml • Building a Repository – Use Maven P2 plugin – P2-repo-generator goal https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0 /features/pom.xml Carbon Component: Build Process
  20. 20. Demo Create custom component
  21. 21. Acquiring a OSGi service declaratively /** * @scr.component name="org.wso2.carbon.student.mgt" immediate="true" * @scr.reference name="registry.service" interface="org.wso2.carbon.registry.core.service. RegistryService" * cardinality="1..1" policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" */ public class StudentRegistryService { public static RegistryService registryService; protected void setRegistryService(RegistryService registryService) { StudentRegistryService.registryService = registryService; } protected void unsetRegistryService(RegistryService registryService) { StudentRegistryService.registryService = null; } }
  22. 22. Deployment Synchronization
  23. 23. Clustering
  24. 24. Install features in build time - Why? - can we do this with feature manager UI? - Then how we do that? - Carbon-p2 maven plugin - Generate p2 repository - Install feature
  25. 25. Configuration files - axis2.xml - carbon.xml - master-datasources.xml - authenticators.xml - registry.xml - cache.xml - user-mgt.xml - log4j.properties - .......
  26. 26. Add and Edit Configurations conf ├── axis2 │ ├── axis2_client.xml │ ├── axis2.xml │ └── tenant-axis2.xml ├── carbon.xml ├── datasources │ └── master-datasources.xml ├── etc │ ├── cache.xml ├── log4j.properties ├── registry.xml ├── security │ ├── authenticators.xml ├── tomcat │ ├── carbon │ │ ├── META-INF │ │ │ └── context.xml │ │ └── web.xml │ ├── catalina-server.xml │ ├── tomcat-users.xml │ └── web.xml └── user-mgt.xml
  27. 27. Engage with WSO2 Helping you get the most out of your deployments From project evaluation and inception to development and going into production, WSO2 is your partner in ensuring 100% project success

×