From 3ef98b0abd50c0a005b35d2aee57621e2ffafe0c 2022-12-13 20:13:22 From: RhodeCode Admin Date: 2022-12-13 20:13:22 Subject: [PATCH] rccontrol: self-update only updates once there's a new version. --- diff --git a/scripts/rccontrol/rccontrol b/scripts/rccontrol/rccontrol index 6fdb49a..a3b9377 100755 --- a/scripts/rccontrol/rccontrol +++ b/scripts/rccontrol/rccontrol @@ -1275,6 +1275,8 @@ get_docker_definitions() { echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" + # cleanup + } # src/lib/send_completions.sh @@ -1450,16 +1452,23 @@ rccontrol_self_update_command() { FETCH_FROM=$SERVER_URL/rhodecode-enterprise-docker/raw/master/scripts/rccontrol/rccontrol TARGET=$PWD/scripts/rccontrol/rccontrol + version_old=$($TARGET --version) + echo "$(green self-update: downloading new rccontrol script from $FETCH_FROM)" - curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $TARGET -L $FETCH_FROM + curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $TARGET -L $FETCH_FROM chmod +x $TARGET - echo "$(green self-update: done ! File saved in $TARGET)" + version_dl=$($TARGET --version) + echo "self-update: version downloaded: $version_dl" - get_docker_definitions $revision + if [[ $version_old == $version_dl ]]; then + echo "$(yellow self-update: no new version available, latest seems to be $version_dl)" + exit + else + echo "$(green self-update: update to new version: $version_dl)" + fi - echo "$(green self-update: done ! new version info:)" - ./rccontrol --version + get_docker_definitions $revision exit } @@ -1565,7 +1574,7 @@ rccontrol_bootstrap_command() { .env set +RC_SQLALCHEMY_DB1_URL="postgresql://$DB_USER:$db_key@database/$DB_NAME" .env set +RC_LICENSE_TOKEN=$license_token - .env set +RC_BASE_URL=$base_url + .env set +RC_APP_BASE_URL=$base_url .env puts '# Log formatter option' .env set +RC_LOG_FORMATTER=$log_formatter @@ -1573,9 +1582,13 @@ rccontrol_bootstrap_command() { .env puts '# Channelstream config' .env set +RC_CHANNELSTREAM_WS_URL=ws:/docker-dev/_channelstream + .env set +CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 + .env set +CHANNELSTREAM_SECRET=$shared_key + .env set +RC_CHANNELSTREAM_SECRET=$shared_key + .env set +CHANNELSTREAM_ADMIN_SECRET=$shared_key - .env set +CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 + .env set +RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key else echo "bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration..." @@ -2155,6 +2168,10 @@ rccontrol_cli_storage_command() { # echo "---" #fi + echo "attaching $PWD/.custom/storage under /vol/backupvolume" + echo "attaching rc_datavolume under /vol/datavolume " + echo "attaching rc_reposvolume under /vol/repovolume" + docker run --rm \ -it \ --volume $PWD/.custom/storage:/vol/backupvolume \ @@ -3793,7 +3810,7 @@ rccontrol__completions_parse_requirements() { # :command.initialize initialize() { - version="4.28.0.rel2022.12.13.1" + version="4.28.0.rel2022.12.13.2" long_usage='' set -e diff --git a/templates/runtime.env.tmpl b/templates/runtime.env.tmpl index 61cf99e..3161c59 100644 --- a/templates/runtime.env.tmpl +++ b/templates/runtime.env.tmpl @@ -24,4 +24,6 @@ RHODECODE_USER_EMAIL=admin@server-com RHODECODE_USER_NAME=admin RHODECODE_USER_PASS=secret4 -RC_USE_CELERY=true \ No newline at end of file +RC_USE_CELERY=true + +RC_APP_BASE_URL=base-url \ No newline at end of file