Ubuntu Local Starter Projects Setup
System Setup
Below are the minimum setup steps required to get the Backend Flex Package API Starter Project running on a fresh installation of Ubuntu (tested against Ubuntu 20.04 LTS: 4 vCPUs + 16 GB memory and 8 vCPUs + 32 GB memory [recommended] machine types)
1. Install Java
$ sudo apt install openjdk-11-jre-headless
2. Install Docker
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
4. Setup Broadleaf Microservice Nexus Credentials
$ cd ~
$ mkdir .m2
$ cd ~/.m2
$ vi settings.xml
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<id>broadleaf-microservices</id>
<username>REPLACE_WITH_PROVIDED_USER</username>
<password>REPLACE_WITH_PROVIDED_PASSWORD</password>
</server>
</servers>
</settings>
5. Setup Broadleaf Microservice Docker Registry Credentials (type in provided user and password)
$ sudo docker login repository.broadleafcommerce.com:5001
6. Configure /etc/hosts local workarounds to support Microservices Starter Projects setup.
$ sudo vi /etc/hosts
Make sure to add the following in your /etc/hosts if not there already. Note: see https://ms-support.broadleafcommerce.com/article/71-unable-to-connect-to-host-docker-internal for more details around host.docker.internal, this can be updated or removed if providing a different workaround as mentioned in the article.
127.0.0.1 localsolr
172.17.0.1 host.docker.internal
$ sudo touch /etc/hosts
Build the Project
$ cd <path to Flex Package MicroservicesDemo project>
$ ./mvnw clean install
Starting the Applications
Example Composition: Min + Indexer
Terminal 1:
$ cd <path to Flex Package MicroservicesDemo project>
$ cd flexpackages/min/docker
$ sudo docker-compose up -d && sudo ./check-services-status.sh
$ cd ..
$ ../../mvnw spring-boot:run
Terminal 2:
$ cd <path to Flex Package MicroservicesDemo project>
$ cd services/indexer
$ ../../mvnw spring-boot:run -Dspring-boot.run.profiles=localdev,min
Visit Back office Admin in Browser: https://localhost:8446