-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-729 1. Port 5984 forwarded from VM to host. 2. `couchdb` script added in devenv/tools/bin to start and stop couchdb. Change-Id: I830b6914422bf6e3d7ffbc7b8fffc8ad736d1f7b Signed-off-by: Luis Sanchez <sanchezl@us.ibm.com>
- Loading branch information
Luis Sanchez
committed
Oct 24, 2016
1 parent
038ea83
commit 288fed0
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
couchDbContainerStatus() { | ||
for s in created restarting running paused exited dead ; do | ||
if [ -n "$(docker ps --all --quiet --filter name=couchdb --filter status=$s)" ] ; then | ||
echo $s | ||
return 0 | ||
fi | ||
done | ||
} | ||
|
||
case "$1" in | ||
"start") | ||
case "$(couchDbContainerStatus)" in | ||
"created" ) | ||
echo "Starting couchdb container..." | ||
docker start couchdb | ||
;; | ||
"exited" ) | ||
echo "Restarting couchdb container..." | ||
docker restart couchdb | ||
;; | ||
"paused" ) | ||
echo "Unpausing couchdb container..." | ||
docker unpause couchdb | ||
;; | ||
"running" ) | ||
echo "couchdb container is already started" | ||
docker ps --filter name=couchdb | ||
;; | ||
"restarting" | "dead" | * ) | ||
# if running, restarting, or dead, just let user deal with error | ||
docker run \ | ||
--publish 5984:5984 `# publish port` \ | ||
--detach `# run as daemon` \ | ||
--name couchdb `# name container` \ | ||
`# map database dir to a host dir` \ | ||
klaemo/couchdb:2.0.0 | ||
;; | ||
esac | ||
;; | ||
"stop") | ||
echo "Stopping couchdb container..." | ||
docker stop couchdb | ||
;; | ||
"status" | *) | ||
docker ps --all --filter name=couchdb --format "{{.Status}}" | ||
;; | ||
esac |