diff --git a/CHANGELOG.md b/CHANGELOG.md index 538f72a..dd51f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [v4.2.3-8] - 2022-02-15 +### Changed +- Upgrade cas plugin to version 2.0.0 (#88) +- Remove sql-statements to initialize the cas plugin and use the new rake tasks instead (#88) + ## [v4.2.3-7] - 2022-02-07 ### Changed - Upgrade to base image 3.14.3-1 diff --git a/Dockerfile b/Dockerfile index 9a56547..42a94b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,14 @@ FROM registry.cloudogu.com/official/base:3.14.3-1 LABEL NAME="official/redmine" \ - VERSION="4.2.3-7" \ + VERSION="4.2.3-8" \ maintainer="hello@cloudogu.com" # This Dockerfile is based on https://github.com/docker-library/redmine/blob/master/4.0/alpine/Dockerfile # set environment variables ENV REDMINE_VERSION=4.2.3 \ - CAS_PLUGIN_VERSION=1.5.2 \ + CAS_PLUGIN_VERSION=2.0.0 \ ACTIVERECORD_SESSION_STORE_PLUGIN_VERSION=0.1.0 \ EXTENDED_REST_API_PLUGIN_VERSION=1.1.0 \ RUBYCASVERSION=2.3.15 \ @@ -19,7 +19,7 @@ ENV REDMINE_VERSION=4.2.3 \ SERVICE_TAGS=webapp \ RAILS_ENV=production \ REDMINE_TARGZ_SHA256=72f633dc954217948558889ca85325fe6410cd18a2d8b39358e5d75932a47a0c \ - CAS_PLUGIN_TARGZ_SHA256=5095a32b8b56c48280fb9a33580ec5925fdcbecbfec1a3f69930b78e2fb4a109 \ + CAS_PLUGIN_TARGZ_SHA256=f296de1a13ee1d52d545c0ee29c685f8eb46b606ccabd16fe3e392008c892f96 \ EXTENDED_REST_API_TARGZ_SHA256=7def9dee6a72f7a98c34c3d0beb17dabd414a1af86153624eb03ffe631272b31 \ ACTIVERECORD_TARGZ_SHA256=a5d3a5ac6c5329212621bab128a2f94b0ad6bb59084f3cc714786a297bcdc7ee \ RUBYCAS_TARGZ_SHA256=9ca9b2e020c4f12c3c7e87565b9aa19dda130912138d80ad6775e5bdc2d4ca66 \ diff --git a/dogu.json b/dogu.json index 69f5cea..6500bb9 100644 --- a/dogu.json +++ b/dogu.json @@ -1,6 +1,6 @@ { "Name": "official/redmine", - "Version": "4.2.3-7", + "Version": "4.2.3-8", "DisplayName": "Redmine", "Description": "Redmine is a flexible project management web application", "Category": "Development Apps", diff --git a/resources/startup.sh b/resources/startup.sh index 9f69fdc..9c853b3 100755 --- a/resources/startup.sh +++ b/resources/startup.sh @@ -90,10 +90,6 @@ function runMain() { # Make sure secrets.yml exists create_secrets_yml - # export variables for auth_source_cas.rb - export FQDN - export ADMIN_GROUP - # wait until postgresql passes all health checks echo "wait until postgresql passes all health checks" if ! doguctl healthy --wait --timeout 120 postgresql; then @@ -112,28 +108,6 @@ function runMain() { # update FQDN in settings # we need to update the fqdn on every start, because of possible changes sql "UPDATE settings SET value='${HOSTNAME_SETTING}' WHERE name='host_name';" - - echo "Get cas plugin config values..." - - # Get the configured value for the redmine cas plugin config - OLD_SETTINGS="$(get_setting_value "plugin_redmine_cas")" - - # Extract the value for the redirect_enabled config - VALUE_REDIRECT_SETTING="$(echo "${OLD_SETTINGS}" |grep "redirect_enabled: '" |sed "s/^[^']*'\([^']*\)'.*$/\1/g" || echo "0")" - - # Value: 1 => true / not existing => false - # Even value: 0 would still be true. This is why this step is necessary. - REDIRECT_SETTINGS="redirect_enabled: 1 \\n" - if [ "${VALUE_REDIRECT_SETTING}" != "1" ] - then - REDIRECT_SETTINGS="" - fi - - echo "Updating cas plugin settings..." - - # Reason for this update: The cas plugin config should not be configurable. This lock out the user and make the dogu unusable. - # This is why the config is overridden at each start. The only flag that must be configurable is the redirect_enabled flag. - sql "UPDATE settings SET value=E'--- !ruby/hash:ActionController::Parameters \\nenabled: 1 \\n${REDIRECT_SETTINGS}cas_url: https://${FQDN}/cas \\nattributes_mapping: firstname=givenName&lastname=surname&mail=mail \\nautocreate_users: 1' WHERE name='plugin_redmine_cas';" >/dev/null 2>&1 else # Create the database structure @@ -144,16 +118,12 @@ function runMain() { echo "Inserting default configuration data into database..." exec_rake redmine:load_default_data - echo "Writing cas plugin settings to database..." - sql "INSERT INTO settings (name, value, updated_on) VALUES ('plugin_redmine_cas', E'--- !ruby/hash:ActionController::Parameters \\nenabled: 1 \\ncas_url: https://${FQDN}/cas \\nattributes_mapping: firstname=givenName&lastname=surname&mail=mail \\nautocreate_users: 1', now());" + echo "Writing authentication settings to database..." sql "INSERT INTO settings (name, value, updated_on) VALUES ('login_required', 1, now());" # Enabling REST API sql "INSERT INTO settings (name, value, updated_on) VALUES ('rest_api_enabled', 1, now());" - # Insert auth_sources record for AuthSourceCas authentication source - sql "INSERT INTO auth_sources VALUES (DEFAULT, 'AuthSourceCas', 'Cas', 'cas.example.com', 1234, 'myDbUser', 'myDbPass', 'dbAdapter:dbName', 'name', 'firstName', 'lastName', 'email', true, false, null, null);" - # write url settings to database sql "INSERT INTO settings (name, value, updated_on) VALUES ('host_name','${HOSTNAME_SETTING}', now());" sql "INSERT INTO settings (name, value, updated_on) VALUES ('protocol','https', now());" @@ -179,6 +149,13 @@ function runMain() { doguctl config "${SETUP_DONE_KEY}" "true" fi + echo "Updating cas plugin settings..." + exec_rake redmine_cas:change_setting\[enabled,"1"\] + exec_rake redmine_cas:change_setting\[attributes_mapping,"firstname=givenName&lastname=surname&mail=mail&login=username&allgroups=allgroups"\] + exec_rake redmine_cas:change_setting\[redmine_fqdn,"${FQDN}"\] + exec_rake redmine_cas:change_setting\[cas_fqdn,"${FQDN}"\] + exec_rake redmine_cas:change_setting\[cas_relative_url,"/cas"\] + exec_rake redmine_cas:change_setting\[admin_group,"${ADMIN_GROUP}"\] # install manual installed plugins install_plugins @@ -212,7 +189,7 @@ function runMain() { # Start redmine echo "Starting redmine..." - exec su - redmine -c "FQDN=${FQDN} ADMIN_GROUP=${ADMIN_GROUP} RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT} puma -e ${RAILS_ENV} -p 3000" + exec su - redmine -c "AUTO_MANAGED=true RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT} puma -e ${RAILS_ENV} -p 3000" } # make the script only run when executed, not when sourced from bats tests)