From 0865627d76fb37dd56b465844dff9b8cbba2be60 Mon Sep 17 00:00:00 2001 From: Ganesh Tiwari Date: Mon, 25 Dec 2023 09:26:20 -0600 Subject: [PATCH] Fix Mac m1 build (#13) Using docker images supported by mac m1 --- README.md | 6 ++++-- {_config => config}/docker-compose.yml | 13 ++++++++----- 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 +- .../java/gt/app/config/TestContainerConfig.java | 4 ++-- .../src/main/resources/application-dev.yml | 2 +- 9 files changed, 29 insertions(+), 25 deletions(-) rename {_config => config}/docker-compose.yml (63%) diff --git a/README.md b/README.md index 9182387..e402586 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 @@ -108,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 63% rename from _config/docker-compose.yml rename to config/docker-compose.yml index ecd13f3..6b4cb27 100644 --- a/_config/docker-compose.yml +++ b/config/docker-compose.yml @@ -1,18 +1,20 @@ 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 + - 8161:8161 # use this to access from browser - 61616:61616 networks: - seedappnet mysql: - image: 'mysql:8.0.30' + image: 'mysql:8.0.35' environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=seedapp @@ -22,10 +24,11 @@ services: networks: - seedappnet emailhog: - image: 'mailhog/mailhog' + image: 'richarvey/mailhog' container_name: mailhog ports: - 1025:1025 + - 8025:8025 # use this to access from browser networks: - seedappnet volumes: 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 @@ org.springframework.boot spring-boot-starter-web - - - - org.springframework.boot spring-boot-starter-artemis @@ -81,6 +77,14 @@ true + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc-openapi-ui.version} + true + + dev dev 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 @@ true - - org.springframework.boot - spring-boot-devtools - true - org.springdoc springdoc-openapi-starter-webmvc-ui 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}