Redmine是基于Ruby开发的经典项目管理平台,功能强大。
thin, A fast and very simple Ruby web server。
本文档非操作手册只列出来关键信息,需要对ruby,redmine,nginx稍有些许了解,完全按照这个文档部署大概率不会成功。。。
安装/升级关键步骤 1 2 3 4 5 6 7 git clone -b 4.0.4 https://github.com/redmine/redmine.git cd redmine gem install bundler bundle install --without development test bundle exec rake generate_secret_token bundle exec rake redmine:plugins:migrate RAILS_ENV=production
升级数据库 1 2 3 4 5 6 bundle install --without development test bundle exec rake generate_secret_token bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:plugins:migrate RAILS_ENV=production bundle exec rake tmp:cache:clear RAILS_ENV=productionvim
thin 安装 1 2 3 4 5 6 7 echo gem "thin" >> Gemfile # 必须写入Gemfile否则启动thin过程会报错 bundle exec rake redmine:plugins:migrate RAILS_ENV=production bundle exec rake redmine:plugins:migrate RAILS_ENV=production --trace gem install thin thin install # 生成/etc/init.d/thin chkconfig --level 345 thin on
创建logrotate配置/etc/logrotate.d/thin 1 2 3 4 5 6 7 8 9 10 11 12 13 /var/log/thin/*.log { daily missingok rotate 52 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/thin restart >/dev/null endscript }
创建thin配置文件/etc/thin/redmine.yml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 pid: /var/run/thin/thin.pid group: nginx wait: 30 timeout: 30 log: /var/log/thin/thin.log max_conns: 1024 require: [] environment: production max_persistent_conns: 512 servers: 4 daemonize: true user: nginx socket: /tmp/thin.sock chdir: /data/DevOps/redmine
nginx配置文件 /etc/nginx/conf.d/redmine.conf 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 upstream thin_cluster { server unix:/tmp/thin.0.sock; server unix:/tmp/thin.1.sock; server unix:/tmp/thin.2.sock; server unix:/tmp/thin.3.sock; } server { listen 80; server_name redmine.server; #charset koi8-r; access_log /var/log/nginx/log/redmine.access.log main; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; #your redmine path root /data/DevOps/redmine/public; proxy_redirect off; location / { try_files $uri/index.html $uri.html $uri @cluster; } location @cluster { proxy_pass http://thin_cluster; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
推荐开源主题 https://github.com/mrliptontea/PurpleMine2
参考文档