redmine

redmine

Posted by nomadli on July 10, 2020

安装[https://www.redmine.org/releases]

  • yum -y install zlib-devel openssl-devel ImageMagick ImageMagick-devel
  • https://www.ruby-lang.org/en/downloads ./configure make install
  • https://rubygems.org ruby setup.rb
  • yum -y update ca-certificates
  • gem sources –remove https://rubygems.org/
  • gem sources -a https://mirrors.tuna.tsinghua.edu.cn/rubygems/
  • gem install bundle rake
  • wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
  • rpm -ivh mysql57-community-release-el7-8.noarch.rpm
  • rpm –import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
  • yum -y install mysql-server
  • systemctl start mysqld
  • grep ‘temporary password’ /var/log/mysqld.log 查看临时密码
  • mysql -uroot -p
  • set global validate_password_policy=LOW;
  • set global validate_password_length=5;
  • ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘admin’;
  • update USER set Host=’%’ where User=’root’;
  • flush privileges;
  • CREATE DATABASE redmine CHARACTER SET utf8;
  • CREATE USER ‘redmine’@’localhost’ IDENTIFIED BY ‘mypassword’;
  • GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine’@’localhost’;
  • wget https://www.redmine.org/releases/ cd dir
  • cp ./config/database.yml.example ./config/database.yml
  • production: adapter: mysql2 database: redmine host: localhost username: redmine password: “my_password”
  • bundle install –without development test
  • rake db:migrate RAILS_ENV=”production” 传见数据库表 ```shell docker network create redmine-net

docker pull mysql:8 docker run -d –name redmine-mysql –restart=always –network redmine-net -v /data/mysql/config:/etc/mysql/conf.d -v /data/mysql/data:/var/lib/mysql -p 3306:3306 -e MYSQL_USER=redmine -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=redmine -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.30 docker exec -it redmine-mysql bash docker exec redmine-mysql sh -c ‘exec mysqldump –all-databases -uroot -p”$MYSQL_ROOT_PASSWORD”’ | gzip -9 > /data/mysql/backup/all-databases.sql.gz docker exec -i redmine-mysql sh -c ‘exec mysql -uroot -p”$MYSQL_ROOT_PASSWORD”’ < /data/mysql/backup/all-databases.sql //command docker-entrypoint.sh mysqld

docker run -d –name redmine –restart=always –network redmine-net -p 80:3000 -v /data/redmine/config:/usr/src/redmine/config -v /data/redmine/data:/usr/src/redmine/files -v /data/redmine/plugins:/usr/src/redmine/plugins -e REDMINE_DB_MYSQL=redmine-mysql -e REDMINE_DB_USERNAME=redmine -e REDMINE_DB_PASSWORD=secret -e REDMINE_PLUGINS_MIGRATE=1 redmine:latest //command /docker-entrypoint.sh rails server -b 0.0.0.0

docker exec -it redmine /bin/bash

mv /etc/apt/sources.list /etc/apt/sources.list.bak echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free” > /etc/apt/sources.list echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free” » /etc/apt/sources.list echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free” » /etc/apt/sources.list echo “deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free” » /etc/apt/sources.list

apt install apt-transport-https ca-certificates apt-get update apt-get install -y make gcc imagemagick shared-mime-info libxinerama libnss3 libcairo2 libsm6 pandoc ttf-mscorefonts-installer fontconfig locales ttf-wqy-zenhei vim bundle config set –global | –local without ‘development test’ bundle config set –global | –local mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems bundle install bundle exec rake redmine:plugins:migrate RAILS_ENV=production bundle exec rails zeitwerk:check –trace touch x/redmine/tmp/restart.txt

remove redmine settings rake redmine:plugins:migrate NAME=xxxx VERSION=0 RAILS_ENV=production rm -rf x/redmine/plugins/xxxx

dpkg -i *.deb tar font.tar.xz /usr/share/fonts/truetype/ mv /usr/share/fonts/truetype/build-disk /usr/share/fonts/truetype/myfonts chmod -R 777 /usr/share/fonts/truetype/myfonts mkfontscale mkfontdir fc-cache -fv fc-list dpkg-reconfigure locales

vim /usr/src/redmine/public/stylesheets/application.css line: 3 body {font-size: 16px}

#!/bin/bash dir=/data/mysql/backup echo “will delete old backup” find ${dir} -name '*.sql.gz' -mtime +7 rm -rf find ${dir} -name '*.sql.gz' -mtime +7

time=date +%Y%m%d%H%M%S docker exec redmin-mysql sh -c ‘exec mysqldump -uroot -p”nomadli@151752” –all-databases –routines –events –triggers –single-transaction –source-data –quick’ | gzip -9 > ${dir}/${time}.sql.gz

time=date +%Y%m%d%H%M%S echo “${time} backup finish!” ```

升级问题

  • Stop current Redmine
  • SQL dump database
  • Download new Redmine in a new folder, not where the current Redmine resides.
  • copy redmine\config\database.yml —> redmine-new\config\database.yml
  • Check if there are differencies between redmine\config\database.yml.example and redmine-new\config\database.yml.example and make corrections in redmine-new\config\database.yml if needed.
  • Copy your configuration file config/configuration.yml into the new config folder: redmine\config\configuration.yml –> redmine-new\config\configuration.yml
  • Check if there are differencies between redmine\config\configuration.yml.example and redmine-new\config\configuration.yml.example and make corrections in redmine-new\config\configuration.yml if needed.
  • Copy Gemfile.local into your new installation (if you have one): redmine\Gemfile.local –> redmine-new\Gemfile.local
  • Check Gemfile.
  • Copy the redmine\files folder content into your new installation: redmine\files –> redmine-new\files
  • Copy the additional installed themes from redmine\public\themes to redmine-new\public\themes
  • If the themes shipped with Redmine were modified in the old installation, copy/move the changes in the new installation if applicable.
  • Copy your installed plugins from redmine\plugins to redmine-new\plugins.
  • check for new released versions of the plugins and also check the compatibility of present versions with the new version of Redmine. See http://www.redmine.org and/or plugins’ sites for new versions.
  • Rename current Redmine folder to its original name, i.e. redmine –> redmine-new
  • Rename the new redmine folder to redmine, i.e. redmine-new –> redmine.
  • Open a console that have access to ruby devkit (for ruby 2.3 or less) or MSYS2 (for Ruby 2.4) in PATH= variable. Note: I use ruby 2.3, because mysql2 gem is not ready for ruby 2.4 yet (it soon will be ready for 2.4 and 2.5). Go to new Redmine folder.
  • Run ‘bundle install –without test development’ or ‘bundle install –without test development rmagick’ if you do not use rmagick / ImageMagick
  • Run the following command from your Redmine root folder ‘rake generate_secret_token’
  • Update core tables. Execute ‘rake db:migrate RAILS_ENV=production’
  • Update plugin tables. Execute ‘rake redmine:plugins:migrate RAILS_ENV=production’
  • You should clear the cache and the existing sessions by executing following commands:
  • rake tmp:cache:clear
  • rake tmp:sessions:clear
  • Start Redmine. If all has gone well, you have to see new Redmine in your browser.
  • If you have to do migration to another machine in addition to upgrade you have to follow almost the installation procedure with an essential exception. You have not to execute
  • bundle exec rake db:migrate RAILS_ENV=production
  • bundle exec rake redmine:load_default_data RAILS_ENV=production
  • Instead, you have to create database on the new server, create redmine user and import the SQL dump, made at the beginning of the above procedure. After that you have to execute database migrations by ‘rake db:migrate RAILS_ENV=production’ and ‘rake redmine:plugins:migrate RAILS_ENV=production’. Be sure that the plugins are compatible with new Redmine.
  • If you have not found compatible version of a plugin, do not uninstall the old version before upgrade/migration. Just don’t put it into plugins folder. ‘This way you will keep the plugin data for better times in the future.