Mercurial > public > ssdt-docker
changeset 107:dc3696525de4 feature/djs-DEP-12-docker
merge from default
author | smith@nwoca.org |
---|---|
date | Fri, 21 Apr 2017 17:17:24 +0100 |
parents | bd1f900972ed (diff) 5e3cf6b7e331 (current diff) |
children | b2b23cdaabcd |
files | compose/preview/debug.yml |
diffstat | 11 files changed, 137 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue Apr 11 02:18:48 2017 +0100 +++ b/.hgignore Fri Apr 21 17:17:24 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/compose2/preview/training.yml Fri Apr 21 17:17:24 2017 +0100 @@ -0,0 +1,41 @@ +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 + volumes: + - ${PWD}/config:/config + environment: + - DB_HOST=usas-database + - DB_NAME=usasdb + - DB_USER=usas + - DB_PASS=usasdefault + - JAVA_OPTS=-Xmx640m + links: + - usasdb:usas-database +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 + volumes: + - ${PWD}/config:/config + environment: + - DB_HOST=usps-database + - DB_NAME=uspsdb + - DB_USER=usps + - DB_PASS=uspsdefault + - JAVA_OPTS=-Xmx640m + links: + - uspsdb:usps-database +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compose2/preview/usas-template.yml Fri Apr 21 17:17:24 2017 +0100 @@ -0,0 +1,12 @@ +version: "2" +services: + usasdb: + extends: + file: /ssdt/compose/preview/usas.yml + service: usasdb + volumes: + - |volumeName|:/var/lib/postgresql/data + usasapp: + extends: + file: /ssdt/compose/preview/usas.yml + service: usasapp \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compose2/preview/usas.yml Fri Apr 21 17:17:24 2017 +0100 @@ -0,0 +1,20 @@ +version: "2" +services: + usasdb: + restart: unless-stopped + image: docker.ssdt.io/ssdt-postgres:3 + 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 + - ORG_SSDT_OHIO_USAS_MODULE_USPSINTEGRATION_CONFIGURATION_USPSCONFIGURATION_SERVERHOST=uspsapp + - ORG_SSDT_OHIO_USAS_MODULE_USPSINTEGRATION_CONFIGURATION_USPSCONFIGURATION_SERVERDNSLOOKUP=true +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compose2/preview/usps.yml Fri Apr 21 17:17:24 2017 +0100 @@ -0,0 +1,20 @@ +# base compose file for usps Release Candidate release +version: "2" +services: + uspsdb: + restart: unless-stopped + image: docker.ssdt.io/ssdt-postgres:3 + 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 + - ORG_SSDT_OHIO_USPS_MODULE_USASINTEGRATION_CONFIGURATION_USASCONFIGURATION_SERVERHOST=usasapp + - ORG_SSDT_OHIO_USPS_MODULE_USASINTEGRATION_CONFIGURATION_USASCONFIGURATION_SERVERDNSLOOKUP=true
--- a/init.sh Tue Apr 11 02:18:48 2017 +0100 +++ b/init.sh Fri Apr 21 17:17:24 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 Fri Apr 21 17:17:24 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 Fri Apr 21 17:17:24 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 Fri Apr 21 17:17:24 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 Fri Apr 21 17:17:24 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 Fri Apr 21 17:17:24 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