Skip to content

Commit

Permalink
Merge pull request #551 from siberianlove/feature-configure-logger
Browse files Browse the repository at this point in the history
Add logger level configuration support
  • Loading branch information
jcormier committed Apr 4, 2024
2 parents 32c7283 + 1038183 commit 9586049
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ Below is the complete list of parameters that can be set using environment varia
- **DB_POOL**: The database connection pool count. Defaults to `5`.
- **DB_SKIP_CHECK**: Skip waiting for the database to start. Defaults to `false`.
- **DB_SSL_MODE**: Configures the database ssl mode. Valid options for [postgresql](https://www.postgresql.org/docs/9.1/libpq-ssl.html) (disable|allow|prefer|require|verify-ca|verify-full) and [mysql](https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#option_general_ssl-mode) (disable||preferred|required|verify_ca|verify_identity). Defaults to ''
- **LOGGER_LEVEL**: Configures the amount of messages that are generated when redmine is running. Possible values are: `debug`, `info`, `warn`, `error`. Defaults to `info`
- **NGINX_ENABLED**: Enable/disable the nginx server. Disabling Nginx is not recommended (see #148), use at your discretion. Defaults to `true`. When disabled publish port `8080` instead of the usual port `80` or `443`.
- **NGINX_WORKERS**: The number of nginx workers to start. Defaults to `1`.
- **NGINX_MAX_UPLOAD_SIZE**: Maximum acceptable upload size. Defaults to `20m`.
Expand Down
14 changes: 10 additions & 4 deletions assets/runtime/config/redmine/additional_environment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
config.gem 'dalli'
config.action_controller.perform_caching = true
config.cache_classes = true
config.cache_store = :mem_cache_store, "{{MEMCACHE_HOST}}:{{MEMCACHE_PORT}}"
# Copy this file to additional_environment.rb and add any statements
# that need to be passed to the Rails::Initializer. `config` is
# available in this context.
#
# Example:
#
# config.log_level = :debug
# ...
#

3 changes: 3 additions & 0 deletions assets/runtime/env-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# DEBUGGING
DEBUG=${DEBUG:-}

# LOGGER
LOGGER_LEVEL=${LOGGER_LEVEL:-info}

## CORE
REDMINE_ATTACHMENTS_DIR=${REDMINE_ATTACHMENTS_DIR:-$REDMINE_DATA_DIR/files}
REDMINE_PLUGINS_DIR=${REDMINE_PLUGINS_DIR:-$REDMINE_DATA_DIR/plugins}
Expand Down
19 changes: 14 additions & 5 deletions assets/runtime/functions
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ REDMINE_CONFIG="${REDMINE_INSTALL_DIR}/config/configuration.yml"
REDMINE_DATABASE_CONFIG="${REDMINE_INSTALL_DIR}/config/database.yml"
REDMINE_UNICORN_CONFIG="${REDMINE_INSTALL_DIR}/config/unicorn.rb"
REDMINE_SECRET_CONFIG="${REDMINE_INSTALL_DIR}/config/initializers/secret_token.rb"
REDMINE_MEMCACHED_CONFIG="${REDMINE_INSTALL_DIR}/config/additional_environment.rb"
REDMINE_ADDITIONAL_CONFIG="${REDMINE_INSTALL_DIR}/config/additional_environment.rb"
REDMINE_NGINX_CONFIG="/etc/nginx/sites-enabled/redmine"

IMAGE_VERSION=$(cat /VERSION)
Expand Down Expand Up @@ -329,13 +329,20 @@ redmine_configure_memcached() {

if [[ ${MEMCACHE_ENABLED} == true ]]; then
echo "Configuring redmine::memcached..."
install_template ${REDMINE_USER}: redmine/additional_environment.rb ${REDMINE_MEMCACHED_CONFIG} 0644
update_template ${REDMINE_MEMCACHED_CONFIG} \
MEMCACHE_HOST \
MEMCACHE_PORT
{
echo "config.gem 'dalli'"
echo "config.action_controller.perform_caching = true"
echo "config.cache_classes = true"
echo "config.cache_store = :mem_cache_store, ${MEMCACHE_HOST}:${MEMCACHE_PORT}"
} >> "${REDMINE_ADDITIONAL_CONFIG}"
fi
}

redmine_configure_logger() {
echo "Configuring redmine::logger..."
echo "config.log_level = :${LOGGER_LEVEL}" >> "${REDMINE_ADDITIONAL_CONFIG}"
}

redmine_configure_unicorn() {
echo "Configuring redmine::unicorn..."
if [[ ${REDMINE_RELATIVE_URL_ROOT} == / ]]; then
Expand Down Expand Up @@ -852,6 +859,7 @@ symlink_dotfiles() {
install_configuration_templates() {
echo "Installing configuration templates..."

install_template ${REDMINE_USER}: redmine/additional_environment.rb ${REDMINE_ADDITIONAL_CONFIG} 0644
install_template ${REDMINE_USER}: redmine/configuration.yml ${REDMINE_CONFIG} 0640
install_template ${REDMINE_USER}: redmine/database.yml ${REDMINE_DATABASE_CONFIG} 0640
install_template ${REDMINE_USER}: redmine/unicorn.rb ${REDMINE_UNICORN_CONFIG} 0644
Expand Down Expand Up @@ -892,6 +900,7 @@ configure_redmine() {

redmine_configure_database
redmine_configure_memcached
redmine_configure_logger
redmine_configure_unicorn
redmine_configure_secret_token
redmine_configure_concurrent_uploads
Expand Down

0 comments on commit 9586049

Please sign in to comment.