|
@ -636,6 +636,13 @@ compose:psql() { |
|
|
} |
|
|
} |
|
|
export -f compose:psql |
|
|
export -f compose:psql |
|
|
|
|
|
|
|
|
|
|
|
compose:mongo() { |
|
|
|
|
|
local project_name="$1" dbname="$2" container_id |
|
|
|
|
|
container_id=$(compose:charm:container_one "$project_name" "mongo") || return 1 |
|
|
|
|
|
docker exec -i "${container_id}" mongo --quiet "$dbname" |
|
|
|
|
|
} |
|
|
|
|
|
export -f compose:mongo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compose:pgm() { |
|
|
compose:pgm() { |
|
|
local project_name="$1" container_network_ip container_ip container_network |
|
|
local project_name="$1" container_network_ip container_ip container_network |
|
@ -715,6 +722,15 @@ cyclos:unlock() { |
|
|
export -f cyclos:unlock |
|
|
export -f cyclos:unlock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rocketchat:drop-indexes() { |
|
|
|
|
|
local project_name="$1" dbname="$2" |
|
|
|
|
|
|
|
|
|
|
|
echo "db.users.dropIndexes()" | |
|
|
|
|
|
compose:mongo "${project_name}" "${dbname}" |
|
|
|
|
|
} |
|
|
|
|
|
export -f rocketchat:drop-indexes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compose:project_name() { |
|
|
compose:project_name() { |
|
|
if [ -z "$PROJECT_NAME" ]; then |
|
|
if [ -z "$PROJECT_NAME" ]; then |
|
|
PROJECT_NAME=$(compose --get-project-name) || { |
|
|
PROJECT_NAME=$(compose --get-project-name) || { |
|
@ -1391,4 +1407,43 @@ cmdline.spec:cyclos:cmd:unlock:run() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmdline.spec.gnu rocketchat |
|
|
|
|
|
|
|
|
|
|
|
cmdline.spec::cmd:rocketchat:run() { |
|
|
|
|
|
: |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cmdline.spec.gnu drop-indexes |
|
|
|
|
|
cmdline.spec:rocketchat:cmd:drop-indexes:run() { |
|
|
|
|
|
|
|
|
|
|
|
: :optval: --database,-d "Target database ('rocketchat' if not specified)" |
|
|
|
|
|
: :optval: --service,-s "The rocketchat service name (defaults to 'rocketchat')" |
|
|
|
|
|
|
|
|
|
|
|
local URL |
|
|
|
|
|
|
|
|
|
|
|
rocketchat_database=${opt_database:-rocketchat} |
|
|
|
|
|
rocketchat_service="${opt_service:-rocketchat}" |
|
|
|
|
|
project_name=$(compose:project_name) || exit 1 |
|
|
|
|
|
container_id=$(compose:service:container_one "${project_name}" "${rocketchat_service}") || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
Wrap -d "stop ${DARKYELLOW}${rocketchat_service}${NORMAL}'s container" -- \ |
|
|
|
|
|
docker stop "$container_id" || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
errlvl=0 |
|
|
|
|
|
Wrap -d "drop indexes" -- \ |
|
|
|
|
|
rocketchat:drop-indexes "${project_name}" "${rocketchat_database}" || { |
|
|
|
|
|
errlvl=1 |
|
|
|
|
|
errmsg="Failed to drop indexes" |
|
|
|
|
|
} |
|
|
|
|
|
Wrap -d "start ${DARKYELLOW}${rocketchat_service}${NORMAL}'s container" -- \ |
|
|
|
|
|
docker start "${container_id}" || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
if [ "$errlvl" != 0 ]; then |
|
|
|
|
|
err "$errmsg" |
|
|
|
|
|
fi |
|
|
|
|
|
exit "$errlvl" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmdline::parse "$@" |
|
|
cmdline::parse "$@" |