-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8 add management scripts of docker-compose [ci-skip]
- Loading branch information
Hai Liang Wang
committed
Sep 7, 2019
1 parent
5b6b74d
commit fa9e413
Showing
4 changed files
with
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! /bin/bash | ||
########################################### | ||
# | ||
########################################### | ||
|
||
# constants | ||
baseDir=$(cd `dirname "$0"`;pwd) | ||
rootDir=$(cd $baseDir/../..;pwd) | ||
SUDO_CMD="" | ||
|
||
# functions | ||
|
||
# main | ||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return | ||
which sudo | ||
if [ $? -eq 0 ]; then | ||
SUDO_CMD=sudo | ||
fi | ||
|
||
cd $rootDir | ||
echo "[WARN] wait for 10 seconds before clean up all data, be sure of what you are doing ..." | ||
sleep 10 | ||
set -x | ||
docker-compose stop | ||
|
||
$SUDO_CMD rm -rf var/activemq/data/* | ||
$SUDO_CMD rm -rf var/mysql/data/* | ||
$SUDO_CMD rm -rf var/redis/data/* |
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,15 @@ | ||
#! /bin/bash | ||
########################################### | ||
# | ||
########################################### | ||
|
||
# constants | ||
baseDir=$(cd `dirname "$0"`;pwd) | ||
rootDir=$(cd $baseDir/../..;pwd) | ||
|
||
# functions | ||
|
||
# main | ||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return | ||
cd $rootDir | ||
docker-compose up -d |
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,15 @@ | ||
#! /bin/bash | ||
########################################### | ||
# | ||
########################################### | ||
|
||
# constants | ||
baseDir=$(cd `dirname "$0"`;pwd) | ||
rootDir=$(cd $baseDir/../..;pwd) | ||
|
||
# functions | ||
|
||
# main | ||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return | ||
cd $rootDir | ||
docker-compose down |
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,68 @@ | ||
#! /bin/bash | ||
########################################### | ||
# | ||
########################################### | ||
|
||
# constants | ||
baseDir=$(cd `dirname "$0"`;pwd) | ||
rootDir=$(cd $baseDir/..;pwd) | ||
SUDO_CMD="" | ||
# functions | ||
|
||
# main | ||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return | ||
which sudo | ||
if [ $? -eq 0 ]; then | ||
SUDO_CMD=sudo | ||
fi | ||
|
||
if [ ! -d $baseDir/../tmp ]; then | ||
mkdir $baseDir/../tmp | ||
fi | ||
|
||
cd $baseDir/.. | ||
GIT_COMMIT_SHORT=`git rev-parse --short HEAD` | ||
relasedir=$baseDir/../tmp/clause.dist.$GIT_COMMIT_SHORT | ||
|
||
cd $baseDir/../tmp | ||
rm -rf $relasedir; mkdir $relasedir | ||
|
||
# copy config file | ||
cp $rootDir/sample.env $relasedir/.env | ||
cp $rootDir/docker-compose.yml $relasedir | ||
cp $rootDir/LICENSE $relasedir | ||
cp $rootDir/README.md $relasedir | ||
|
||
# copy database persistence folders | ||
mkdir $relasedir/var | ||
cp -rf $rootDir/var/activemq $relasedir/var | ||
$SUDO_CMD rm -rf $relasedir/var/activemq/data/* | ||
|
||
cp -rf $rootDir/var/redis $relasedir/var | ||
$SUDO_CMD rm -rf $relasedir/var/redis/data/* | ||
|
||
cp -rf $rootDir/var/mysql $relasedir/var | ||
$SUDO_CMD rm -rf $relasedir/var/mysql/data/* | ||
|
||
# copy clause data folder | ||
mkdir $relasedir/var/local | ||
cp -rf $rootDir/var/local/data $relasedir/var/local/data | ||
mkdir -p $relasedir/var/local/workarea | ||
|
||
# copy clause mysql database init script | ||
mkdir -p $relasedir/src/clause/config | ||
cp -rf $rootDir/src/clause/config/sql $relasedir/src/clause/config | ||
|
||
# copy admin scripts | ||
mkdir $relasedir/admin | ||
cp -rf $rootDir/admin/docker $relasedir/admin | ||
|
||
# init git | ||
cp -rf $rootDir/.gitignore $relasedir | ||
cd $relasedir | ||
git init | ||
git add --all | ||
git commit -m "init" | ||
cd .. | ||
|
||
tar czf clause.dist.$GIT_COMMIT_SHORT.tgz clause.dist.$GIT_COMMIT_SHORT |