You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2018/08/22 14:24:38 UTC

[GitHub] myrle-krantz closed pull request #3: Docker infrastructure for Eureka and ActiveMQ

myrle-krantz closed pull request #3: Docker infrastructure for Eureka and ActiveMQ
URL: https://github.com/apache/fineract-cn-demo-server/pull/3
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.md b/README.md
index 16b8e5f..8ea7828 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,9 @@ All Apache Fineract CN projects must be published to your local Maven repository
 Just start the class DemoServer
 
 ### Executable JAR file
+
+Note: If you want use embedded infrastructure such as Eureka, ActiveMQ etc follow below steps. If you want to have external infrastructure launched via Docker, see instructions below
+ 
 1. Open a terminal window
 2. Change directory to your project location
 3. Run `gradlew publishToMavenLocal`
@@ -42,3 +45,19 @@ mariadb user to use
 
 ##### custom.mariadb.password
 mariadb password to use
+
+### To bring up demo server with Docker Eureka, ActiveMQ, MariaDB and Cassandra
+
+1. Install Docker v1.12+ and docker-compose v1.10 as per documentation in docker.com
+2. Open a terminal window
+3. Change directory to your project location
+4. Run `./start-dependencies.sh` to start Eureka, ActiveMQ, MariaDB and Cassandra
+5. Run `gradlew publishToMavenLocal`
+6. Change directory to build/libs
+7. Run `java -jar -Dexternal.infrastructure=true -Ddemoserver.persistent=true demo-server-0.1.0-BUILD-SNAPSHOT.jar`
+
+Note:
+a) To view Eureka console, navigate to http://localhost:8761
+b) To view ActiveMQ admin console queues page, navigate to http://localhost:8161/admin/queues.jsp and use admin/admin as user id and password
+c) To shutdown Eureka and ActiveMQ, run `./stop-dependencies.sh`
+d) To launch built in Eureka and ActiveMQ, Run `java -jar -Dstart.infrastructure=true demo-server-0.1.0-BUILD-SNAPSHOT.jar`
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..0b6da2e
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,31 @@
+version: '2.0'
+services:
+  activemq:
+    image: rmohr/activemq:5.14.5
+    ports:
+      - "61616:61616"
+      - "8161:8161"
+  eureka:
+    image: springcloud/eureka
+    ports:
+      - "8761:8761"
+    environment:
+      - server_port=8761
+      - security_basic_enabled=false
+      - error_whitelabel_enabled=false
+      - eureka_instance_leaseRenewalIntervalInSeconds=1
+      - eureka_server_responseCacheUpdateIntervalMs=500
+      - eureka_instance_hostname=localhost
+      - eureka_client_registerWithEureka=false
+      - eureka_client_fetchRegistry=false
+      - eureka_serviceUrl_defaultZone=http://localhost:8761/eureka
+  cassandra:
+    image: cassandra:3.0.16
+    ports:
+      - "9142:9042"
+  mariadb:
+    image: mariadb:10.2
+    ports:
+      - "3306:3306"
+    environment:
+      - MYSQL_ROOT_PASSWORD=mysql
diff --git a/src/main/java/io/mifos/dev/ServiceRunner.java b/src/main/java/io/mifos/dev/ServiceRunner.java
index 7d550ed..902308f 100644
--- a/src/main/java/io/mifos/dev/ServiceRunner.java
+++ b/src/main/java/io/mifos/dev/ServiceRunner.java
@@ -63,6 +63,8 @@
 import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
 import org.eclipse.aether.resolution.ArtifactResolutionException;
 import org.junit.*;
+import org.junit.rules.ExternalResource;
+import org.junit.rules.RunExternalResourceConditionally;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -111,7 +113,8 @@
   private static Microservice<ChequeManager> chequeManager;
   private static Microservice<PayrollManager> payrollManager;
   private static Microservice<GroupManager> groupManager;
-
+  
+  private static Boolean runEmbeddedResources = (System.getProperty("external.infrastructure") == null ? true : false);
 
   private static DB embeddedMariaDb;
 
@@ -134,11 +137,14 @@ public Logger logger() {
   }
 
   @ClassRule
-  public static final EurekaForTest EUREKA_FOR_TEST = new EurekaForTest();
+  public static final ExternalResource EUREKA_FOR_TEST = new RunExternalResourceConditionally (
+                                                                new EurekaForTest(), 
+                                                                runEmbeddedResources);
 
   @ClassRule
-  public static final ActiveMQForTest ACTIVE_MQ_FOR_TEST = new ActiveMQForTest();
-
+  public static final ExternalResource ACTIVE_MQ_FOR_TEST = new RunExternalResourceConditionally (
+                                                                new ActiveMQForTest(), 
+                                                                runEmbeddedResources);
   @ClassRule
   public static final IntegrationTestEnvironment INTEGRATION_TEST_ENVIRONMENT = new IntegrationTestEnvironment("fineract-demo");
 
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..4b6d0ee
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,5 @@
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8761/eureka/
+    registerWithEureka: false
diff --git a/start-dependencies.sh b/start-dependencies.sh
new file mode 100755
index 0000000..a8341a6
--- /dev/null
+++ b/start-dependencies.sh
@@ -0,0 +1 @@
+docker-compose up -d
diff --git a/stop-dependencies.sh b/stop-dependencies.sh
new file mode 100755
index 0000000..76b3eaf
--- /dev/null
+++ b/stop-dependencies.sh
@@ -0,0 +1,2 @@
+docker-compose down
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services