Skip to content

Commit

Permalink
Merge branch 'release/v4.2.3-8'
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudFlo2312 authored and cesmarvin committed Feb 15, 2022
2 parents 1b9b6a1 + 7aa1357 commit 6d728e7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 36 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion dogu.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
41 changes: 9 additions & 32 deletions resources/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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());"
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6d728e7

Please sign in to comment.