【问题标题】:How to install parallel (two) redmine instances如何安装并行(两个)redmine 实例
【发布时间】:2021-01-20 20:29:20
【问题描述】:

我正在尝试设置一个单独的(并行)redmine 实例。 不幸的是,我对 rails 和 ruby​​ 环境了解不多。

这可能吗?

假设它是... 我遇到了似乎是隐含的允许环境的问题--

  production 
  development
  test

这些是不是一成不变的? 我原本以为我会使用“测试”配置, 但因为在某些情况下会被擦除,所以不合适。 我想保留开发以供可能的其他用途。 所以我正在尝试添加一个新环境。 这可能吗? (我的意思是相当容易实现)

到目前为止完成:

  set up new redmine directory hierarchy at /opt/xxx_test/redmine-4.1.1
  set up new mysql database xxx_test with new user xxx_test for xxx_test
  modified config/database.yml to contain only xxx_test (no production, development, or test)
  generated new secret token

安装原始(主要)redmine 时,它​​是通过以下方式安装的:

  bundle config set without 'development test'
  bundle install

当我现在这样做时:

  bundle config set without 'production development test'

我收到消息:

'Your application has set without to "development:test". This will override the global value you are currently setting'

这个集合在哪里,如何更改?

当我执行“数据库架构对象迁移”时(安装步骤 6) 我收到一个错误,似乎暗示它正在访问已安装的“生产”环境:

RAILS_ENV=xxx_test bundle exec rake db:migrate
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
  
  * development - set it to false
  * test - set it to false (unless you use a tool that preloads your test environment)
  * production - set it to true

rake aborted!
Mysql2::Error::ConnectionError: Access denied for user 'xxx_test'@'localhost' to database 'redmine'

这些开发/测试/生产“事物”在哪里/如何设置为真/假? 我在 config/environment 或 config/environments/*.rb 中什么也没看到

【问题讨论】:

  • 一开始为什么要在同一台服务器上运行同一个应用程序的两个实例? IMO 克隆第一个实例、更改配置并在另一台服务器上运行克隆要容易得多。除此之外,您可以根据需要添加任意数量的环境并可以根据需要命名它们(production_1,production_2)。您只需要添加一个额外的环境文件并相应地设置 RAILS_ENV。
  • 我们只有一台服务器可用,并且有工作人员正在试验我们如何处理某些项目最有意义的方法。据我了解,在同一实例上运行会导致日志文件和上传文件等共享文件出现问题。
  • 您可以使用 RVM 在不同的 linux 用户下运行尽可能多的 redmines,apache 虚拟主机可以运行代理到不同的端口或通过乘客模块运行。
  • @Aleksandar 我不明白。 /etc/apache2/mods-available.conf/passenger.conf 指定PassengerUser、PassengerGroup、PassengerUserSwitching,但没有指向它应该运行的redmine 的路径。它如何获得它应该运行的 redmine 的路径? /etc/apache2/rubies/xxx.include 指定 RailsBaseURI /redmine 和 /redmine-test 以及一个 PerlLoadModule Apache2::Redmine
  • @GaryAitken 它是基于每个虚拟主机配置的,请参阅我关于 Redmine 的书...

标签: ruby-on-rails ruby installation redmine


【解决方案1】:

下面的脚本是我最终在一台服务器上建立第二个 redmine 的手动调整版本。它尚未经过测试,但应提供合理的指导。

#!/bin/bash
#
# Script to set up a second redmine instance running on the same server
# Note:
#   This script has been tweaked for general application and may contain errors
# Helpful References:
#   https://www.redmine.org/projects/redmine/wiki/RedmineInstall
#   https://www.phusionpassenger.com/library/config/apache/intro.html
# For rvm 1.29.10, redmine 4.1.1, passenger 5.3, apache 2.4.29
 
# Add user for new redmine to run as
sudo adduser --debug --shell /bin/bash --gecos 'redmine user 2' redmine_usr_2
sudo usermod -a -G rvm redmine_usr_2
# pw: <redmine-2-pw>
 
# Add database for second redmine to mysql
mysql -u <mysql-maint-acct> -p<mysql-maint-pw>
mysql> create database redmine_two character set utf8mb4;
mysql> create user 'redmine_usr_2'@'localhost' identified by '<redmine-2-pw';
mysql> grant all privileges on redmine_two.* to 'redmine_usr_2'@'localhost';
mysql> quit;
 
# Create the directory for the second instance redmine program
# Can't use the existing production version because some things,
# such as logs and uploaded files, also reside there
# The file .ruby-version contains "4.1.1" and prevents rvm from
# spewing messages about incompatible ruby version.
sudo -i -u redmine_usr_2
ln -s /opt/redmine/redmine-4.1.1.tar.gz
tar xf redmine-4.1.1.tar.gz
ln -s redmine-4.1.1 redmine_2
cd redmine_2
cp -p /opt/redmine/redmine/.ruby-version .

# Step 3 Database connection configuration
# Database connection is set up for a ruby environment named "redmine_2_env"
cd ~/redmine_2/config
sed -e "/^production:/,/encoding:/ s/database: redmine/database: redmine_two/" -e "/^production:/,/encoding:/ s/username: root/usern
ame: redmine_usr_2/" -e "/^production:/,/encoding:/ s/password: \"\"/password: \"<redmine-2-pw>\"/" -e "/^production:/ s/production/
redmine_2_env/" -e "/^development:/,/encoding:/ s/^/#/" -e "/^test:/,/encoding:/ s/^/#/" database.yml.example >database.yml_new
cp -p database.yml_new database.yml

# Environment configuration
cd ~/redmine_2/config/environments
cp -p production.rb redmine_2_env.rb

# Step 4 Dependencies installation
cd ~/redmine_2
bundle install
# Note that this may install some new (updated) gems

# Step 5 Session store secret generation
cd ~/redmine_2
bundle exec rake generate_secret_token

# Step 6 Database schema objects migration
cd ~/redmine_2
RAILS_ENV=redmine_2_env bundle exec rake db:migrate

# Step 7 Database default data set
cd ~/redmine_2
RAILS_ENV=redmine_2_env REDMINE_LANG=en bundle exec rake redmine:load_default_data

# Step 8 File system permissions
cd ~/redmine_2
# Note that on install the directories below actually already existed
# but doing the mkdir on an existing directory will be fine.
mkdir -p tmp tmp/pdf public/plugin_assets

## Step 9 Test the installation
## Use lynx because I don't have a local web browser.
# Note!!! This part of the script must be tested by hand, so is commented out
#cd ~/redmine_2
#bundle exec rails server webrick -e redmine_2_env &
## sudo aptitude install lynx
#lynx http://localhost:3000/
## This shows the redmine startup page

# Install plugins
cd ~/redmine_2
git clone -b stable https://github.com/AlphaNodes/additionals.git plugins/additionals
bundle exec rake redmine:plugins:migrate RAILS_ENV=redmine_2_env
exit

# Add new url to apache
# This includes the options necessary to configure PhusionPassenger
#   See: https://www.phusionpassenger.com/library/config/apache/reference/
# 
# /var/www/html
sudo ln -s /home/redmine_usr_2/redmine_2/public /var/www/html/redmine-site-2-url

# /etc/apache2/mods-available/passenger.conf specifies these global parameters:
#   PassengerRoot /opt/passenger/passenger-stable-5.3
#   PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.6.6/wrappers/ruby
#   PassengerUserSwitching on
#   PassengerUser <passenger-default-ruby-user>
#   PassengerGroup <passenger-default-ruby-group>
#   PassengerFriendlyErrorPages on
# /etc/apache2/rubies/redmine-site-1.include specifies app-specific parameters for redmine site-1:
#        <directory  /var/www/html/redmine-site-1-url>
#            RailsBaseURI /redmine-site-1-url
#            PassengerAppRoot /opt/redmine/redmine
#            PassengerAppEnv production
#            PassengerAppGroupName production
#        </Directory>
# /etc/apache2/rubies/redmine-site-2.include app-specific parameters for redmine site-2:
#        <Directory /var/www/html/redmine-site-2-url>
#            PassengerAppRoot /home/redmine_usr_2/redmine_2
#            PassengerAppEnv redmine_2_env
#            PassengerAppGroupName redmine_2
#            RailsBaseURI /redmine-site-2-url
#            PassengerUser redmine_usr_2
#            PassengerGroup redmine_usr_2
#            PassengerFriendlyErrorPages on
#        </Directory>
#   
cd /etc/apache2/rubies
# Edit redmine-site-1.include to be consistent with the above redmine-site-1 contents
# Create redmine-site-2.include to be consistent with the above redmine-site-2 contents
sudo cp -p redmine-site-1.include redmine-site-1.include_org
sudo sh -c 'sed -e "/URI \/issues/ a\ \ \ \ \ \ \ \ \ \ \ \ PassengerAppRoot /opt/redmine/redmine\n            PassengerAppEnv produ
ction\n            PassengerAppGroupName production" redmine-site-1.include_org >redmine-site-1.include_new'
sudo cp -p redmine-site-1.include_new redmine-site-1.include
sudo sh -c 'cat - <<EOF > /etc/apache2/rubies/redmine-site-2.include
# /etc/apache2/rubies/redmine-site-2.include
        <Directory /var/www/html/redmine-site-2-url>
            PassengerAppRoot /home/redmine_usr_2/redmine_2
            PassengerAppEnv redmine_2_env
            PassengerAppGroupName redmine_2
            RailsBaseURI /redmine-site-2-url
            PassengerUser redmine_usr_2
            PassengerGroup redmine_usr_2
            PassengerFriendlyErrorPages on
        </Directory>
EOF'
# tweak the existing apache redmine site.conf to include
# the /etc/apache2/rubies include file for the new site
cd /etc/apache2/sites-available
sudo cp -p redmine-sites.conf redmine-sites.conf_org
sudo sh -c 'sed -e "/redmine-site-1.include/ a\ \ \ \ Include rubies/redmine-site-2.include" redmine-sites.conf_org >redmine-sites.c
onf_new'
sudo cp -p redmine-sites.conf_new redmine-sites.conf
sudo cp -p redmine-sites-le-ssl.conf redmine-sites-le-ssl.conf_org
sudo sh -c 'sed -e "/redmine-site-1.include/ a\ \ \ \ Include rubies/redmine-site-2.include" redmine-sites-le-ssl.conf_org >redmine-
sites-le-ssl.conf_new'
sudo cp -p redmine-sites-le-ssl.conf_new redmine-sites-le-ssl.conf
sudo apache2ctl restart

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-02
    • 1970-01-01
    • 1970-01-01
    • 2019-07-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多