diff --git a/.env.example b/.env.example index 6aa2827..f028914 100644 --- a/.env.example +++ b/.env.example @@ -1,16 +1,24 @@ -# Gemfile -GEM_PG_VERSION=1.2.2 +# Database +DB_HOST=postgis +DB_NAME=gtt +DB_USER=gtt +DB_PASS=gtt +DB_PORT=5432 -# docker-compose.yml - postgres -POSTGRES_USER=gtt -POSTGRES_PASSWORD=gtt -POSTGRES_DB=gtt - -# config/configuration.yml -SMTP_ENABLE_STARTTLS_AUTO=true # (or false) -SMTP_ADDRESS=smtp.gmail.com -SMTP_PORT=587 -SMTP_DOMAIN=smtp.gmail.com -SMTP_AUTHENTICATION=plain # (or login) +# Email +SMTP_ADDRESS=smtp +SMTP_DOMAIN=smtp.example.com +SMTP_PORT=1025 SMTP_USER_NAME=YOUR_EMAIL_ADDRESS SMTP_PASSWORD=YOUR_PASSWORD +SMTP_ENABLE_STARTTLS_AUTO=true + +# Setup +REDMINE_LANG=en +REDMINE_EMAIL=gtt@example.com + +# System +RAILS_ENV=production +RAILS_LOG_TO_STDOUT=1 +RAILS_MEMORY_LIMIT=1024 +PUMA_WORKERS=3 diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..0b6c84c --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,6 @@ +{ + "MD029": false, + "MD033": false, + "MD038": false, + "MD041": false +} diff --git a/Dockerfile b/Dockerfile index 4a0a719..bf4ee11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,22 @@ -FROM ruby:2.7-slim-buster +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# GTT Builder +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +FROM node:16-bullseye-slim as gtt-builder + +WORKDIR /app + +COPY plugins/redmine_gtt/ ./redmine_gtt/ + +RUN apt update; \ + apt install -y git; \ + cd redmine_gtt; \ + yarn; \ + yarn webpack + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# GTT Base +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +FROM ruby:3.1-slim-bullseye as base # explicitly set uid/gid to guarantee that it won't change in the future # the values 999:999 are identical to the current user/group id assigned @@ -10,19 +28,11 @@ RUN set -eux; \ ca-certificates \ wget \ \ - # bzr \ - # git \ - # mercurial \ - openssh-client \ - # subversion \ - \ # we need "gsfonts" for generating PNGs of Gantt charts # and "ghostscript" for creating PDF thumbnails (in 4.1+) ghostscript \ gsfonts \ imagemagick \ -# https://github.com/docker-library/ruby/issues/344 - shared-mime-info \ # grab gosu for easy step-down from root gosu \ # grab tini for signal processing and zombie killing @@ -44,89 +54,42 @@ RUN set -eux; \ chown redmine:redmine "$HOME"; \ chmod 1777 "$HOME" -ARG REDMINE_VERSION="4.2.3" -ARG REDMICA_VERSION="" -# ENV REDMINE_DOWNLOAD_SHA256 ad4109c3425f1cfe4c8961f6ae6494c76e20d81ed946caa1e297d9eda13b41b4 +# Defined in docker-compose.yml +ARG REDMINE_VERSION +ARG REDMINE_DOWNLOAD_SHA256 RUN set -eux; \ - if [ -n "$REDMINE_VERSION" ]; then \ - wget -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz"; \ - # echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; - elif [ -n "$REDMICA_VERSION" ]; then \ - wget -O redmine.tar.gz "https://github.com/redmica/redmica/archive/v${REDMICA_VERSION}.tar.gz"; \ - fi; \ + # bullseye hack + wget --no-check-certificate -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz"; \ + echo "${REDMINE_DOWNLOAD_SHA256} *redmine.tar.gz" | sha256sum -c -; \ tar -xf redmine.tar.gz --strip-components=1; \ rm redmine.tar.gz files/delete.me log/delete.me; \ - mkdir -p log public/plugin_assets sqlite tmp/pdf tmp/pids; \ - chown -R redmine:redmine ./; \ -# log to STDOUT (https://github.com/docker-library/redmine/issues/108) - echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \ -# fix permissions for running as an arbitrary user - chmod -R ugo=rwX config db sqlite; \ - find log tmp -type d -exec chmod 1777 '{}' + + mkdir -p log public/plugin_assets tmp/pdf tmp/pids; \ + chown -R redmine:redmine ./ ; \ + chmod -R ugo=rwX config ; \ + find log tmp -type d -exec chmod 1777 '{}' + + +COPY --from=gtt-builder --chown=redmine:redmine /app/ ./plugins/ -# for Redmine patches -ARG PATCH_STRIP=1 -ARG PATCH_DIRS="" -COPY patches/ ./patches/ +COPY --chown=redmine:redmine config/ ./config/ -# for GTT gem native extensions -ARG GEM_PG_VERSION="1.2.3" -COPY Gemfile.local ./ -COPY plugins/ ./plugins/ +COPY --chown=redmine:redmine Gemfile.local ./ RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends \ - # freetds-dev \ gcc \ - # libmariadbclient-dev \ libpq-dev \ - # libsqlite3-dev \ + libgeos-dev \ make \ patch \ -# in 4.1+, libmagickcore-dev and libmagickwand-dev are no longer necessary/used: https://www.redmine.org/issues/30492 - libmagickcore-dev libmagickwand-dev \ -# for GTT dependencies - g++ \ - libgeos-dev \ - curl \ ; \ rm -rf /var/lib/apt/lists/*; \ \ - if [ -n "$PATCH_DIRS" ]; then \ - for dir in $(echo $PATCH_DIRS | sed "s/,/ /g"); do \ - for file in ./patches/"$dir"/*; do \ - patch -p"$PATCH_STRIP" < $file; \ - done; \ - done; \ - rm -rf ./patches/*; \ - fi; \ - curl -sL https://deb.nodesource.com/setup_14.x | bash -; \ - apt-get install -y --no-install-recommends nodejs; \ - curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ - apt-get update; \ - apt-get install -y --no-install-recommends yarn; \ - for plugin in ./plugins/*; do \ - if [ -f "$plugin/webpack.config.js" ]; then \ - cd "$plugin" && yarn && npx webpack && rm -rf node_modules && cd ../..; \ - fi; \ - done; \ - export GEM_PG_VERSION="$GEM_PG_VERSION"; \ gosu redmine bundle config --local without 'development test'; \ -# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies -# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 - echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ - # for adapter in mysql2 postgresql sqlserver sqlite3; do \ - for adapter in postgis; do \ - echo "$adapter:" >> ./config/database.yml; \ - echo " adapter: $adapter" >> ./config/database.yml; \ - done; \ gosu redmine bundle install --jobs "$(nproc)"; \ - rm ./config/database.yml; \ # fix permissions for running as an arbitrary user chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ rm -rf ~redmine/.bundle; \ @@ -145,11 +108,10 @@ RUN set -eux; \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -COPY config/ ./config/ -VOLUME /usr/src/redmine/files - -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY --chown=redmine:redmine docker-entrypoint.sh / EXPOSE 3000 -CMD ["rails", "server", "-b", "0.0.0.0"] + +ENTRYPOINT [ "/docker-entrypoint.sh" ] + +CMD [ "rails", "s", "-b", "0.0.0.0" ] diff --git a/Gemfile.local b/Gemfile.local index 64e8352..5475b94 100644 --- a/Gemfile.local +++ b/Gemfile.local @@ -1,5 +1,3 @@ -source 'https://rubygems.org' - -# each plugin's native extensions should be added to here -gem "rgeo" -gem "pg", (ENV['GEM_PG_VERSION'] ? "~> #{ENV['GEM_PG_VERSION']}" : "~> 1.2.3") +gem 'puma' +gem 'puma_worker_killer' +gem 'lograge' diff --git a/README.md b/README.md index 42c6d5f..9c71a3e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# docker-gtt +# Docker GTT Docker image for GTT Project @@ -6,16 +6,20 @@ Docker image for GTT Project After cloning this repository run: -``` +```sh git submodule update --init cp .env.example .env -docker-compose up --build +docker compose up --build ``` -Open the application on http://localhost:3000/ +Open the application on `http://localhost:3000/` Default user is `admin/admin`. -## How to use GTT: +## How to use GTT Find more information [how to get started with the GTT plugin](https://github.com/gtt-project/redmine_gtt#how-to-use). + +## LICENSE + +This program is free software. See [LICENSE](LICENSE) for more information. diff --git a/config/configuration.yml b/config/configuration.yml index 8cff2e7..b602ceb 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -21,15 +21,10 @@ default: email_delivery: delivery_method: :smtp smtp_settings: - enable_starttls_auto: <%= ENV['SMTP_ENABLE_STARTTLS_AUTO'] %> + enable_starttls_auto: <%= ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true %> address: <%= ENV['SMTP_ADDRESS'] %> - port: <%= ENV['SMTP_PORT'] %> + port: <%= ENV['SMTP_PORT'] || 587 %> domain: <%= ENV['SMTP_DOMAIN'] %> - authentication: <%= ENV['SMTP_AUTHENTICATION'] %> + authentication: :plain user_name: <%= ENV['SMTP_USER_NAME'] %> password: <%= ENV['SMTP_PASSWORD'] %> - - # ==== Sendmail command - # - # email_delivery: - # delivery_method: :sendmail diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..6be21a9 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,17 @@ +default: &default + adapter: postgis + database: <%= ENV['DB_NAME'] %> + host: <%= ENV['DB_HOST'] %> + username: <%= ENV['DB_USER'] %> + password: <%= ENV['DB_PASS'] %> + port: <%= ENV['DB_PORT'] || 5432 %> + encoding: utf8 + +production: + <<: *default + +test: + <<: *default + +development: + <<: *default diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..61b3cb1 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable delivery errors + config.action_mailer.raise_delivery_errors = false + + # No email in production log + config.action_mailer.logger = nil + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Logging by JSON + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end +end diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb new file mode 100644 index 0000000..89a7ba3 --- /dev/null +++ b/config/initializers/lograge.rb @@ -0,0 +1,14 @@ +Rails.application.configure do + config.lograge.enabled = true + config.lograge.formatter = Lograge::Formatters::Json.new + config.lograge.custom_payload do |controller| + current_user = controller.find_current_user + user_name = current_user&.logged? ? "#{current_user.login}" : "anonymous" + user_id = current_user&.logged? ? "#{current_user.id}" : "0" + { + remote_ip: controller.request.remote_ip, + user_name: user_name, + user_id: user_id + } + end +end diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..8a9e17e --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,15 @@ +workers (ENV['PUMA_WORKERS'] || 3).to_i + +before_fork do + require 'puma_worker_killer' + + PumaWorkerKiller.config do |config| + config.ram = (ENV['RAILS_MEMORY_LIMIT'] || 2048).to_i + config.frequency = 10 + config.percent_usage = 0.8 + config.rolling_restart_frequency = false + config.reaper_status_logs = false + end + + PumaWorkerKiller.start +end diff --git a/docker-compose.yml b/docker-compose.yml index cc5cf32..a8c25f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,67 +2,63 @@ version: "3" services: - gtt: + postgis: + image: postgis/postgis:14-master + environment: + POSTGRES_PASSWORD: ${DB_PASS} + POSTGRES_USER: ${DB_USER} + POSTGRES_DB: ${DB_NAME} + volumes: + - postgis:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "pg_isready", "-U", "${DB_USER}", "-d", "${DB_NAME}", "-h", "postgis"] + interval: 10s + timeout: 2s + retries: 5 + start_period: 10s + + redmine: build: - context: ./ + context: . dockerfile: ./Dockerfile args: - REDMINE_VERSION: 4.2.3 - REDMICA_VERSION: "" - GEM_PG_VERSION: ${GEM_PG_VERSION} - PATCH_STRIP: 1 - PATCH_DIRS: "" + REDMINE_VERSION: 5.0.2 + REDMINE_DOWNLOAD_SHA256: "4e718f44ba33716faf58c8fabf5d5f55b33c93426b7a33a83b5fc1b880585d57" ports: - 3000:3000 - environment: - REDMINE_DB_POSTGRES: postgres - REDMINE_DB_USERNAME: ${POSTGRES_USER} - REDMINE_DB_PASSWORD: ${POSTGRES_PASSWORD} - REDMINE_DB_DATABASE: ${POSTGRES_DB} - REDMINE_PLUGINS_MIGRATE: 1 - # Gemfile - GEM_PG_VERSION: ${GEM_PG_VERSION} - # config/configuration.yml - SMTP_ENABLE_STARTTLS_AUTO: ${SMTP_ENABLE_STARTTLS_AUTO} - SMTP_ADDRESS: ${SMTP_ADDRESS} - SMTP_PORT: ${SMTP_PORT} - SMTP_DOMAIN: ${SMTP_DOMAIN} - SMTP_AUTHENTICATION: ${SMTP_AUTHENTICATION} - SMTP_USER_NAME: ${SMTP_USER_NAME} - SMTP_PASSWORD: ${SMTP_PASSWORD} + env_file: + - .env volumes: - ./files:/usr/src/redmine/files - ./plugins:/usr/src/redmine/plugins - ./public/themes:/usr/src/redmine/public/themes # Exclude node package and webpack contents folders + # Needed to build with webpack! - /usr/src/redmine/plugins/redmine_gtt/node_modules - /usr/src/redmine/plugins/redmine_gtt/assets/javascripts + # TODO: remove the following line when adding GTT Print back + - /usr/src/redmine/plugins/redmine_gtt_print depends_on: - - postgres - - mapfish-print - restart: always + postgis: + condition: service_healthy + # mapfish: + # condition: service_started - postgres: - image: postgis/postgis:13-3.1 - environment: - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: ${POSTGRES_DB} - volumes: - - postgres:/var/lib/postgresql/data - restart: always + # mapfish: + # image: camptocamp/mapfish_print:3.29 + # ports: + # - 8080:8080 + # environment: + # EXTRA_JARS: /usr/local/tomcat/webapps/ROOT/print-apps/lib + # # CATALINA_OPTS: "" + # volumes: + # - ./plugins/redmine_gtt_print/server-example/print-apps:/usr/local/tomcat/webapps/ROOT/print-apps - mapfish-print: - image: camptocamp/mapfish_print:3.28 + smtp: + image: smellman/mailcatcher:0.8.2 ports: - - 8080:8080 - environment: - EXTRA_JARS: /usr/local/tomcat/webapps/ROOT/print-apps/lib - volumes: - - ./mapfish-print-apps:/usr/local/tomcat/webapps/ROOT/print-apps - restart: always + - 1080:1080 volumes: - gtt: - postgres: - mapfish-print: + postgis: + # mapfish: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7b6e8b9..f627758 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,157 +1,24 @@ -#!/usr/bin/env bash -set -Eeo pipefail -# TODO add "-u" - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -isLikelyRedmine= -case "$1" in - rails | rake | passenger ) isLikelyRedmine=1 ;; -esac - -_fix_permissions() { - # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions - if [ "$(id -u)" = '0' ]; then - find config files log public/plugin_assets \! -user redmine -exec chown redmine:redmine '{}' + - fi - # directories 755, files 644: - find config files log public/plugin_assets tmp -type d \! -perm 755 -exec chmod 755 '{}' + 2>/dev/null || : - find config files log public/plugin_assets tmp -type f \! -perm 644 -exec chmod 644 '{}' + 2>/dev/null || : -} - -# allow the container to be started with `--user` -if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then - _fix_permissions - exec gosu redmine "$BASH_SOURCE" "$@" +#!/bin/bash + +if [[ -v REDMINE_LANG ]]; +then + echo "REDMINE_LANG is already set: ${REDMINE_LANG}" +else + echo "Set REDMINE_LANG variable to: en" + export REDMINE_LANG="en" fi -if [ -n "$isLikelyRedmine" ]; then - _fix_permissions - if [ ! -f './config/database.yml' ]; then - file_env 'REDMINE_DB_MYSQL' - file_env 'REDMINE_DB_POSTGRES' - file_env 'REDMINE_DB_SQLSERVER' - - if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then - export REDMINE_DB_MYSQL='mysql' - elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then - export REDMINE_DB_POSTGRES='postgres' - fi - - if [ "$REDMINE_DB_MYSQL" ]; then - adapter='mysql2' - host="$REDMINE_DB_MYSQL" - file_env 'REDMINE_DB_PORT' '3306' - file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" - file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" - file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" - file_env 'REDMINE_DB_ENCODING' '' - elif [ "$REDMINE_DB_POSTGRES" ]; then - # adapter='postgresql' - adapter='postgis' - host="$REDMINE_DB_POSTGRES" - file_env 'REDMINE_DB_PORT' '5432' - file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" - file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" - file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" - file_env 'REDMINE_DB_ENCODING' 'utf8' - elif [ "$REDMINE_DB_SQLSERVER" ]; then - adapter='sqlserver' - host="$REDMINE_DB_SQLSERVER" - file_env 'REDMINE_DB_PORT' '1433' - file_env 'REDMINE_DB_USERNAME' '' - file_env 'REDMINE_DB_PASSWORD' '' - file_env 'REDMINE_DB_DATABASE' '' - file_env 'REDMINE_DB_ENCODING' '' - else - echo >&2 - echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' - echo >&2 - echo >&2 '*** Using sqlite3 as fallback. ***' - echo >&2 - - adapter='sqlite3' - host='localhost' - file_env 'REDMINE_DB_PORT' '' - file_env 'REDMINE_DB_USERNAME' 'redmine' - file_env 'REDMINE_DB_PASSWORD' '' - file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' - file_env 'REDMINE_DB_ENCODING' 'utf8' +bundle exec rake generate_secret_token +bundle config set without 'development test' +bundle install +bundle exec rake db:create +bundle exec rake db:migrate +bundle exec rake redmine:plugins:migrate - mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" - if [ "$(id -u)" = '0' ]; then - find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + - fi - fi +# Load default data and settings +bundle exec rake redmine:load_default_data - REDMINE_DB_ADAPTER="$adapter" - REDMINE_DB_HOST="$host" - echo "$RAILS_ENV:" > config/database.yml - for var in \ - adapter \ - host \ - port \ - username \ - password \ - database \ - encoding \ - ; do - env="REDMINE_DB_${var^^}" - val="${!env}" - [ -n "$val" ] || continue - echo " $var: \"$val\"" >> config/database.yml - done - fi - - # install additional gems for Gemfile.local and plugins - bundle check || bundle install - - if [ ! -s config/secrets.yml ]; then - file_env 'REDMINE_SECRET_KEY_BASE' - if [ -n "$REDMINE_SECRET_KEY_BASE" ]; then - cat > 'config/secrets.yml' <<-YML - $RAILS_ENV: - secret_key_base: "$REDMINE_SECRET_KEY_BASE" - YML - elif [ ! -f config/initializers/secret_token.rb ]; then - rake generate_secret_token - fi - fi - if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then - rake db:migrate - fi - - if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then - rake redmine:plugins:migrate - fi - - # remove PID file to enable restarting the container - rm -f tmp/pids/server.pid - - if [ "$1" = 'passenger' ]; then - # Don't fear the reaper. - set -- tini -- "$@" - fi -fi +# Cleanup +rm -f tmp/pids/server.pid exec "$@" diff --git a/plugins/redmine_gtt b/plugins/redmine_gtt index 68f3b40..414b5a9 160000 --- a/plugins/redmine_gtt +++ b/plugins/redmine_gtt @@ -1 +1 @@ -Subproject commit 68f3b402a96380be4192912e38e6b9d2b419b593 +Subproject commit 414b5a9085d02c0659c53867a32e8d42be9e1404 diff --git a/plugins/redmine_gtt_print b/plugins/redmine_gtt_print index 6d67a3c..2c6568e 160000 --- a/plugins/redmine_gtt_print +++ b/plugins/redmine_gtt_print @@ -1 +1 @@ -Subproject commit 6d67a3c7b6eee3c7645c26d41d66901824287e8d +Subproject commit 2c6568e352cf516677487715c8b457f857c18d9c diff --git a/plugins/redmine_gtt_smash b/plugins/redmine_gtt_smash index 3863ef9..871cf07 160000 --- a/plugins/redmine_gtt_smash +++ b/plugins/redmine_gtt_smash @@ -1 +1 @@ -Subproject commit 3863ef9f36c31d46c109c3491f885470ec83ab3b +Subproject commit 871cf072db927ddc7f2932319c1fb5a8591fbde7 diff --git a/plugins/redmine_text_blocks b/plugins/redmine_text_blocks index 88a6021..733c1df 160000 --- a/plugins/redmine_text_blocks +++ b/plugins/redmine_text_blocks @@ -1 +1 @@ -Subproject commit 88a602179327e7c2042304c86f2af1298ae614db +Subproject commit 733c1dffc47ea739c04515030948101b5416345f