Skip to content

Commit

Permalink
Fix Mac m1 build (#13)
Browse files Browse the repository at this point in the history
Using docker images supported by mac m1
  • Loading branch information
gtiwari333 authored Dec 25, 2023
1 parent 56448e7 commit 0865627
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
13 changes: 8 additions & 5 deletions _config/docker-compose.yml → config/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
12 changes: 8 additions & 4 deletions content-checker/content-checker-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
5 changes: 0 additions & 5 deletions email/email-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 0865627

Please sign in to comment.