SOLVED Newznab With FreeNAS

Status
Not open for further replies.

9C1 Newbee

Patron
Joined
Oct 9, 2012
Messages
485
Seems there were a few people a while back who showed interest in creating a Newznab server under FreeNAS. With the VirtualBox template available, I saw that as a great opportunity to do just that. I created a Windows 7 VM. I installed Newznab per this guide:

http://www.tiag.me/installing-newznab-with-xampp-on-windows/

Everything ran ok for a while. Windows 7 would freeze. VirtualBox couldn't shut Windows 7 down either. The only way I could shut it down is to stop the VirtualBox jail via the FreeNAS GUI. I came across some suggestions to make Windows play nice in this thread:

https://forums.freenas.org/index.php?threads/freenas-virtualbox-windows-7-unstable.25320/

I have not attempted any of those suggestions to fix Windows.

I have however installed Newznab in an Ubuntu 14.04 instance. following this guide:

http://www.tiag.me/medics-newznab-ubuntu-14-04-setup-guide/

After the 3rd attempt over a few months, I finally got it right! I have had the server up for a couple of days and it has been rock solid so far.

I initially went the windows route because I am much more familiar with it. The Ubuntu route only took 3 attempts because of my severe lack of knowledge of Linux. The struggle seems to have paid off! I have a bit more knowledge now about Ubuntu. And the server seems quicker, uses less memory, uses less cpu, seems to be WAY more solid.

Just thought it may help someone.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
You don't need Virtualbox/Windows/Ubuntu to do this. Newnab is yet another PHP application that uses a MySQL database. I run nZEDb (a much improved fork of Newznab) in a jail on my FreeBSD server. But, I tested and documented how to set it up it in a FreeNAS jail before deploying it in production.

Here's a peak of my setup. Sorry for the production quality, lol.


I might properly document how to install nZEDb in a FreeNAS jail one day, just juggling too many things right now.
 
Last edited:

9C1 Newbee

Patron
Joined
Oct 9, 2012
Messages
485
I will be eagerly waiting your guide.

Running high voltage is not a big deal. WAY easier than putting ends on a damn ethernet cable. The biggest problem is fishing it to where you need it.

You run wire around your house about like I do. LOL

Hawaii 5-o is a pretty good show.

How do I become one of your "friends" :D

I loved the video. You have things set up rather nice in my opinion.

Never knew about this nzedb. I will read all I can about it.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I will be eagerly waiting your guide.

Running high voltage is not a big deal. WAY easier than putting ends on a damn ethernet cable. The biggest problem is fishing it to where you need it.

You run wire around your house about like I do. LOL

Hawaii 5-o is a pretty good show.

How do I become one of your "friends" :D

I loved the video. You have things set up rather nice in my opinion.

Never knew about this nzedb. I will read all I can about it.
High voltage is still scary for me, don't want to burn down my house, lol.

send me your email and I'll send you an invite.

yeah, nZEBb has alot of nice features. some take alot of work to setup like the tmux automatic indexing, but once you get it setup it more or less runs.
I'll post a guide eventually, but it'll take me some time. Installing nZEDb is pretty complicated, but you end up with something pretty nice in the end.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Joshua,
I watched your video and was wondering how you got tmux working? I've gotten nZEDb working but would like to automate it with tmux and it will only install tmux 2.1 with the pkg install tmux command. tmux 2.1 doesn't work with nZEDb it has to be 1.8-2.0.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ohh, I didn't know the latest tmux didn't work, I have 1.9.a_2 installed because I setup nzedb over a year ago.

Here's the init script I use for nZEDb
Code:
#!/bin/sh
# PROVIDE: nzedb-tmux
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr
name="nzedb_tmux"
rcvar="${name}_enable"
load_rc_config $name

: ${nzedb_tmux_enable:="NO"}
: ${nzedb_tmux_user:="www"}
: ${nzedb_tmux_group:="www"}
: ${nzedb_tmux_dir:="/usr/local/www/nzedb"}
export TERM="xterm"
tmux_socket="/tmp/tmux-$(id -u ${nzedb_tmux_user})/default"

nzedb_tmux_chdir="${nzedb_tmux_dir}/misc/update/nix/tmux"
command="/usr/sbin/daemon"
command_args="-f /usr/local/bin/php -f start.php"
procname="/usr/local/bin/tmux"

start_precmd="nzedb_tmux_prestart"
nzedb_tmux_prestart() {
  rm ${tmux_socket} &
  export SHELL="/bin/sh"
}
extra_commands="console"
console_cmd="nzedb_tmux_console"
nzedb_tmux_console() {
  ${procname} -S ${tmux_socket} attach -t nZEDb
}

run_rc_command "$1"
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I was afraid you would say that. So no idea on how to install an older version of tmux in the jail?


I presume I can't use that script unless I can run tmux?
For future reference you save this script to a subdirectory of nix called tmux?
You build an older version of the port

I have that saved as /usr/local/etc/rc.d/nzedb-tmux
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Could you explain how to "edit the port"? I have no clue.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Could you explain how to "edit the port"? I have no clue.
cd /usr/ports/sysutils/tmux
Then edit the version in the file "Makefile"
Run "make makesum" to create a new 'distinfo' file for you
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Got this after editing the version to 1.9

/usr/ports/sysutils/tmux # make makesum
===> License ISCL accepted by the user
===> tmux-1.9_1 depends on file: /usr/local/sbin/pkg - found
/bin/mkdir: No such file or directory
*** [do-fetch] Error code 1

Stop in /usr/ports/sysutils/tmux.
*** [makesum] Error code 1

Stop in /usr/ports/sysutils/tmux.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Got this after editing the version to 1.9

/usr/ports/sysutils/tmux # make makesum
===> License ISCL accepted by the user
===> tmux-1.9_1 depends on file: /usr/local/sbin/pkg - found
/bin/mkdir: No such file or directory
*** [do-fetch] Error code 1

Stop in /usr/ports/sysutils/tmux.
*** [makesum] Error code 1

Stop in /usr/ports/sysutils/tmux.
maybe you could ask on the freebsd forum? I linked the commits to that port so you could change it back yourself.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Joshua,
I getting errors doing update_release.php saying 'Unable to read configuration, verify that the API key is valid' . Bart39 from nzedb thought it was the tmdb api but it seems to be working. He had me ping api.themoviedb.org from within the jail and it would hang. curl -i https://api.themoviedb.org/3/configuration?api_key=myapikey
curl: No match.

He thought it was a DNS issue. My nginx error log shows no entries for today. My nzedb.conf is
Code:
server {
    # Change these settings to match your machine.
    listen 80;
    server_name 192.168.1.158;

    # These are the log locations, you should not have to change these.
    access_log /var/log/nginx-access.log;
    error_log /var/log/nginx-error.log;

    # This is the root web folder for nZEDb, you shouldn't have to change this.
    root /usr/local/www/nZEDb/www/;
    index index.php;

    # Everything below this should not be changed unless noted.
    location ~* \.(?:css|eot|gif|gz|ico|inc|jpe?g|js|ogg|oga|ogv|mp4|m4a|mp3|png|svg|ttf|txt|woff|xml)$ {
        expires max;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    location / {
        try_files $uri $uri/ @rewrites;
    }

    location ^~ /covers/ {
    # This is where the nZEDb covers folder should be in.
        root /usr/local/www/nZEDb/resources;
    }

    location @rewrites {
        rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last;
        rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last;
        rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last;
    }

    location ~ \.php$ {
        include /usr/local/etc/nginx/fastcgi_params;

        # Uncomment the following line and comment the .sock line if you want to use TCP.
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;

        # The next two lines should go in your fastcgi_params
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}


Any ideas?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
It sounds like you don't have working DNS. check your /etc/resolv.conf

curl isn't intalled in the jail by default. I personally use 'fetch'

NGINX has nothing to do with this. You're running stuff on the commandline, your webserver is in no way involved!
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Here is the contents of my resolv.conf, it is the ip address of my router.

search local
nameserver 192.168.1.1
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I would assume its correct then. can you ping your router from the jail?
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I can ping the router from the jail
--- 192.168.1.1 ping statistics ---
21 packets transmitted, 21 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.349/0.904/7.123/1.402 ms

Seems like tmdb works and then craps out hrs later.
http://imgur.com/oA6t65n

Also got this error with multiple terminal windows up in the jail 1 doing update_releases, 2 doing backfill
[root@nzedb_1 /usr/local/www/nZEDb/misc/update]# php backfill alt.binaries.teevee 100000000
Could not open input file: backfill

Suggestions I've gotten in the IRC channel is freenas is unstable and I should reinstall, Install Ubuntu as a VM in a jail to run nzedb.

I know your setup is running fine on freenas but they don't support it.
 
Status
Not open for further replies.
Top