From eb61c7e8aca6250ab8892fd7b484f288ff44293b Mon Sep 17 00:00:00 2001
From: "Ganesh Tiwari(gtiwari333)" <ganesh.tiwari@shutterfly.com>
Date: Tue, 5 Dec 2023 12:01:21 -0600
Subject: [PATCH 1/4] using docker images supported by mac m1

---
 _config/docker-compose.yml                           | 10 ++++++----
 content-checker/content-checker-service/pom.xml      | 12 ++++++++----
 email/email-service/pom.xml                          |  5 -----
 .../test/java/gt/mail/frwk/TestContainerConfig.java  |  2 +-
 .../java/gt/app/config/DockerContainerConfig.java    |  8 ++++----
 .../src/main/resources/application-dev.yml           |  2 +-
 .../test/java/gt/app/config/TestContainerConfig.java |  4 ++--
 .../src/main/resources/application-dev.yml           |  2 +-
 8 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/_config/docker-compose.yml b/_config/docker-compose.yml
index ecd13f3..23e094e 100644
--- a/_config/docker-compose.yml
+++ b/_config/docker-compose.yml
@@ -1,10 +1,12 @@
 version: '3'
 services:
     activemq_artemis:
-        image: 'jhatdv/activemq-artemis:2.19.1-alpine'
+        # its not supported in M1 Mac, workaround is to enable Rosetta in Docker
+        # Docker settings → Features in development → check ☑ Use Rosetta for x86/amd64 emulation on Apple Silicon, and then restart Docker.
+        image: 'apache/activemq-artemis:2.31.2-alpine'
         container_name: activemqArtemis
         environment:
-            - ARTEMIS_USERNAME=admin
+            - ARTEMIS_USER=admin
             - ARTEMIS_PASSWORD=admin
         ports:
             - 8161:8161  # use this to login
@@ -12,7 +14,7 @@ services:
         networks:
             - seedappnet
     mysql:
-        image: 'mysql:8.0.30'
+        image: 'mysql:8.0.35'
         environment:
             - MYSQL_ROOT_PASSWORD=password
             - MYSQL_DATABASE=seedapp
@@ -22,7 +24,7 @@ services:
         networks:
             - seedappnet
     emailhog:
-        image: 'mailhog/mailhog'
+        image: 'richarvey/mailhog'
         container_name: mailhog
         ports:
             - 1025:1025
diff --git a/content-checker/content-checker-service/pom.xml b/content-checker/content-checker-service/pom.xml
index b7947fe..992477f 100644
--- a/content-checker/content-checker-service/pom.xml
+++ b/content-checker/content-checker-service/pom.xml
@@ -25,10 +25,6 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
-<!--        <dependency>-->
-<!--            <groupId>org.springframework.cloud</groupId>-->
-<!--            <artifactId>spring-cloud-starter-sleuth</artifactId>-->
-<!--        </dependency>-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-artemis</artifactId>
@@ -81,6 +77,14 @@
             <activation>
                 <activeByDefault>true</activeByDefault>
             </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.springdoc</groupId>
+                    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
+                    <version>${springdoc-openapi-ui.version}</version>
+                    <optional>true</optional>
+                </dependency>
+            </dependencies>
             <properties>
                 <spring.profiles.active>dev</spring.profiles.active>
                 <build.profile>dev</build.profile>
diff --git a/email/email-service/pom.xml b/email/email-service/pom.xml
index 43b46cb..2a5524b 100755
--- a/email/email-service/pom.xml
+++ b/email/email-service/pom.xml
@@ -129,11 +129,6 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <dependencies>
-                <dependency>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-devtools</artifactId>
-                    <optional>true</optional>
-                </dependency>
                 <dependency>
                     <groupId>org.springdoc</groupId>
                     <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
diff --git a/email/email-service/src/test/java/gt/mail/frwk/TestContainerConfig.java b/email/email-service/src/test/java/gt/mail/frwk/TestContainerConfig.java
index 9345d29..052b178 100644
--- a/email/email-service/src/test/java/gt/mail/frwk/TestContainerConfig.java
+++ b/email/email-service/src/test/java/gt/mail/frwk/TestContainerConfig.java
@@ -9,7 +9,7 @@
 public class TestContainerConfig {
 
     static {
-        var mailHog = new GenericContainer<>("mailhog/mailhog");
+        var mailHog = new GenericContainer<>("richarvey/mailhog");
         mailHog.withExposedPorts(1025);
         mailHog.start();
 
diff --git a/main-app/main-webapp/src/main/java/gt/app/config/DockerContainerConfig.java b/main-app/main-webapp/src/main/java/gt/app/config/DockerContainerConfig.java
index a414d42..3c46589 100644
--- a/main-app/main-webapp/src/main/java/gt/app/config/DockerContainerConfig.java
+++ b/main-app/main-webapp/src/main/java/gt/app/config/DockerContainerConfig.java
@@ -31,17 +31,17 @@ class DockerContainerConfig {
 
         String userPwd = "admin";//use same for all
 
-        var mysql = new MySQLContainer<>("mysql:8.0.30").withDatabaseName("seedapp").withUsername(userPwd).withPassword(userPwd);
+        var mysql = new MySQLContainer<>("mysql:8.0.35").withDatabaseName("seedapp").withUsername(userPwd).withPassword(userPwd);
         mysql.start();
 
-        var activeMQ = new GenericContainer<>("jhatdv/activemq-artemis:2.19.1-alpine");
-        activeMQ.setEnv(List.of("ARTEMIS_USERNAME=admin", "ARTEMIS_PASSWORD=admin"));
+        var activeMQ = new GenericContainer<>("apache/activemq-artemis:2.31.2-alpine");
+        activeMQ.setEnv(List.of("ARTEMIS_USER=admin", "ARTEMIS_PASSWORD=admin"));
         activeMQ.withExposedPorts(61616);
         activeMQ.start(); //using default ports
 
         setProperty("ACTIVEMQ_ARTEMIS_HOST", activeMQ.getHost());
         setProperty("ACTIVEMQ_ARTEMIS_PORT", Integer.toString(activeMQ.getMappedPort(61616)));
-        setProperty("ACTIVEMQ_ARTEMIS_USERNAME", userPwd);
+        setProperty("ACTIVEMQ_ARTEMIS_USER", userPwd);
         setProperty("ACTIVEMQ_ARTEMIS_PASSWORD", userPwd);
 
         setProperty("MYSQL_HOST", mysql.getHost());
diff --git a/main-app/main-webapp/src/main/resources/application-dev.yml b/main-app/main-webapp/src/main/resources/application-dev.yml
index 3fd257b..a493f4c 100644
--- a/main-app/main-webapp/src/main/resources/application-dev.yml
+++ b/main-app/main-webapp/src/main/resources/application-dev.yml
@@ -32,7 +32,7 @@ spring:
     jooq:
         sql-dialect: MySQL
     artemis:
-        user: ${ACTIVEMQ_ARTEMIS_USERNAME:admin}
+        user: ${ACTIVEMQ_ARTEMIS_USER:admin}
         password: ${ACTIVEMQ_ARTEMIS_PASSWORD:admin}
         broker-url: tcp://${ACTIVEMQ_ARTEMIS_HOST:localhost}:${ACTIVEMQ_ARTEMIS_PORT:61616}
     liquibase:
diff --git a/main-app/main-webapp/src/test/java/gt/app/config/TestContainerConfig.java b/main-app/main-webapp/src/test/java/gt/app/config/TestContainerConfig.java
index ca7f885..b7817ec 100644
--- a/main-app/main-webapp/src/test/java/gt/app/config/TestContainerConfig.java
+++ b/main-app/main-webapp/src/test/java/gt/app/config/TestContainerConfig.java
@@ -25,9 +25,9 @@ public class TestContainerConfig {
     static {
         log.info("Starting docker containers using TestContainers");
 
-        var activeMQ = new GenericContainer<>("jhatdv/activemq-artemis:2.19.1-alpine");
+        var activeMQ = new GenericContainer<>("apache/activemq-artemis:2.31.2-alpine");
         activeMQ.withExposedPorts(61616);
-        activeMQ.setEnv(List.of("ARTEMIS_USERNAME=admin", "ARTEMIS_PASSWORD=admin"));
+        activeMQ.setEnv(List.of("ARTEMIS_USER=admin", "ARTEMIS_PASSWORD=admin"));
 
         activeMQ.start(); //using default ports
 
diff --git a/trend/trend-service-api/src/main/resources/application-dev.yml b/trend/trend-service-api/src/main/resources/application-dev.yml
index 0eb3868..48d619e 100644
--- a/trend/trend-service-api/src/main/resources/application-dev.yml
+++ b/trend/trend-service-api/src/main/resources/application-dev.yml
@@ -1,6 +1,6 @@
 spring:
     artemis:
-        user: ${ACTIVEMQ_ARTEMIS_USERNAME:admin}
+        user: ${ACTIVEMQ_ARTEMIS_USER:admin}
         password: ${ACTIVEMQ_ARTEMIS_PASSWORD:admin}
         broker-url: tcp://${ACTIVEMQ_ARTEMIS_HOST:localhost}:${ACTIVEMQ_ARTEMIS_PORT:61616}
 

From 36c9029a92214dd397abc21ac530073aca975291 Mon Sep 17 00:00:00 2001
From: Ganesh T <gtiwari333@gmail.com>
Date: Tue, 5 Dec 2023 12:06:31 -0600
Subject: [PATCH 2/4] added docker fix

---
 README.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 9182387..6db13c0 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,9 @@ Future: do more stuff
     - http://ganeshtiwaridotcomdotnp.blogspot.com/2016/03/configuring-lombok-on-intellij.html
     - For eclipse, download the lombok jar, run it, and point to eclipse installation
 - Maven
-- Docker
+- Docker 
+  - Make sure docker is started and running
+  - Run `$ sudo chmod 666 /var/run/docker.sock` if you get error like this "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Details: [13] Permission denied)"
 
 #### How to Run
 

From 6a312659e57fac98ee06431d8419d2d680e768ff Mon Sep 17 00:00:00 2001
From: Ganesh T <gtiwari333@gmail.com>
Date: Tue, 5 Dec 2023 12:09:13 -0600
Subject: [PATCH 3/4] added docker fix

---
 README.md                              | 2 +-
 {_config => config}/docker-compose.yml | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename {_config => config}/docker-compose.yml (100%)

diff --git a/README.md b/README.md
index 6db13c0..e402586 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ It contains following applications:
 
 Option 1 - run with manually started ActiveMQ and MySQL  servers
 - Run ```mvn clean install``` at root 
-- Run ```docker-compose -f _config/docker-compose.yml up``` at root to start docker containers
+- Run ```docker-compose -f config/docker-compose.yml up``` at root to start docker containers
 - Go to main-app folder and run ```mvn``` to start the application
 
 Option 2 - automatically start ActiveMQ and MySQL using TestContainer while application is starting
diff --git a/_config/docker-compose.yml b/config/docker-compose.yml
similarity index 100%
rename from _config/docker-compose.yml
rename to config/docker-compose.yml

From 90555e40eacca7a6c4e50effad8af535ee086868 Mon Sep 17 00:00:00 2001
From: Ganesh T <gtiwari333@gmail.com>
Date: Tue, 5 Dec 2023 12:12:48 -0600
Subject: [PATCH 4/4] url added

---
 config/docker-compose.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/config/docker-compose.yml b/config/docker-compose.yml
index 23e094e..6b4cb27 100644
--- a/config/docker-compose.yml
+++ b/config/docker-compose.yml
@@ -9,7 +9,7 @@ services:
             - ARTEMIS_USER=admin
             - ARTEMIS_PASSWORD=admin
         ports:
-            - 8161:8161  # use this to login
+            - 8161:8161  # use this to access from browser
             - 61616:61616
         networks:
             - seedappnet
@@ -28,6 +28,7 @@ services:
         container_name: mailhog
         ports:
             - 1025:1025
+            - 8025:8025  # use this to access from browser
         networks:
             - seedappnet
 volumes: