[solved] redmine appliance turnkey on proxmox

Added by zuck bin over 3 years ago

Hi,

debian 7 turnkey redmine appliance

ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
RubyGems version = 1.8.23
rails -v
Rails 4.0.0

mysql2 driver

User and groups
uid=33(www-data) gid=33(www-data) groups=33(www-data)

i setup redmine appliance turnkey on proxmox inside a CT

i use pound to transfer traffic to redmine inside my CT, but got this error:

undefined method `level=' for nil:NilClass (NoMethodError)
/var/www/redmine/config/environments/production.rb:17:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:24:in `class_eval'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:24:in `configure'
/var/www/redmine/config/environments/production.rb:2:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
/var/lib/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
/var/lib/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:571:in `block in <class:Engine>'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/redmine/config/environment.rb:14:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
/var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/var/lib/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:105:in `eval'
/var/lib/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:105:in `preload_app'
/var/lib/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:150:in `<module:App>'
/var/lib/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/var/lib/gems/1.9.1/gems/passenger-4.0.20/helper-scripts/rack-preloader.rb:28:in `<main>'

where is my mistake ?

Don't find solution on google or forums...

thanks for your help
++

Replies (17)

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

nobody, no clue ?

is there something missing ?

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

it works on this appliance and this is version 4 (because i can use it on another server).

RE: redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

Does your CT have bridged adapter? i.e. it has the same IP range as Proxmox host or Proxmox has it's own network and CT it's own?
So this is not redmine related if same installation works on other server, let's say redmine doesn't answer to pound (or can't answer), am I right?
Did you try to you nginx instead of pound?

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

i use proxmox 3 as hypervisor with pound on the hypervisor to distribute services and domain.tld for the good CT.

redmine is inside a CT; this is the default tunrkey appliance; i didn't modified it.

I already try nginx in a CT with proxy_pass to the redmine CT: doesn't work, same error ! Both HTTP and HTTPS

All my CT use bridged connection with a private network, see below:

HOST

...
auto vmbr2
iface vmbr2 inet static
address 192.168.0.254
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE

CT
auto eth0
iface eth0 inet static
address 192.168.0.3
broadcast 192.168.0.255
gateway 192.168.0.254

All my others services works: php, apache, nginx, mysql, websites, ...
but i failed on redmine to work inside a CT with a domain.com

RE: redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

auto vmbr2
iface vmbr2 inet static

post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE

Is there any reason for this rules?

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

i do NAT for my ftp, mysql, ...i can try to desactivate

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

it doesn't work without the 2 lines for the masquerade...

RE: redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

I didn't understand why you have 192.168.0.x network on vmbr2 but use NAT on vmbr0.
If any packet is coming from 192.168.0.x network to your redmine host it reaches it directly through vmbr2.
Then redmine send reply packet and it should go back through vmbr2 too.
But any initial (new connections from redmine host) and reply packets are going to NAT rules and incoming connections from 192.168.0.x network to your redmine's host don't work.
This is just my assumption.

RE: redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

I've exactly same scenario:
- local net 192.168.x.x
- local DNS record for redmine.company.net = ip_of_redmine_VM
- local PTR record
- proxmox with one physical NIC in bridged mode
- a lot of VM and CT inside
- all firewalls switched off
- any VM's or CT's are reached from LAN as well as if they were usual PC with NIC
- redmine VM has nginx + ruby_web-server. When client open redmine.company.net his browser comes to redmine's_ip and nginx redirect connection to ruby_web-server.

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

vmbr0 is my public ip to go on internet
vmbr2 is my internal private ip for the lan

here all my interfaces file:

  1. The loopback network interface
    auto lo
    iface lo inet loopback
  1. for Routing
    auto vmbr1
    iface vmbr1 inet manual
    post-up /etc/pve/kvm-networking.sh
    bridge_ports dummy0
    bridge_stp off
    bridge_fd 0
  1. vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
    auto vmbr0
    iface vmbr0 inet static
    address x.x.x.64
    netmask 255.255.255.0
    network x.x.x.0
    broadcast x.x.x.255
    gateway x.x.x.254
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

auto vmbr2
iface vmbr2 inet static
address 192.168.0.254
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE

Can i see your ?

RE: redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

root@proxmox:~# ip r
192.168.2.0/24 dev vmbr0  proto kernel  scope link  src 192.168.2.201 
192.168.188.0/24 dev vmbr1  proto kernel  scope link  src 192.168.188.100 
default via 192.168.2.80 dev vmbr0 

root@proxmox:~# cat /etc/network/interfaces 
# network interface settings
auto lo
iface lo inet loopback

iface eth0 inet manual        # LAN

iface eth1 inet manual        # Direct cable to NAS

auto vmbr0
iface vmbr0 inet static
        address  192.168.2.201
        netmask  255.255.255.0
        gateway  192.168.2.80
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

auto vmbr1
iface vmbr1 inet static
        address  192.168.188.100
        netmask  255.255.255.0
        bridge_ports eth1
        bridge_stp off
        bridge_fd 0

root@proxmox:~# ssh root@redmine.domain.net
root@redmine.domain.net's password: 
Last login: Thu Feb  6 14:30:05 2014 from 192.168.5.1
[root@redmine ~]# ip r
192.168.2.0/24 dev eth0  proto kernel  scope link  src 192.168.2.245 
192.168.188.0/24 dev eth1  proto kernel  scope link  src 192.168.188.4 
169.254.0.0/16 dev eth0  scope link  metric 1002 
169.254.0.0/16 dev eth1  scope link  metric 1003 
default via 192.168.2.80 dev eth0
[root@redmine ~]# cd /var/www/rm2.4.0/
[root@redmine rm2.4.0]# cat ./config/unicorn.rb 
worker_processes 3 # for example
#listen 3000, :tcp_nopush => true
listen "/tmp/unicorn/unicorn.sock", :backlog => 20
timeout 300
user "nginx" 
#logger "debug" 
stderr_path "/var/www/rm2.4.0/log/unicorn.err.log" 
stdout_path "/var/www/rm2.4.0/log/unicorn.out.log" 
pid "/tmp/unicorn/unicorn.pid" 
check_client_connection false
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory "/var/www/rm2.4.0" 
[root@redmine ~]# cat /etc/unicorn/rm.conf 
RAILS_ENV=production
RAILS_ROOT=/var/www/rm2.4.0
[root@redmine ~]# cat /etc/init.d/unicorn
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
#
# Use this as a basis for your own Unicorn init script.
# Change APPLICATION to match your app.
# Make sure that all paths are correct.
# Change these to match your app:
#APP_NAME=redmine
#RAILS_ROOT="/var/www/redmine" 
#PID="/var/run/unicorn.pid" 
#ENV=production
#CMD="/usr/local/bin/unicorn_rails -D -E $ENV -c $APP_ROOT/config/unicorn.rb" 
#old_pid="$PID.oldbin" 
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/local/rvm/gems/ruby-1.9.3-p327/bin:/usr/local/rvm/bin

if [ ! -d "/tmp/unicorn" ]; then
mkdir /tmp/unicorn
fi

set -e

sig () {
  test -s "$PID" && kill -$1 `cat "$PID"`
}

oldsig () {
  test -s "$OLD_PID" && kill -$1 `cat "$OLD_PID"`
}

cmd () {

  case $1 in
    start)
      sig 0 && echo >&2 "Already running" && exit 0
      echo "Starting" 
      $CMD
      ;;  
    stop)
      sig QUIT && echo "Stopping" && exit 0
      echo >&2 "Not running" 
      ;;  
    force-stop)
      sig TERM && echo "Forcing a stop" && exit 0
      echo >&2 "Not running" 
      ;;  
    restart|reload)
      sig USR2 && sleep 5 && oldsig QUIT && echo "Killing old master" `cat $OLD_PID` && exit 0
      echo >&2 "Couldn't reload, starting '$CMD' instead" 
      $CMD
      ;;  
    upgrade)
      sig USR2 && echo Upgraded && exit 0
      echo >&2 "Couldn't upgrade, starting '$CMD' instead" 
      $CMD
      ;;  
    rotate)
            sig USR1 && echo rotated logs OK && exit 0
            echo >&2 "Couldn't rotate logs" && exit 1
            ;;  
    *)  
      echo >&2 "Usage: $0 <start|stop|restart|upgrade|rotate|force-stop>" 
      exit 1
      ;;  
    esac
}

setup () {

  echo -n "$RAILS_ROOT: "  
  cd $RAILS_ROOT || exit 1
  export PID=/tmp/unicorn/unicorn.pid
  export OLD_PID="$PID.oldbin" 

  CMD="/usr/local/rvm/gems/ruby-1.9.3-p327/bin/unicorn_rails -c config/unicorn.rb -E $RAILS_ENV -D" 
}

start_stop () {

  # either run the start/stop/reload/etc command for every config under /etc/unicorn
  # or just do it for a specific one

  # $1 contains the start/stop/etc command
  # $2 if it exists, should be the specific config we want to act on
  if [ $2 ]; then
    . $2
    setup
    cmd $1
  else
    for CONFIG in /etc/unicorn/rm.conf; do
      # import the variables
      . $CONFIG
      setup

      # run the start/stop/etc command
      cmd $1
    done
   fi
}

ARGS="$1 $2" 
start_stop $ARGS

[root@redmine ~]# cat /etc/nginx/conf.d/redmine.conf 
upstream thin {
#server 127.0.0.1:3000;
#server 127.0.0.1:3001;
server unix:/tmp/unicorn/unicorn.sock fail_timeout=0; }
server {
        listen 192.168.2.245:80;
        server_name redmine.domain.net;
        if ( $http_host != redmine.domain.net ) {
        return 444;
        }
#       rewrite ^ https://$server_name$request_uri? permanent; }
        gzip on;
        gzip_min_length 1100;
        gzip_buffers 4 32k;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 75;
            location ~ ^/$ {
                     if (-f /index.html) {
                      rewrite (.*) /index.html last; }
                      proxy_pass http://thin;
                      access_log off;
                      error_log off; }
            location ^~ /files/ {
                      root /var/www/rm2.4.0/files;
                      expires 30d;
                      access_log off;
                      error_log off; }
#           location ~* \.(html|css)$ {
#                     root /var/www/rm2.4.0/public;
#                     expires 30d;
#                     access_log off;
#                     error_log off; }
            location / {
                      root /var/www/rm2.4.0;
                      proxy_pass http://thin;
                      proxy_redirect off;
                      proxy_read_timeout 600s;
                      #proxy_send_timeout 600s;
                      proxy_set_header Host $host;
                      proxy_set_header X-Real-IP $remote_addr;
                      proxy_set_header X-Forwarded-For $remote_addr;
                      proxy_set_header CLIENT_IP $remote_addr;
                      client_max_body_size 200m;
                      access_log off;
                      error_log off; }
             location = /stat {
                      stub_status on;
                      access_log  off;
                      access_log off;
                      error_log off; }
}
server {
        if ( $http_host != redmine.domain.net ) {
        return 444;
        }
        allow 192.168.5.0/24;
        allow 192.168.2.0/24;
        allow 192.168.66.0/24;
        allow 192.168.88.0/24;
        allow 192.168.99.0/24;
        deny all;
        include /etc/nginx/ssl/ssl.conf;
        listen 192.168.2.245:443;
        #listen 192.168.2.245:80;
        server_name redmine.domain.net;
        gzip on;
        gzip_min_length 1100;
        gzip_buffers 4 32k;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 75;
            location ~ ^/$ {
                     if (-f /index.html) {
                      rewrite (.*) /index.html last; }
                      proxy_pass http://thin;
                      access_log off;
                      error_log off; }
            location ^~ /files/ {
                      root /var/www/rm2.4.0/files;
                      expires 30d;
                      access_log off;
                      error_log off; }
#           location ~* \.(html|css)$ {
#                     root /var/www/rm2.4.0/public;
#                     expires 30d;
#                     access_log off;
#                     error_log off; }
            location / {
                      root /var/www/rm2.4.0;
                      proxy_pass http://thin;
                      proxy_redirect off;
                      proxy_read_timeout 600s;
                      #proxy_send_timeout 600s;
                      proxy_set_header Host $host;
                      proxy_set_header X-Real-IP $remote_addr;
                      proxy_set_header X-Forwarded-For $remote_addr;
                      proxy_set_header CLIENT_IP $remote_addr;
                      client_max_body_size 200m;
                      access_log off;
                      error_log off; }
             location = /stat {
                      stub_status on;
                      access_log  off;
                      access_log off;
                      error_log off; }
        }

Did you stop iptables on both redmine and prmx servers?

RE: redmine appliance turnkey on proxmox - Added by zuck bin over 3 years ago

Problem solved

i don't know why, i had re create my CT and now it works !

I use vmbr2 !

thank you Pavel ;)

RE: [solved] redmine appliance turnkey on proxmox - Added by Youssef Boujraf over 3 years ago

Dear All,

I installed Proxmox V3.2

I 'd like to use Redmine on my virtual machine.

I am not expert

Please do you have the link where I can download the correct image or CT with the latest redmine release?

Best Regards,
Youssef

RE: [solved] redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

In the proxmox web interface go to the Storage (under Datacenter menu at left) and select content Tab, select Template and download redmine
penVZ image.
Then create new CT and select this image as template.

RE: [solved] redmine appliance turnkey on proxmox - Added by Youssef Boujraf over 3 years ago

Dear Thanks.

Do you know which is the Redmine version used with the OpenVz template please ?

Best Regards,
Youssef Boujraf

RE: [solved] redmine appliance turnkey on proxmox - Added by Pavel Potcheptsov over 3 years ago

Hope this help.
redmine 2.2.3 as I see it.

(1-17/17)