Browse Source

Making everything start up and connect

Jim Barritt 10 months ago
parent
commit
b2ee5e02b0

+ 2 - 2
apps/petitions/decode-app/config/server.yaml

@@ -5,8 +5,8 @@ development:
5 5
   mongo-connection-timeout: 1000
6 6
   mongo-socket-timeout: 1000
7 7
   database:        "decode_sample"
8
-  chainspace-host: "http://127.0.0.1"
9
-  chainspace-port: 5010
8
+  chainspace-host: "http://localhost"
9
+  chainspace-port: 5000
10 10
 
11 11
 test:
12 12
   mongo-port:      27017

+ 2 - 2
apps/petitions/decode-app/ops/local/_docker-compose.yml

@@ -5,6 +5,6 @@ services:
5 5
     ports:
6 6
      - "27017:27017"
7 7
   chainspace:
8
-    image: "chainspace"
8
+    image: "decodeproject/chainspace-java-2-nodes:SNAPSHOT"
9 9
     ports:
10
-      - "5000:5000"
10
+      - "5000:5010"

+ 6 - 6
apps/petitions/decode-app/ops/local/decode-app.sh

@@ -16,7 +16,7 @@ DECODE_APP_PORT=40300
16 16
 DECODE_APP_URL="http://localhost:${DECODE_APP_PORT}"
17 17
 DECODE_APP_DB_NAME="decode_sample"
18 18
 
19
-DECODE_APP_LOG_FILE=/var/log/decode-app/system.log
19
+DECODE_APP_LOG_FILE=/var/log/secure-petition/decode-connector.log
20 20
 
21 21
 function check_pre_requisites {
22 22
     lib/command_exists sass "Install using 'brew install sass/sass/sass' or visit https://sass-lang.com/install"
@@ -58,10 +58,10 @@ function package {
58 58
   echo -e "\nPackage Complete and should be in target dir\n"
59 59
 }
60 60
 
61
-function up {
61
+function start {
62 62
     DEBUG=${1:-}
63 63
     if [[ ${DEBUG} == "debug" ]]; then
64
-        echo -e "\nBringing up local decode-app in foreground in debug mode (you can edit and live reload the changes). To kill. CTRL+C."
64
+        echo -e "\nStarting decode-app in foreground in debug mode (you can edit and live reload the changes). To kill. CTRL+C."
65 65
         lein ring server-headless
66 66
         echo -e "\nExited the server..\n"
67 67
     else
@@ -76,8 +76,8 @@ function up {
76 76
 }
77 77
 
78 78
 # https://www.tecmint.com/how-to-kill-a-process-in-linux/
79
-function down {
80
-    echo -e "\nTaking down local decode-app..."
79
+function stop {
80
+    echo -e "\nStopping local decode-app..."
81 81
 
82 82
 
83 83
     if [[ ! -e .decode-app.pid ]]; then
@@ -107,4 +107,4 @@ function init-db {
107 107
 }
108 108
 
109 109
 
110
-lib/process_commands $@
110
+lib/process_commands $@

+ 0 - 3
apps/petitions/decode-app/ops/local/docker.sh

@@ -21,9 +21,6 @@ function status {
21 21
 }
22 22
 
23 23
 function init {
24
-    cd ${SCRIPT_HOME}/../artifact/chainspace
25
-    docker build -t chainspace-dev:v1.0
26
-    cd -
27 24
     ${DOCKER_COMMAND} up --no-start
28 25
 
29 26
 }

+ 1 - 1
apps/petitions/decode-app/src/decode_app/chainspace.clj

@@ -10,7 +10,7 @@
10 10
 
11 11
 (defn status []
12 12
   (try
13
-    (let [response (client/get (get-url "/"))]
13
+    (let [response (client/get (get-url "/api/1.0/"))]
14 14
       (if (client/success? response)
15 15
         (array-map :status "UP" :url (get-url "") )
16 16
         (array-map :status "DOWN" :url (get-url "")  :description (str "[" (:status response) "] " (:body response)))))

+ 3 - 0
apps/petitions/decode-app/src/decode_app/status.clj

@@ -2,6 +2,9 @@
2 2
   (:require [decode-app.database :as db]
3 3
             [decode-app.chainspace :as cs]))
4 4
 
5
+
6
+;; https://stackoverflow.com/questions/25389261/which-http-status-code-should-i-use-for-a-health-check-failure/40424959#40424959
7
+;; https://tools.ietf.org/html/draft-inadarei-api-health-check-00
5 8
 (defn get-status []
6 9
   {:database (db/status)
7 10
    :chainspace (cs/status)})

+ 4 - 0
apps/petitions/decode-app/xec.sh

@@ -42,10 +42,14 @@ function init_docker {
42 42
 
43 43
 function up {
44 44
     mongo start
45
+    chainspace start
46
+    decode-app start
45 47
 }
46 48
 
47 49
 
48 50
 function down {
51
+    decode-app stop
52
+    chainspace stop
49 53
     mongo stop
50 54
 }
51 55