Broadleaf Commerce is a popular opensource eCommerce plaform. Given it's architecture, I was curious how much effort it would require to deploy in Red Hat Openshift.
With the Fabric8 Maven Plugin, it was super easy. Here are the steps I followed to deploy the Broadleaf Commerce DemoSite - https://github.com/BroadleafCommerce/DemoSite
OpenShift Version 4.3.5
Clone the DemoSite (I selected the default branch - https://github.com/BroadleafCommerce/DemoSite/tree/develop-6.0.x)
The Community Demo is comprised of 4 individual projects:
├── admin
├── api
├── core
└── site
core
a common jar that all other projects depend on, used for common functionality like domainsite
- a Spring Boot application that runs the Heat Clinic UI built with Thymeleaf as traditional MVC
I did not make any changes to the 'core' or 'site' modules.
admin
- a Spring Boot application for the Broadleaf admin for catalog management, see completed orders, etcapi
- a Spring Boot application that sets up the Broadleaf API endpoints
For the 'admin' and 'api' modules, I updated the /src/main/resources/runtime-properties/default.properties with the same 'server.port=8443' value as the 'site' module.
Since these modules will be in their own kubernetes Pod, there will not be able port conflicts. By default, Broadleaf uses HTTPS, so I just maintained the current configuration.
There is an option to update the environment variable in OpenShift and modify the port during deployment.
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.4.1</version>
<executions>
<execution>
<id>fmp</id>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
mvn clean install
Ensure you have an OCP enviornment provisioned and have logged in with appropriate credentials and create a new project
oc new-project broadleaf-demo
mvn fabric8:deploy
[INFO] Reactor Summary for Broadleaf Spring Boot Community Demo 1.0.0-SNAPSHOT:
[INFO]
[INFO] Community Demo Core ................................ SUCCESS [ 9.535 s]
[INFO] Community Demo Site ................................ SUCCESS [02:44 min]
[INFO] Community Demo Admin ............................... SUCCESS [02:41 min]
[INFO] Community Demo API ................................. SUCCESS [03:10 min]
[INFO] Broadleaf Spring Boot Community Demo ............... SUCCESS [ 3.289 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:50 min
oc get pods
kubectl get pods --field-selector status.phase=Running
NAME READY STATUS RESTARTS AGE
boot-community-demo-admin-1-nj9hx 1/1 Running 0 7h31m
boot-community-demo-api-1-jj6lc 1/1 Running 0 7h28m
boot-community-demo-site-1-x9hfp 1/1 Running 0 7h34m
The auto generated Services only define port 8080. But recall Broadleaf default configuration is https on 8443. Until this is predefined, you need to update the Services and Routes for the correct port and TLS enabled route.
I update via the web console, but working to provide appropriate fragments to automate these.
spec:
ports:
- name: https
protocol: TCP
port: 8443
targetPort: 8443
spec:
host: >-
broadleaf-site-broadleaf-demosite.apps.cluster-sgf-ca23.sgf-ca23.example.opentlc.com
to:
kind: Service
name: boot-community-demo-site
weight: 100
port:
targetPort: https
tls:
termination: passthrough
insecureEdgeTerminationPolicy: None
wildcardPolicy: None
https://www.broadleafcommerce.com/docs/core/current/getting-started/running-locally
Once this has finished executing, you should be able to see the Heat Clinic Admin by going to /admin in your browser. The username and password is admin/admin.
Go to base URL in your browser for the Heat Clinic Store
Swagger API definitions by going to /api/v1/swagger-ui.html.