Mercurial > public > ssdt-docker
annotate scripts/console.sh @ 108:b2b23cdaabcd feature/djs-DEP-12-docker
DEP-12: convert to v2.
author | smith@nwoca.org |
---|---|
date | Fri, 21 Apr 2017 20:42:18 +0100 |
parents | 8f45c43ea7a4 |
children | ae2b4a5294ff |
rev | line source |
---|---|
44
e5ba33051de7
add scripts and compose file for importing from server
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
1 #!/bin/bash |
85
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
2 # connects to the telnet console of the application for the specified service of the current project |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
3 # For docker 1.12 and compose 1.9 (and higher) assume project is assigned to a network |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
4 # named "${project}_default" per SSDT templates. |
44
e5ba33051de7
add scripts and compose file for importing from server
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
5 |
73 | 6 source "$( dirname "${BASH_SOURCE[0]}")/.functions.sh" |
7 | |
74
541766977a11
add script to connect to telnet console of usxsapp
smith@nwoca.org
parents:
73
diff
changeset
|
8 container=$(composeGetContainer ${1?"Must specify the app service of the console to connect to"} ) |
44
e5ba33051de7
add scripts and compose file for importing from server
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
9 |
74
541766977a11
add script to connect to telnet console of usxsapp
smith@nwoca.org
parents:
73
diff
changeset
|
10 ip=$(docker inspect -f '{{.NetworkSettings.IPAddress}}' $container) |
44
e5ba33051de7
add scripts and compose file for importing from server
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
11 |
85
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
12 if [ "$ip" == "" ] |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
13 then |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
14 ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container) |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
15 project=$(composeGetProject ${1} ) |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
16 fi |
74
541766977a11
add script to connect to telnet console of usxsapp
smith@nwoca.org
parents:
73
diff
changeset
|
17 |
85
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
18 if [ "$project" == "" ] |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
19 then |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
20 docker run -it -v ${PWD}:/tmp -v ${SSDT_HOME}:/ssdt --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
21 else |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
22 docker run -it --network ${project}_default --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log |
8f45c43ea7a4
DEP-12: start upgrading scripts and compose files for RC and docker 1.12
Dave Smith <smith@nwoca.org>
parents:
74
diff
changeset
|
23 fi |