feat: support redmine 6

This commit is contained in:
Dominik Meyer 2025-01-07 17:42:30 +01:00
parent 911d5c2963
commit 6fbac471c4
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97
3 changed files with 277 additions and 0 deletions

113
6.0/Containerfile Normal file
View File

@ -0,0 +1,113 @@
FROM ruby:3.3-bookworm as builder
ARG REDMINE_TAG=6.0.2
ARG PLUGIN_COMMIT_redmine_issue_dynamic_edit="HEAD"
ARG PLUGIN_COMMIT_redmine_dashboard="HEAD"
ARG PLUGIN_COMMIT_redmine_wiki_extensions="HEAD"
ARG PLUGIN_COMMIT_additionals="HEAD"
ARG PLUGIN_COMMIT_additional_tags="HEAD"
ARG PLUGIN_COMMIT_redmine_messenger="HEAD"
ARG PLGUIN_COMMIT_redmine_drawio="HEAD"
ARG PLUGIN_COMMIT_redmica_ui_extension="HEAD"
ARG PLUGIN_COMMIT_redmine_view_customize="HEAD"
ARG PLUGIN_COMMIT_redmine_privacy_terms="HEAD"
ARG PLUGIN_COMMIT_redmine_ref_issues="HEAD"
ARG PLUGIN_COMMIT_redmine_wiki_pathbase_acl="HEAD"
ARG PLUGIN_COMMIT_redmine_startpage="HEAD"
ARG PLUGIN_COMMIT_redmine_spent_time="HEAD"
ARG PLUGIN_COMMIT_redmine_percent_done="HEAD"
ARG PLUGIN_COMMIT_redmine_documents_short="HEAD"
ARG THEME_COMMIT_redmine_theme_farend_bleuclair="HEAD"
RUN apt-get -qy update && apt-get -qy upgrade && apt-get -qy install git subversion
RUN apt-get -qy install build-essential
RUN apt-get -qy install libyaml-dev
RUN adduser -u 34342 --disabled-login redmine
RUN mkdir -p /home/redmine && chown redmine:redmine /home/redmine
RUN apt-get -qy install vim
WORKDIR /home/redmine
USER redmine
ENV PATH="/home/redmine/.local/share/gem/ruby/3.3.0/bin:$PATH"
RUN svn co https://svn.redmine.org/redmine/tags/${REDMINE_TAG} /home/redmine/redmine
WORKDIR /home/redmine/redmine/
RUN echo 'gem "sidekiq", :require => true' >> Gemfile.local
RUN echo 'gem "sqlite3", "~>1.7.0", :require => true' >> Gemfile.local
RUN echo 'gem "mysql2", :require => true' >> Gemfile.local
RUN echo 'gem "pg", :require => true' >> Gemfile.local
RUN echo 'gem "puma", :require => true' >> Gemfile.local
RUN gem install --user-install bundler
#
#
# redmine plugins
RUN cd plugins;git clone https://github.com/Ilogeek/redmine_issue_dynamic_edit.git;cd redmine_issue_dynamic_edit; git checkout ${PLUGIN_COMMIT_redmine_issue_dynamic_edit}
RUN cd plugins;git clone https://github.com/jgraichen/redmine_dashboard.git; cd redmine_dashboard; git checkout ${PLUGIN_COMMIT_redmine_dashboard}
RUN cd plugins;git clone https://github.com/haru/redmine_wiki_extensions.git; cd redmine_wiki_extensions; git checkout ${PLUGIN_COMMIT_redmine_wiki_extensions}
RUN cd plugins;git clone https://www.github.com/alphanodes/additionals.git;cd additionals;git checkout ${PLUGIN_COMMIT_additionals}
RUN cd plugins;git clone https://www.github.com/alphanodes/additional_tags.git;cd additional_tags; git checkout ${PLUGIN_COMMIT_additional_tags}
RUN cd plugins;git clone https://github.com/alphanodes/redmine_messenger.git; cd redmine_messenger; git checkout ${PLUGIN_COMMIT_redmine_messenger}
RUN cd plugins;git clone https://github.com/alphanodes/redmine_privacy_terms.git; cd redmine_privacy_terms; git checkout ${PLUGIN_COMMIT_redmine_privacy_terms}
RUN cd plugins;git clone https://github.com/alphanodes/redmine_ref_issues.git; cd redmine_ref_issues; git checkout ${PLUGIN_COMMIT_redmine_ref_issues}
RUN cd plugins;git clone https://github.com/mikitex70/redmine_drawio.git; cd redmine_drawio; git checkout ${PLGUIN_COMMIT_redmine_drawio}
RUN cd plugins;git clone https://github.com/redmica/redmica_ui_extension.git; cd redmica_ui_extension; git checkout ${PLUGIN_COMMIT_redmica_ui_extension}
RUN cd plugins;git clone https://github.com/onozaty/redmine-view-customize.git view_customize; cd view_customize; git checkout ${PLUGIN_COMMIT_redmine_view_customize}
RUN cd plugins;git clone https://github.com/9506hqwy/redmine_wiki_pathbase_acl.git; cd redmine_wiki_pathbase_acl; git checkout ${PLUGIN_COMMIT_redmine_wiki_pathbase_acl}
RUN cd plugins;git clone https://github.com/Intera/redmine_startpage.git; cd redmine_startpage; git checkout ${PLUGIN_COMMIT_redmine_startpage}
RUN cd plugins;git clone https://github.com/eyp/redmine_spent_time.git; cd redmine_spent_time; git checkout ${PLUGIN_COMMIT_redmine_spent_time}
RUN cd plugins;git clone https://github.com/jkraemer/redmine_percent_done.git; cd redmine_percent_done; git checkout ${PLUGIN_COMMIT_redmine_percent_done}
RUN cd plugins;git clone https://github.com/smoreau/redmine_documents_short.git; cd redmine_documents_short; git checkout ${PLUGIN_COMMIT_redmine_documents_short}
#
#
# Redmine themes
#
RUN cd themes;git clone https://github.com/farend/redmine_theme_farend_bleuclair.git bleuclair; cd bleuclair; git checkout ${THEME_COMMIT_redmine_theme_farend_bleuclair}
#
# setting everything up
#
RUN bundle config set --local without 'development test'
RUN bundle config set --local path '/home/redmine/.local/share/gem'
RUN bundle install
FROM ruby:3.3-bookworm
RUN apt-get -qy update && apt-get -qy upgrade
RUN apt-get -qy install libyaml-0-2 tini ghostscript
COPY --from=builder /home/redmine /home/redmine
ADD entrypoint.sh /
RUN chmod a+x /entrypoint.sh
RUN adduser -u 34342 --disabled-login redmine
RUN chown -R redmine:redmine /home/redmine
USER redmine
ENV PATH="/home/redmine/.local/share/gem/ruby/3.3.0/bin:$PATH"
WORKDIR /home/redmine/redmine
ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]

160
6.0/entrypoint.sh Normal file
View File

@ -0,0 +1,160 @@
#!/bin/bash
echo "Starting redmine ..."
bundle config set --local without 'development test'
bundle config set --local path '/home/redmine/.local/share/gem'
if [ -z ${REDMINE_LANG} ]; then
REDMINE_LANG=EN
fi
#
# generate configuration files according to environment variables
#
if [ -z "${DATABASE_ADAPTER}" ]; then
echo "DATABASE_ADAPTER is not set"
exit 1
fi
if [ "${DATABASE_ADAPTER}" == "sqlite3" ]; then
if [ -z ${SQLITE_FILE} ]; then
echo "SQLITE_FILE is not set"
exit 1
fi
echo "Generating configuration for sqlite3..."
echo "production:" > config/database.yml
echo -e " adapter: sqlite3" >> config/database.yml
echo -e " database: ${SQLITE_FILE}" >> config/database.yml
elif [ "${DATABASE_ADAPTER}" == "mysql" ]; then
if [ -z ${MYSQL_PORT} ]; then
MYSQL_PORT=3306
fi
if [ -z ${MYSQL_USER} ]; then
MYSQL_USER="redmine"
fi
if [ -z ${MYSQL_DB} ]; then
MYSQL_DB="redmine"
fi
if [ -u ${MYSQL_HOST} ]; then
echo "please provide mysql server hostname/ip in MYSQL_HOST"
exit 1
fi
if [ -u ${MYSQL_PASSWORD} ]; then
echo "please provide mysql password in MYSQL_PASSWORD"
exit 1
fi
echo "Generating configuration for mysql2..."
echo "production:" > config/database.yml
echo -e " adapter: mysql2" >> config/database.yml
echo -e " database: ${MYSQL_DB}" >> config/database.yml
echo -e " host: ${MYSQL_HOST}" >> config/database.yml
echo -e " port: ${MYSQL_PORT}" >> config/database.yml
echo -e " username: ${MYSQL_USER}" >> config/database.yml
echo -e " password: ${MYSQL_PASSWORD}" >> config/database.yml
echo -e " variables:" >> config/database.yml
echo -e ' transaction_isolation: "READ-COMMITTED"' >> config/database.yml
elif [ "${DATABASE_ADAPTER}" == "postgres" ]; then
if [ -z ${PSQL_PORT} ]; then
PSQL_PORT=3306
fi
if [ -z ${PSQL_USER} ]; then
PSQL_USER="redmine"
fi
if [ -z ${PSQL_DB} ]; then
PSQL_DB="redmine"
fi
if [ -u ${PSQL_HOST} ]; then
echo "please provide postgresql server hostname/ip in PSQL_HOST"
exit 1
fi
if [ -u ${PSQL_PASSWORD} ]; then
echo "please provide postgresql password in PSQL_PASSWORD"
exit 1
fi
echo "Generating configuration for postgresql..."
echo "production:" > config/database.yml
echo -e " adapter: postgresql" >> config/database.yml
echo -e " database: ${PSQL_DB}" >> config/database.yml
echo -e " host: ${PSQÖ_HOST}" >> config/database.yml
echo -e " port: ${PSQL_PORT}" >> config/database.yml
echo -e " username: ${PSQL_USER}" >> config/database.yml
echo -e " password: ${PSQL_PASSWORD}" >> config/database.yml
echo -e " encoding: utf8" >> config/database.yml
fi
if [ -n "${SIDEKIQ}" ]; then
if [ "${SIDEKIQ}" == "true" ]; then
echo "Setting up sidekiq configuration ..."
if [ -z ${REDIS_URL} ]; then
echo "sidekiq needs redis please provide redis URL in REDIS_URL"
exit 1
fi
fi
fi
if [ -n "${USE_SIDEKIQ}" ]; then
echo 'config.active_job.queue_adapter = :sidekiq' >> config/additional_environment.rb
fi
#
# set up logging
#
#echo 'config.log_path = "/dev/stdout"' >> config/additional_environment.rb
#echo 'config.log_level = :info' >> config/additional_environment.rb
#
# redmine requires database initialization on the first run and selecting the first default language
# to identify a "first" run we check for an .initialized file in the file directory. This directory
# has to be mapped to any kind of persitent storage otherwise the application will be initialized
# again and again
#
if [ ! -e "files/.initialized" ]; then
echo "Initializing Redmine ..."
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production REDMINE_LANG=${REDMINE_LANG} bundle exec rake redmine:load_default_data
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
cp config/initializers/secret_token.rb files/.initialized
fi
if [ -n "${SIDEKIQ}" ]; then
if [ "${SIDEKIQ}" == "true" ]; then
echo "Starting Sidekiq for Redmine"
RAILS_ENV=production bundle exec sidekiq
exit 0
fi
fi
cp files/.initialized config/initializers/secret_token.rb
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
RAILS_ENV=production bundle exec rake assets:precompile
bundle exec rails server -e production

4
6.0/test Normal file
View File

@ -0,0 +1,4 @@
Starting redmine ...
Generating configuration for sqlite3...
Initializing Redmine ...
Some configuration data is already loaded.