老鬼的博客 来都来啦,那就随便看看吧~
基于web的项目管理软件redmine-windows部署
发布于: 2022-03-08 更新于: 2023-11-08 分类于:  阅读次数: 

一:介绍

1
redmine是什么:是一个基于web的项目管理软件,用Ruby开发的。

二:下载redmine

1
我这里下载的是redmine-4.2.4版本,ruby环境要求是>= 2.4.0', '< 2.8.0

官方下载

redmine-4.2.4.zip

1.png

三:ruby运行环境

1
2
由于redmine是基于ruby开发的,所以部署也需要下载ruby运行环境,这里
rubyinstaller来下载运行环境。

rubyinstaller-devkit-2.6.9-1-x64.exe

rubyinstaller-devkit-2.7.5-1-x64.exe

rubyinstaller-devkit-3.1.1-1-x64.exe

官方下载

1
下载好rubyinstaller默认安装就行。

四:安装部署

4.1 将redmine解压到一个目录

1
我这里是D:\my-tools\redmine-4.2.4

2.png

4.2 database.yml

1
2
3
4
5
6
7
8
9
10
redmine-4.2.4/config/database.yml.example复制出来并重命名为:
database.yml,修改里面的production的值:
production:
adapter: mysql2
database: redmine # 数据库名称
host: polardb.database # 数据库ip地址
username: develop # 用户名
password: "123456" # 密码
# Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
encoding: utf8mb4

3.png

4.3 安装依赖

1
2
3
4
5
找到前面安装的rubyinstaller,打开Start Command Prompt with Ruby,
进入redmine的根目录,我这里是D:\my-tools\redmine-4.2.4,执行如下:
bundle install
执行如上指令可能会遇到有些包因为网络问题安装失败,反复执行:
bundle install 即可

4.4 创建session密钥

1
rake generate_secret_token

4.4 导入数据库

1
2
3
4
5
6
7
找到前面安装的rubyinstaller,打开Start Command Prompt with Ruby,
进入redmine的根目录,我这里是D:\my-tools\redmine-4.2.4,执行如下:

set RAILS_ENV=production
rake db:migrate
rake redmine:load_default_data(这里会让选择语言,输入zh)
运行完成以后会看到数据库表都已经导入

4.5 启动

1
2
3
4
D:
cd D:\my-tools\redmine-4.2.4
:: 启动 redmine
bundle exec rails server webrick -e production

4.6 日志

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
ruby 2.6.9p207 (2021-11-24 revision 67954) [x64-mingw32]

C:\Users\Administrator>d:

D:\>cd my-tools

D:\my-tools>cd redmine-4.2.4

D:\my-tools\redmine-4.2.4>bundle install
Fetching source index from https://rubygems.org/
Resolving dependencies....
Network error while fetching
https://rubygems.org/quick/Marshal.4.8/puma-2.6.0.gemspec.rz (too many
connection resets (due to execution expired - Net::OpenTimeout) after 221
requests on 434230300, last used 23.4930896 seconds ago)

D:\my-tools\redmine-4.2.4>set RAILS_ENV=production

D:\my-tools\redmine-4.2.4>rake db:migrate
Could not find gem 'rails (= 5.2.6.2) x64-mingw32' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

D:\my-tools\redmine-4.2.4>bundle install
Fetching gem metadata from https://rubygems.org/.
Retrying dependency api due to error (2/4): Bundler::HTTPError Network error while fetching https://index.rubygems.org/api/v1/dependencies?gems=actionpack-xml_parser%2Caddressable%2Cbundler%2Ccapybara%2Ccsv%2Cffi%2Ci18n%2Cmail%2Cmarcel%2Cmini_magick%2Cmini_mime%2Cmocha%2Cmysql2%2Cnet-ldap%2Cnokogiri%2Cpuma%2Crack-openid%2Crails%2Crails-dom-testing%2Crbpdf%2Credcarpet%2Crequest_store%2Croadie-rails%2Crotp%2Crouge%2Crqrcode%2Crubocop%2Crubocop-performance%2Crubocop-rails%2Cruby-openid%2Crubyzip%2Cselenium-webdriver%2Csimplecov%2Ctzinfo-data%2Cwebdrivers%2Cyard (too many connection resets (due to Net::ReadTimeout with #<TCPSocket:(closed)> - Net::ReadTimeout) after 1 requests on 59128380, last used 47.6053436 seconds ago)..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Fetching rake 13.0.6
Fetching webdrivers 4.7.0
Installing webdrivers 4.7.0
Fetching webrick 1.7.0
Installing webrick 1.7.0
Fetching yard 0.9.27
Installing yard 0.9.27
Bundle complete! 36 Gemfile dependencies, 89 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from mysql2:

======================================================================================================

You've installed the binary version of mysql2.
It was built using MySQL Connector/C version 6.1.11.
It's recommended to use the exact same version to avoid potential issues.

At the time of building this gem, the necessary DLL files were retrieved from:
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.11-win32.zip

This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.

======================================================================================================

Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
* `Zip::File`
* `Zip::Entry`
* `Zip::InputStream`
* `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

D:\my-tools\redmine-4.2.4>rake db:migrate
rake aborted!
ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`
D:/my-tools/redmine-4.2.4/config/environment.rb:16:in `<top (required)>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

D:\my-tools\redmine-4.2.4>rake redmine:load_default_data
rake aborted!
Interrupt:
D:/my-tools/redmine-4.2.4/lib/plugins/acts_as_activity_provider/init.rb:4:in `block in <top (required)>'
D:/my-tools/redmine-4.2.4/config/initializers/00-core_plugins.rb:14:in `eval'
D:/my-tools/redmine-4.2.4/config/initializers/00-core_plugins.rb:14:in `block in <top (required)>'
D:/my-tools/redmine-4.2.4/config/initializers/00-core_plugins.rb:4:in `each'
D:/my-tools/redmine-4.2.4/config/initializers/00-core_plugins.rb:4:in `<top (required)>'
D:/my-tools/redmine-4.2.4/config/environment.rb:16:in `<top (required)>'
Tasks: TOP => redmine:load_default_data => environment
(See full trace by running task with --trace)
终止批处理操作吗(Y/N)?
^C
D:\my-tools\redmine-4.2.4> rake generate_secret_token

D:\my-tools\redmine-4.2.4>rake db:migrate

D:\my-tools\redmine-4.2.4>set RAILS_ENV=production

D:\my-tools\redmine-4.2.4>rake db:migrate
== 1 Setup: migrating =========================================================
-- create_table("attachments", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.0149s
-- create_table("auth_sources", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.0102s
-- create_table("custom_fields", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.0091s
-- create_table("custom_fields_projects", {:options=>"ENGINE=InnoDB", :id=>false, :force=>true})

D:\my-tools\redmine-4.2.4>rake redmine:load_default_data

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Default configuration data loaded.

D:\my-tools\redmine-4.2.4>ruby script/rails server webrick -e production
ruby: No such file or directory -- script/rails (LoadError)

D:\my-tools\redmine-4.2.4>bundle exec rails server webrick -e production
=> Booting WEBrick
=> Rails 5.2.6.2 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
[2022-03-09 08:15:39] INFO WEBrick 1.7.0
[2022-03-09 08:15:39] INFO ruby 2.6.9 (2021-11-24) [x64-mingw32]
[2022-03-09 08:15:39] INFO WEBrick::HTTPServer#start: pid=8256 port=3000
127.0.0.1 - - [09/Mar/2022:08:15:46 中国标准时间] "GET / HTTP/1.1" 200 4984

五:步骤概述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
一:使用工具
- rubyinstaller-devkit-2.6.9-1-x64.exe
- redmine-4.2.4
二:步骤
- 创建mysql数据库redmine
- 创建D:\my-tools\redmine-4.2.4\config\database.yml
- 修改production的值
- 执行指令
D:
cd my-tools
cd redmine-4.2.4
bundle install
rake generate_secret_token
set RAILS_ENV=production
rake db:migrate
rake redmine:load_default_data
zh
bundle exec rails server webrick -e production

六:配置邮件服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
D:\my-tools\redmine-4.2.4\config\configuration.yml.example
复制成configuration.yml,并作如下修改:
default:
# Outgoing emails configuration
# See the examples below and the Rails guide for more configuration options:
# http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
email_delivery:
delivery_method: :smtp
smtp_settings:
ssl: true
address: "smtp.exmail.qq.com"
port: 465
authentication: login
user_name: '123@vji.com'
password: '123'
如上是配置腾讯企业邮箱。

七:初始化sql

九:参考文档

*************感谢您的阅读*************