Redmine Nginx Thin
#
$ mkdir /etc/thin
# create a configuration for the local IP
$ thin config -C /etc/thin/redmine.yml -c /opt/redmine/redmine-3.3.0 --servers 2 -e production -a 127.0.0.1 -p 3003
#
$ cat /etc/thin/redmine.yml
---
chdir: "/opt/redmine/redmine-3.3.0"
environment: production
# ????
# socket: /tmp/thin.sock
address: 127.0.0.1
port: 3003
timeout: 30
# this needs to be adjusted
log: "/var/log/thin.log"
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
threadpool_size: 20
servers: 2
daemonize: true
# generate the /etc/init.d/thin startup script
$ thin install
# start
$ service thin start
# output
$ service thin status
● thin.service - LSB: thin initscript
Loaded: loaded (/etc/init.d/thin)
Active: active (running) since Tue 2017-01-31 11:23:40 EET; 2s ago
Process: 26378 ExecStop=/etc/init.d/thin stop (code=exited, status=0/SUCCESS)
Process: 26392 ExecStart=/etc/init.d/thin start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/thin.service
├─26205 thin server (/tmp/thin.1.sock)
└─26407 thin server (/tmp/thin.0.sock)
Jan 31 11:23:40 srv thin[26392]: [start] /etc/thin/redmine.yml ...
Jan 31 11:23:40 srv thin[26392]: Starting server on /tmp/thin.0.sock ...
Jan 31 11:23:40 srv systemd[1]: Started LSB: thin initscript.
Added 2017.04.08: When moving to a new server, an error appeared while starting the thin service:
Apr 08 20:25:48 srv2 systemd[1]: Starting LSB: thin initscript...
Apr 08 20:25:48 srv2 thin[19001]: /usr/bin/env: ruby_executable_hooks: No such file or directory
Apr 08 20:25:48 srv2 systemd[1]: Started LSB: thin initscript.
Solution: find ruby_executable_hooks and create a symbolic link. It was found here:
ln -s /usr/local/rvm/rubies/ruby-2.2.6/lib/ruby/gems/2.2.0/bin/ruby_executable_hooks /usr/bin/ruby_executable_hooks
When accessing Redmine, /var/log/nginx/redmine_error.log reports that the backend is unavailable.
# in the thin log
Listening on 127.0.0.1:3003, CTRL+C to stop
Exiting!
/var/lib/gems/2.1.0/gems/thin-1.7.0/lib/thin/backends/tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)
from /var/lib/gems/2.1.0/gems/thin-1.7.0/lib/thin/backends/base.rb:63:in `block in start'
# add thin to the Gemfile
$ cd /opt/redmine/redmine-3.3.0/
$ echo 'gem "thin"' >> Gemfile
$ bundler update
$ bundler install
# restart thin
$ service thin restart
# check
$ netstat -pln | grep thin
tcp 0 0 127.0.0.1:3003 0.0.0.0:* LISTEN 7878/thin server (1
unix 2 [ ACC ] STREAM LISTENING 4322645 26679/thin.0.sock) /tmp/thin.0.sock
unix 2 [ ACC ] STREAM LISTENING 4317145 26205/thin.1.sock) /tmp/thin.1.sock
unix 2 [ ACC ] STREAM LISTENING 4323474 26843/thin.0.sock) /tmp/thin.0.sock
Access Redmine. Everything works.
Error: Files do not upload (added 2017.04.08). In the Nginx log:
The issue: the JS file is generated rather than static in Redmine. The Nginx configuration was set up to serve JS as a static file. Solution: Exclude the JS extension from static files in the Nginx site configuration.