changeset 112:a2054815e873

complete merge
author smith@nwoca.org
date Mon, 24 Apr 2017 15:41:45 +0100
parents 5e3cf6b7e331 (current diff) 7d781c057956 (diff)
children 40d81a3dd3cc
files
diffstat 14 files changed, 162 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Apr 11 02:18:48 2017 +0100
+++ b/.hgignore	Mon Apr 24 15:41:45 2017 +0100
@@ -1,5 +1,5 @@
 syntax: regexp
-^\.DS_Store
+\.DS_Store
 .*~$
 \.orig$
 \.orig\..*$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/import-usas.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,10 @@
+version: "3"
+services:
+  usasimport:
+    image: docker.ssdt.io/usas-import:preview
+    command: -i ${IMP_IRN} -u ${IMP_URL} -r ${IMP_PATH}
+    environment:
+      - DB_HOST=usasdb
+      - DB_NAME=usasdb
+      - DB_USER=usas
+      - DB_PASS=${USAS_DB_PASSWORD:-usasdefault}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/import-usps.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,10 @@
+version: "3"
+services:
+  uspsimport:
+    image: docker.ssdt.io/usps-import:preview
+    command: -i ${IMP_IRN} -u ${IMP_URL} -r ${IMP_PATH} ${IMP_ANON} ${IMP_EM}
+    environment:
+      - DB_HOST=uspsdb
+      - DB_NAME=uspsdb
+      - DB_USER=usps
+      - DB_PASS=${USPS_DB_PASSWORD:-uspsdefault}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/training.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,34 @@
+version: "3"
+services:
+  usasdb:
+    restart: unless-stopped
+    image: docker.ssdt.io/trainingdb-usas
+    environment:
+      - DB_NAME=usasdb
+      - DB_USER=usas
+      - DB_PASS=usasdefault
+  usasapp:
+    restart: unless-stopped
+    image: docker.ssdt.io/usas-app:preview
+    environment:
+      - DB_HOST=usasdb
+      - DB_NAME=usasdb
+      - DB_USER=usas
+      - DB_PASS=usasdefault
+      - JAVA_OPTS=-Xmx640m
+  uspsdb:
+    restart: unless-stopped
+    image: docker.ssdt.io/trainingdb-usps
+    environment:
+      - DB_NAME=uspsdb
+      - DB_USER=usps
+      - DB_PASS=uspsdefault
+  uspsapp:
+    restart: unless-stopped
+    image: docker.ssdt.io/usps-app:preview
+    environment:
+      - DB_HOST=uspsdb
+      - DB_NAME=uspsdb
+      - DB_USER=usps
+      - DB_PASS=uspsdefault
+      - JAVA_OPTS=-Xmx640m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/usas-template.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,12 @@
+version: "3"
+services:
+  usasdb:
+    extends:
+      file: /ssdt/compose3/preview/usas.yml
+      service: usasdb
+    volumes:
+      - |volumeName|:/var/lib/postgresql/data
+  usasapp:
+    extends:
+       file: /ssdt/compose3/preview/usas.yml
+       service: usasapp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/usas.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,20 @@
+# base compose file for usas Preview release
+version: "3"
+services:
+  usasdb:
+    restart: unless-stopped
+    image: docker.ssdt.io/ssdt-postgres:3
+    environment:
+      - DB_NAME=usasdb
+      - DB_USER=usas
+      - DB_PASS=${USAS_DB_PASSWORD:-usasdefault}
+  usasapp:
+    restart: unless-stopped
+    image: docker.ssdt.io/usas-app:preview
+    environment:
+      - DB_HOST=usasdb
+      - DB_NAME=usasdb
+      - DB_USER=usas
+      - DB_PASS=${USAS_DB_PASSWORD:-usasdefault}
+      - USAS_MODULE_USPSINTEGRATION_CONFIGURATION_USPSCONFIGURATION_SERVERHOST=uspsapp
+      - USAS_MODULE_USPSINTEGRATION_CONFIGURATION_USPSCONFIGURATION_SERVERDNSLOOKUP=true
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/usps.template.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,12 @@
+version: "3"
+services:
+  uspsdb:
+    extends:
+      file: /ssdt/compose/preview/usps.yml
+      service: uspsdb
+    volumes:
+      - |volumeName|:/var/lib/postgresql/data
+  uspsapp:
+    extends:
+       file: /ssdt/compose/preview/usps.yml
+       service: uspsapp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compose3/preview/usps.yml	Mon Apr 24 15:41:45 2017 +0100
@@ -0,0 +1,20 @@
+# base compose file for usps Preview release
+version: "3"
+services:
+  uspsdb:
+    restart: unless-stopped
+    image: docker.ssdt.io/ssdt-postgres:3
+    environment:
+      - DB_NAME=uspsdb
+      - DB_USER=usps
+      - DB_PASS=${USPS_DB_PASSWORD:-uspsdefault}
+  uspsapp:
+    restart: unless-stopped
+    image: docker.ssdt.io/usps-app:preview
+    environment:
+      - DB_HOST=uspsdb
+      - DB_NAME=uspsdb
+      - DB_USER=usps
+      - DB_PASS=${USPS_DB_PASSWORD:-uspsdefault}
+      - USPS_MODULE_USASINTEGRATION_CONFIGURATION_USASCONFIGURATION_SERVERHOST=usasapp
+      - USPS_MODULE_USASINTEGRATION_CONFIGURATION_USASCONFIGURATION_SERVERDNSLOOKUP=true
--- a/init.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/init.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,3 +1,6 @@
 #!/bin/bash
-alias utils='docker run -it -v ${PWD}:/tmp -v /ssdt:/ssdt --rm docker.ssdt.io/ssdt-utils'
-alias send2ssdt='/ssdt/scripts/send.sh'
\ No newline at end of file
+source "$( dirname "${BASH_SOURCE[0]}")/scripts/.functions.sh"
+alias utils='docker run -it -v ${PWD}:/tmp -v $SSDT_HOME:/ssdt --rm docker.ssdt.io/ssdt-utils'
+alias send2ssdt='/ssdt/scripts/send.sh'
+
+export PATH=$PATH:$SSDT_HOME/scripts
--- a/scripts/.functions.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/scripts/.functions.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,4 +1,6 @@
 #!/bin/bash
+export SSDT_SCRIPTS=$(dirname "${BASH_SOURCE[0]}")
+export SSDT_HOME=$(dirname $SSDT_SCRIPTS)
 
 # deletes psql data from specified service
 resetDbVolume() {
@@ -26,4 +28,10 @@
    container=$(composeGetContainer $service)
 
    echo "$2" | docker exec -i $container  sh -c "gosu postgres psql \$DB_NAME"
-}
\ No newline at end of file
+}
+
+composeGetProject() {  
+  service=${1?"Must supply service from current project"}
+  container=$(composeGetContainer $service)
+  echo $(docker inspect -f '{{index .Config.Labels "com.docker.compose.project" }}' $container)
+}
--- a/scripts/capture.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/scripts/capture.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,3 +1,3 @@
 #!/bin/bash
-# writes tail of current logs to standard out from running containers in compose project.
-docker-compose ps -q | xargs -I ID docker inspect --format='{{.LogPath}}' ID | xargs tail -n${1-8000}
+# writes tail of current logs to standard out from containers in compose project.
+docker-compose logs --no-color $1
\ No newline at end of file
--- a/scripts/console.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/scripts/console.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,11 +1,23 @@
 #!/bin/bash
+# connects to the telnet console of the application for the specified service of the current project
+# For docker 1.12 and compose 1.9 (and higher) assume project is assigned to a network 
+#  named "${project}_default" per SSDT templates.
 
-# connects to the telnet console of the application for the specified service of the current project
 source "$( dirname "${BASH_SOURCE[0]}")/.functions.sh"
 
 container=$(composeGetContainer ${1?"Must specify the app service of the console to connect to"} )
 
 ip=$(docker inspect -f '{{.NetworkSettings.IPAddress}}' $container)
 
-docker run -it -v ${PWD}:/tmp -v /ssdt:/ssdt --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+if [ "$ip" == "" ]
+then
+   ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container)
+   project=$(composeGetProject ${1} )
+fi
 
+if [ "$project" == "" ]
+then 
+  docker run -it -v ${PWD}:/tmp  -v ${SSDT_HOME}:/ssdt --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+else
+  docker run -it --network ${project}_default --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+fi
--- a/scripts/info.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/scripts/info.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,13 +1,13 @@
 #!/bin/bash
+ source "$( dirname "${BASH_SOURCE[0]}")/.functions.sh"
 echo $BASH_VERSION
 docker version
 docker-compose version
 echo "------- Docker info-------------"
 docker info
 echo "------- Images -----------------"
-/ssdt/scripts/d-images.sh
+ $SSDT_HOME/scripts/d-images.sh
 echo "------- Containers------"
-/ssdt/scripts/d-ps.sh
+ $SSDT_HOME/scripts/d-ps.sh
 echo "------- OS Processes------------"
 top -b -n 1
-
--- a/scripts/send.sh	Tue Apr 11 02:18:48 2017 +0100
+++ b/scripts/send.sh	Mon Apr 24 15:41:45 2017 +0100
@@ -1,4 +1,12 @@
 #!/bin/bash
+#
+# Securely sends a file or standard input to a SSDT web server.
+# e.g:
+#     capture.sh | send.sh -   # sends log files to ssdt server for the current project
+#     send.sh docker-compose.yml  # sends the compose file
+#
+source "$( dirname "${BASH_SOURCE[0]}")/.functions.sh"
+
 file=${1?"Usage: $0 filename [name]\n specify the filename relative to the current directory or - for stdin.\noptionally specify a short name (default to base directory)"}
 if [ "$file" != "-" ]
 then
@@ -6,5 +14,6 @@
 fi
 name=${2:-$(basename $PWD)}
 source=$(hostname)
-docker run -i -v /ssdt:/ssdt -v ${PWD}:/tmp --rm docker.ssdt.io/ssdt-utils \
+
+docker run -i -v $SSDT_HOME:/ssdt -v ${PWD}:/tmp --rm docker.ssdt.io/ssdt-utils \
    curl -F source=$source -F name=$name -F file=@$file https://upload.ssdt.io/upload
\ No newline at end of file