|
|
#!/usr/bin/env bash
|
|
|
set -euo pipefail
|
|
|
IFS=$'\n\t'
|
|
|
CURRENT_USER_UID=$(id -u)
|
|
|
CURRENT_USER_GID=$(id -g)
|
|
|
USER_UID=${USER_UID:-$CURRENT_USER_UID}
|
|
|
USER_GID=${USER_GID:-$CURRENT_USER_GID}
|
|
|
CMD="docker-compose -f docker-compose.yml"
|
|
|
BUILD_CMD="docker-compose -f docker-compose.yaml -f docker-compose.source.yaml"
|
|
|
DEV_CMD="docker-compose -f docker-compose.yaml -f docker-compose.source.yaml -f docker-compose.dev.yaml"
|
|
|
DEV_CMD="docker-compose -f docker-compose.yaml -f docker-compose.source.yaml -f docker-compose.dev.yaml"
|
|
|
METRICS_CMD="docker-compose -f docker-compose-grafana.yaml"
|
|
|
|
|
|
usage="$(basename "$0") ./dev.sh <COMMAND> -- run docker command
|
|
|
where <COMMAND>:
|
|
|
[v]cs -- run bash console for vcsserver
|
|
|
[r]c -- run bash console for rhodecode-ee
|
|
|
ce -- run bash console for rhodecode-ce
|
|
|
[t]est[s] -- run bash console for rhodecode-ce tests
|
|
|
test-mysql -- run bash console for rhodecode-ce tests with mysql
|
|
|
test-pgsql -- run bash console for rhodecode-ce tests with postgres
|
|
|
dev-build -- build rhodecode dev app for use without cache use
|
|
|
dev-env -- run the dev stack required for development
|
|
|
redis -- run the redis CLI attached to rc_cluster_redis_1
|
|
|
db -- run the db bash attached to rc_cluster_database_1
|
|
|
[m]etrics -- run the metrics stack
|
|
|
run <cmd> -- run <cmd>"
|
|
|
|
|
|
case ${1:-} in
|
|
|
v|vcs )
|
|
|
eval "(docker stop dev-vcsserver || echo skip-stop ) && ${DEV_CMD} run --service-ports --rm --use-aliases --workdir="/home/rhodecode/rhodecode-vcsserver" --name="dev-vcsserver" vcsserver bash"
|
|
|
exit
|
|
|
;;
|
|
|
r|rc )
|
|
|
eval "(docker stop dev-enterprise-ee || echo skip-stop ) && ${DEV_CMD} run --publish 8080:8080 --rm --use-aliases --workdir="/home/rhodecode/rhodecode-enterprise-ee" --name="dev-enterprise-ee" rhodecode bash"
|
|
|
exit
|
|
|
;;
|
|
|
ce )
|
|
|
eval "(docker stop dev-enterprise-ce || echo skip-stop ) && ${DEV_CMD} run --publish 8081:8080 --rm --use-aliases --workdir="/home/rhodecode/rhodecode-enterprise-ce" --name="dev-enterprise-ce" rhodecode bash"
|
|
|
exit
|
|
|
;;
|
|
|
t|test|tests )
|
|
|
eval "${DEV_CMD} run --rm --use-aliases --workdir="/home/rhodecode/rhodecode-enterprise-ce" --name="enterprise-dev-test" rhodecode bash"
|
|
|
exit
|
|
|
;;
|
|
|
dev-build )
|
|
|
eval "${BUILD_CMD} up --detach database && ${BUILD_CMD} build --no-cache --progress=plain rhodecode"
|
|
|
exit
|
|
|
;;
|
|
|
dev-env )
|
|
|
eval "${BUILD_CMD} up --detach database redis channelstream nginx celery beat elasticsearch"
|
|
|
exit
|
|
|
;;
|
|
|
redis )
|
|
|
eval "docker exec --interactive --tty rc_cluster_redis_1 redis-cli"
|
|
|
exit
|
|
|
;;
|
|
|
db )
|
|
|
eval "docker exec --interactive --tty rc_cluster_database_1 /bin/bash -c 'psql -U $$POSTGRES_USER' "
|
|
|
exit
|
|
|
;;
|
|
|
m|metrics )
|
|
|
eval "${METRICS_CMD} up --detach"
|
|
|
exit
|
|
|
;;
|
|
|
run )
|
|
|
command=${@:2}
|
|
|
eval "${DEV_CMD} run --rm rhodecode ${command}"
|
|
|
exit
|
|
|
;;
|
|
|
* )
|
|
|
echo "${usage}"
|
|
|
exit
|
|
|
;;
|
|
|
esac
|
|
|
|