Managing Environment Configurations as Code
Portable solutions require consistent configuration management and deployment across diverse environments. Treating configuration as code using version control and best practices brings the same benefits to infrastructure and settings management as it does to software development. Liferay's configuration client extensions provide a powerful mechanism for defining Liferay environment configurations. By embracing a configuration as code approach, these extensions treat settings as reusable, version-controlled assets.
In this lesson, you’ll learn about managing configurations as code through configuration client extensions and securing extensions with OAuth 2.0.
Understanding Configuration Client Extensions
Configuration client extensions offer a streamlined approach to managing and deploying Liferay configurations. This general category of client extensions can be categorized in three types, each set within the client-extension.yaml:
Name | Type | Description |
---|---|---|
Instance Settings | type: instanceSettings |
Configure a wide variety of Liferay settings referenced by each configuration’s PID (Persistent IDentity). |
OAuth Headless Server | type: oAuthApplicationHeadlessServer |
Pre-configure a Liferay OAuth2 application with a Headless Server client profile, required for API calls that aren't authorized by a specific user. |
OAuth User Agent | type: oAuthApplicationUserAgent |
Pre-configure a Liferay OAuth2 application with a User Agent Application client profile, required for API calls authorized by a specific user. |
All configuration client extensions can be grouped with any of the other three general categories of client extensions: batch, frontend, and microservice. This provides you with flexibility in organizing your code and allocating system resources effectively.
When working with configuration client extensions, it’s important to
-
Analyze the client-extension.yaml for misconfigured syntax if its deployment fails.
-
Deploy using up-to-date, compatible versions of Gradle and Java.
OAuth Client Extensions
OAuth 2.0 authorizes password-less access to resources, encrypting all authorization transport through HTTPS. Implementing OAuth 2.0 authentication profiles as configuration client extensions enables other client extensions that rely on specific authentication methods. This ensures that your environments align with your organization's security and integration requirements.
Both OAuth headless server and OAuth headless user agent client extensions depend on metadata that Liferay provides as a route (see Context-Sensitive Information). Any executable workload deployed with this client extension must wait for this route before it runs.
In the previous exercise, an OAuth headless server client extension was created to authorize API calls with the necessary scopes for Clarity’s batch client extension. This route secures data passed between the systems and ensures it can't be intercepted.
Instance Settings Client Extensions
Instance settings configure a wide variety of Liferay properties that apply to an individual virtual instance. This empowers you with flexibility when individual instances require different configurations in the same Liferay environment. You can leverage instance settings client extensions both to override system settings and to configure settings only available at the instance level.
In instance settings client extensions, each configuration is referenced by its PID (Persistent IDentity). See YAML Properties for client extension configurations specific to instance settings client extensions.
Valid values for properties will depend on the specific Java class being used and its data type, such as int, boolean, or String. For example, a class representing glasses might have properties of type int to store the quantity of glasses, boolean to indicate whether the glasses have a prescription, and String for the model name. See Scalar Properties for available data types.
Benefits of Managing Environment Configurations as Code
Leveraging configuration client extensions provides these benefits:
- Centralized Collaboration: With client extensions checked into source control, teams can collaborate seamlessly and guarantee identical settings and properties.
- Faster Deployment: Streamline the setup of new environments and accelerate the implementation of configuration changes.
- Enhanced Visibility: Consolidating portal configurations within a client extensions project simplifies configuration management with a single, readily accessible point of reference for understanding how critical properties are set.
- Increased Consistency: Maintaining a common configuration baseline, all environments operate with consistent properties, preventing wasted time due to settings mismatches between environments.
- Improved Security and Compliance: Support strong security practices by enabling audit trails and change management records for all configuration deployments.
Conclusion
Embracing a configuration as code approach treats Liferay’s environment settings as reusable, version-controlled assets. Configuration client extensions provide significant value by automating configuration management and reducing the risks associated with manual intervention. The enhanced reliability, faster deployment, and improved visibility reduces manual workload and empowers you to achieve consistent and predictable results. By learning to leverage configuration client extensions, you'll control the platform more effectively, enabling a customized, secure, and efficient digital environment.
Capabilities
Product
Education
Contact Us