I have been tasked with putting a chiliproject instance back online. It is running on a CentOS 6 (64 bits) server. The problem is, I know absolutely zero Ruby, and my Linux knowledge isn't much more advanced than that; I have absolutely no idea where to start.
When I load the page on a browser, the following gets written to /var/log/nginx/redmine-proxy-error
:
2014/01/13 11:52:06 [crit] 1865#0: *675 connect() to unix:/var/run/redmine/sockets/thin.3.sock failed (2: No such file or directory) while connecting to upstream, client: IPADDRESSHERE, server: REDACTED.com.br, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/redmine/sockets/thin.3.sock:/", host: "REDACTED.com.br"
2014/01/13 11:52:06 [crit] 1865#0: *675 connect() to unix:/var/run/redmine/sockets/thin.0.sock failed (2: No such file or directory) while connecting to upstream, client: IPADDRESSHERE, server: REDACTED.com.br, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/redmine/sockets/thin.0.sock:/", host: "REDACTED.com.br"
2014/01/13 11:52:06 [crit] 1865#0: *675 connect() to unix:/var/run/redmine/sockets/thin.1.sock failed (2: No such file or directory) while connecting to upstream, client: IPADDRESSHERE, server: REDACTED.com.br, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/redmine/sockets/thin.1.sock:/", host: "REDACTED.com.br"
2014/01/13 11:52:06 [crit] 1865#0: *675 connect() to unix:/var/run/redmine/sockets/thin.2.sock failed (2: No such file or directory) while connecting to upstream, client: IPADDRESSHERE, server: REDACTED.com.br, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/redmine/sockets/thin.2.sock:/", host: "REDACTED.com.br"
I got some help from #chiliproject on IRC:
thin
is an app server which (in your case) seems to be tasked to run the actual chiliproject code. It has to be started seperately from nginx, and should then (according to your config) create a listening socket at /var/run/redmine/sockets/thin.3.sock where your nginx forwards connections to. You might have a seperate init script for thin already. Or else you might have to start it using script/server or the thin executable inside your chiliproject dir. You probably have a thin config file somewhere (something like redmine.yml, e.g. in /etc/thin), it should contain (in human readable form) some config settings for thin, including the socket location, your chiliproject directory and other stuff. You can start thin by runningthin start -C /etc/thin/redmine.yml
Here is my /etc/thin/redmine.yml
(the only file on this dir):
---
chdir: /srv/www/redmine/chiliproject
environment: production
timeout: 30
log: /var/log/redmine/thin.log
pid: /var/run/redmine/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
servers: 4
socket: /var/run/redmine/sockets/thin.sock
daemonize: true
user: redmine
group: redmine
And here's /etc/rc.d/init.d/thin
:
#!/usr/bin/env sh
### BEGIN INIT INFO
# Provides: thin
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: thin initscript
# Description: thin
### END INIT INFO
# Original author: Forrest Robertson
# Do NOT "set -e"
DAEMON=/usr/local/rvm/gems/ruby-1.9.2-p290/bin/thin
#DAEMON=/usr/local/rvm/bin/bootup_thin
SCRIPT_NAME=/etc/init.d/thin
#CONFIG_PATH=/etc/thin
CONFIG_PATH=/etc/thin/redmine.yml
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
#$DAEMON start --all $CONFIG_PATH
$DAEMON start -C /etc/thin/redmine.yml
;;
stop)
$DAEMON stop --all $CONFIG_PATH
;;
restart)
$DAEMON restart --all $CONFIG_PATH
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 3
;;
esac
:
There is no /usr/local/rvm/bin/bootup_thin
file.
I reboot the machine and run ps aux | grep thin
it shows me nothing (besides the grep itself).
If I execute start -C /etc/thin/redmine.yml
I get a text output on screen and thin starts and I can browse the site. If I reboot the machine, the service will not load properly, despite the init.d
file. This file is being executed, because I have placed a touch /var/log/test
line on the start)
clause and the file is created. I have also appended > /var/log/thin_output
to the end of the start line, but it creates and empty file, and the thin
logs do not show it being started.
Including start -C /etc/thin/redmine.yml
at the end of /etc/rc.local
also has no effect.
The output of type thin
is
thin is /usr/local/rvm/gems/ruby-1.9.2-p290/bin/thin
If I type /etc/init.d/thin start
it will start with a normal output:
Starting server on /var/run/redmine/sockets/thin.0.sock ...
Starting server on /var/run/redmine/sockets/thin.1.sock ...
Starting server on /var/run/redmine/sockets/thin.2.sock ...
Starting server on /var/run/redmine/sockets/thin.3.sock ...
I was asked on chat to paste the output of find -L /etc/ -samefile /etc/init.d/thin
, it is:
/etc/rc2.d/K50thin /etc/rc0.d/K50thin /etc/rc5.d/K50thin /etc/init.d/thin /etc/rc.d/rc2.d/K50thin /etc/rc.d/rc0.d/K50thin /etc/rc.d/rc5.d/K50thin /etc/rc.d/init.d/thin /etc/rc.d/rc3.d/K50thin /etc/rc.d/rc1.d/K50thin /etc/rc.d/rc4.d/K50thin /etc/rc.d/rc6.d/K50thin /etc/rc3.d/K50thin /etc/rc1.d/K50thin /etc/rc4.d/K50thin /etc/rc6.d/K50thin
I did perform sudo chkconfig thin on
as suggested in an answer here, and chkconfig -l thin
outputs
thin 0:off 1:off 2:on 3:on 4:on 5:on 6:off
and the output of find -L /etc/ -samefile /etc/init.d/thin
changes to /etc/rc2.d/S50thin /etc/rc0.d/K50thin /etc/rc5.d/S50thin /etc/init.d/thin /etc/rc.d/rc2.d/S50thin /etc/rc.d/rc0.d/K50thin /etc/rc.d/rc5.d/S50thin /etc/rc.d/init.d/thin /etc/rc.d/rc3.d/S50thin /etc/rc.d/rc1.d/K50thin /etc/rc.d/rc4.d/S50thin /etc/rc.d/rc6.d/K50thin /etc/rc3.d/S50thin /etc/rc1.d/K50thin /etc/rc4.d/S50thin /etc/rc6.d/K50thin
; but when I reboot, thin is still not running.
Someone suggested me to compare the environment variables on different runlevels, so I included printenv > /var/log/printenv.log
on a line of /etc/rc.d/init.d/thin
and compared it to the output of printenv
on the CLI. Here's the results:
TERM=linux
PATH=/sbin:/usr/sbin:/bin:/usr/bin
RUNLEVEL=3
runlevel=3
PWD=/
LANGSH_SOURCED=1
LANG=pt_BR.UTF-8
PREVLEVEL=N
previous=N
CONSOLETYPE=vt
SHLVL=2
UPSTART_INSTANCE=
UPSTART_EVENTS=runlevel
UPSTART_JOB=rc
_=/usr/bin/printenv
and
rvm_bin_path=/usr/local/rvm/bin
HOSTNAME=redacted.com.br
GEM_HOME=/usr/local/rvm/gems/ruby-1.9.2-p290
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
IRBRC=/usr/local/rvm/rubies/ruby-1.9.2-p290/.irbrc
SSH_CLIENT=REDACTED
OLDPWD=/etc
MY_RUBY_HOME=/usr/local/rvm/rubies/ruby-1.9.2-p290
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
__array_start=0
rvm_path=/usr/local/rvm
escape_flag=1
rvm_prefix=/usr/local
MAIL=/var/spool/mail/root
PATH=/usr/local/rvm/gems/ruby-1.9.2-p290/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PWD=/
XMODIFIERS=@im=ibus
LANG=pt_BR.utf8
_second=1
HISTCONTROL=ignoredups
rvm_version=1.16.17 (stable)
SHLVL=1
HOME=/root
_first=0
LOGNAME=root
CVS_RSH=ssh
GEM_PATH=/usr/local/rvm/gems/ruby-1.9.2-p290:/usr/local/rvm/gems/ruby-1.9.2-p290@global
SSH_CONNECTION=REDACTED
LESSOPEN=|/usr/bin/lesspipe.sh %s
RUBY_VERSION=ruby-1.9.2-p290
G_BROKEN_FILENAMES=1
_=/usr/bin/printenv